赞
踩
https://developer.android.com/guide/components/activities/background-starts
https://developer.android.com/training/notify-user/time-sensitive
从Android Q开始android进一步限制了从后台(组件)启动Activity的行为,前台的不受限制。说白了就是用户不知道,你不能随便就蹦出来一个新的界面。想要启动,必须通过“显示通知”的方式来进行,通知用户借助notification来启动新的Activity。
比如
- Intent fullScreenIntent = new Intent(this, CallActivity.class);
- PendingIntent fullScreenPendingIntent = PendingIntent.getActivity(this, 0,
- fullScreenIntent, PendingIntent.FLAG_UPDATE_CURRENT);
-
- NotificationCompat.Builder notificationBuilder =
- new NotificationCompat.Builder(this, CHANNEL_ID)
- .setSmallIcon(R.drawable.notification_icon)
- .setContentTitle("Inco
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。