在Android P之前,我可以从服务启动活动。但是从Android 10开始,谷歌设置了一个限制条件:后台无法启动活动。
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);
我该为Android10做些什么?