问题
I was starting activity from services till android P, but from android10 google has kept one restriction that activity cannot be started from background.
https://developer.android.com/guide/components/activities/background-starts
// below code stopped working
Intent intent = new Intent(this, MyActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
what should i do for android10 ?
回答1:
You can use a notification using setFullScreenIntent
, it's the best you can do or you can ask for SYSTEM_ALERT_WINDOW
permission but it doesn't work with android go devices.
来源:https://stackoverflow.com/questions/57989846/how-to-start-activity-from-service-in-android10