Bug with Activity.GetStartingIntent?

RadCoder

Member
Licensed User
Longtime User
I have an activity attribute defined in the manifest as :

ActivityA, android:launchMode,singleTask

If I send ActivityA an intent the first time

Activity.GetStartingIntent returns the intent

then call ActivityA.finish

later on I send another intent to ActivityA

Activity.GetStartingIntent returns the original intent not the new intent.

According to the docs, android:launchMode singleTask routes the intent to existing instance through a call to its onNewIntent() method, rather than creating a new one. But GetStartingIntent is not returning it?
 

RadCoder

Member
Licensed User
Longtime User
because I have a special case activity where I needed one of the activities when opened to clear and finish all other activities on the stack. So singletask launch mode in combination with Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET intent flag achieve that effect.

based on my testing, single task with that flag is the only combo which achieves my desired special case.

In the interim to this potential bug I have implemented a workaround using a process variable to retrieve the data but its not ideal. Can you confirm if this is a bug or something B4a does not support?
 
Upvote 0

RadCoder

Member
Licensed User
Longtime User
it must be somehow related to the instance of the activity. According to the android docs, singletask forces android to re-use the activity and not create a new instance. Not sure how a singletask activity fits in the B4a framework but somehow the onNewIntent event is not firing or it is and its setting the incoming intent on the wrong activity instance
 
Upvote 0
Top