We can't start activity from Work Manager according to the new Restrictions If App doesn't meet the requirements. All i want is to start activity from Work Manager even application is killed or no longer visible after some specific time. I do not want to run the App in foreground. Is there anyway, I can achieve this?
Any help would be appreciated.
If you have in house App or for testing, You can use this approach.
Add this permission in Menifest.
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
Also go to the App info settings
Setting -> Advanced -> Display over other apps
Allow this permission for this app. Now run the app, This will be able to start the activity from background.
But, I recommend to show notification and open the screen on tap notification.
You shouldn't start activities from background since it interrupts user's work.
If you want to open your app from work manager, you'll have to use notifications instead and set the notification tap action to open your specific activity using pending intents.
Here is a guide on how to create a notification in android.
Additionally, if your app needs to do something urgently, you can create a high priority notification, details here
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With