Start an Activity from inside the execution of an `PendingIntent.getBroadcast(...)` takes too long when the process is dead2020-03-27 android android-intent broadcastreceiver
I have the following situation in my app:
I create a notification from a secondary process with this Content Intent:
PendingIntent.getBroadcast( context, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_CANCEL_CURRENT )
When the user clicks on the notification, the following code is executed:
For some reason that is unknown to me, when the main process is dead, the white screen of the cold start (just like the one that appears when you launch the app from the home of the device) takes too long to start to be displayed.
But if I change the Content Intent to:
PendingIntent.getActivity( context, 0, Intent(context, SomeActivity::class.java), PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_CANCEL_CURRENT )
The white screen of the cold start is instantly displayed when the user clicks on the notification.
How can I make the displaying of the white screen of the cold start from within the broadcast intent instant?
- How to create a notification when my app receive a broadcast message
- How to open dialog styled activity from notification without previous activity closing?
- Intent delivering null content to app when the app is open in onNewIntent and onResume
- PendingIntent getBroadcast and getActivity at same Time
- In Android, how to start an activity of application B when user click on notification from application A?
- Android: how to prevent activity from starting in background and comming to foreground