Windows 11
A Microsoft operating system designed for productivity, creativity, and ease of use.
8,988 questions
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
I sideloaded one of the existing Android apps on Windows subsystem for Android(WSA) but it behaves differently on WSA as compared to Android OS. The activity is created which then opens a web browser. The browser redirects back to the app. On Android OS, the "onNewIntent" is called on redirection but on WSA the activity is getting created again(i.e., onCreate is called). In manifest file of the app, the launchMode is set to "singleTask" so I would expect "onNewIntent" to be called on WSA too.
android:launchMode="singleTask"
Is this a known WSA issue? Is there a recommended solution?
Hello there,
onNewIntent is only called if the activity is already open, It won't be called if the Activity is not open.
This means that if your activity was closed, it will start normally and onCreate will be called. You can pass a flag in your intent that tells your Activity that it was started from notification, then you find that flag in your onCreate and if it exists, you call the same functions as you did in onNewIntent():
val intent = Intent(applicationContext, HomeActivity::class.java).apply {
flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_SINGLE_TOP
putExtra("Id", Id)
putExtra("notificationIntent", true);
}
Hope this resolves your Query !!
--If the reply is helpful, please Upvote and Accept it as an answer--