Closed 0xjohnnycagewins closed 8 years ago
Ok, fixed it without any changes to the library.
Simply added android:launchMode="singleInstance"
(not sure if singleTask
is better...) and removed all the flags in the Intent
created when receiving the push notification. The Activity
is not recreated if already running. This can be closed.
android:launchMode="singleTop"
:)
When starting the main
Activity
with aPendingIntent
(for example when taping on a push notification), this latter goes through the normal lifecycle (onCreate
->onStart
...). If the app is running when the intent is received, theNavigator
object still exists in theActivity
and therefore can't be set usingmNavigator = ActivityArchitector.onCreateNavigator(...)
inonCreate
method because this method callsnavigator.delegate().onCreate(...)
which sends an exception if the container view is notnull
.As a temp fix, we modified the code in the
Activity
'sonCreate
method to:However, in
onStart
methodmNavigator.delegate().onStart()
is called which throws an exception is the dispatching callback is notnull
, which is the case in that situation. Not sure what would be the best fix for that, because I don't see why this check is necessary. If it is, there should be a way to manually deactivate the dispatcher.Also, interesting stuff, we tried to temporary hack it using this code:
For some reason we can't explain (we would have to dig deeper into the code), it does not work. It seems like the Mortar scope gets cleared. Any ideas? Also, I guess a method to clear the history (that would call
this.history.killAll(true)
) would be useful inNavigator
.