{"id":1293,"date":"2023-03-18T10:22:01","date_gmt":"2023-03-18T02:22:01","guid":{"rendered":"https:\/\/www.appblog.cn\/?p=1293"},"modified":"2023-04-29T09:18:39","modified_gmt":"2023-04-29T01:18:39","slug":"android-10-api-29-new-feature-adaptation-prohibit-background-launch-of-activities","status":"publish","type":"post","link":"https:\/\/www.appblog.cn\/index.php\/2023\/03\/18\/android-10-api-29-new-feature-adaptation-prohibit-background-launch-of-activities\/","title":{"rendered":"Android 10(Api 29)\u65b0\u7279\u6027\u9002\u914d &#8211; \u7981\u6b62\u540e\u53f0\u542f\u52a8Activity"},"content":{"rendered":"<p>\u5b98\u65b9\u6587\u6863\uff1a<a target=\"_blank\" rel=\"noopener\" href=\"https:\/\/developer.android.google.cn\/preview\/privacy\/background-activity-starts\">https:\/\/developer.android.google.cn\/preview\/privacy\/background-activity-starts<\/a><\/p>\n<h2>\u73b0\u8c61\u63cf\u8ff0<\/h2>\n<ul>\n<li>AndroidQ\u4e0a\uff0c\u540e\u53f0\u542f\u52a8Activity\u4f1a\u88ab\u7cfb\u7edf\u5ffd\u7565\uff0c\u4e0d\u7ba1targetSdkVersion\u591a\u5c11<\/li>\n<li>AndroidQ\u4e0a\uff0c\u5373\u4f7f\u5e94\u7528\u6709\u524d\u53f0\u670d\u52a1\u4e5f\u4e0d\u884c<\/li>\n<li>AndroidQ\u4ee5\u4e0b\u7248\u672c\u6ca1\u5f71\u54cd<\/li>\n<\/ul>\n<p><!-- more --><\/p>\n<h2>\u89e3\u51b3\u65b9\u6cd5<\/h2>\n<p>\u53d1\u9001\u5168\u5c4f\u901a\u77e5:<\/p>\n<pre><code class=\"language-xml\">\/\/AndroidManifest \u58f0\u660e\u65b0\u6743\u9650\uff0c\u4e0d\u7528\u52a8\u6001\u7533\u8bf7\n&lt;uses-permission android:name=&quot;android.permission.USE_FULL_SCREEN_INTENT&quot;\/&gt;<\/code><\/pre>\n<pre><code class=\"language-java\">Intent intent = new Intent(this, ScopedStorageActivity.class);\nPendingIntent pendingIntent = PendingIntent.getActivity(this,\n        REQ_CODE, intent, PendingIntent.FLAG_UPDATE_CURRENT);\nNotification notification = new NotificationCompat.Builder(this, Constants.CHANNEL_ID)\n        .setSmallIcon(R.drawable.ic_launcher_foreground)\n        .setContentTitle(&quot;Incoming call&quot;)\n        .setContentText(&quot;(919) 555-1234&quot;)\n        .setPriority(NotificationCompat.PRIORITY_HIGH)\n        .setCategory(NotificationCompat.CATEGORY_ALARM)\n        \/\/\u8bbe\u7f6e\u5168\u5c4f\u901a\u77e5\u540e\uff0c\u53d1\u9001\u901a\u77e5\u76f4\u63a5\u542f\u52a8Activity\n        .setFullScreenIntent(pendingIntent, true)\n        .build();\nNotificationManager manager = getSystemService(NotificationManager.class);\nmanager.notify(10, notification);<\/code><\/pre>\n<p>\u4f46\u662f\uff1a\u5728\u534e\u4e3amate20\uff08Api-28\uff09\u4e0a\u9700\u8981\u5230\u8bbe\u7f6e\u4e2d\u6253\u5f00\u6a2a\u5e45\u901a\u77e5\uff1b\u539f\u751fAndroid Q\u4e0a\u6709\u6548<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5b98\u65b9\u6587\u6863\uff1ahttps:\/\/developer.android.google.cn\/preview\/privac [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[325],"tags":[],"class_list":["post-1293","post","type-post","status-publish","format-standard","hentry","category-android-adaptation"],"_links":{"self":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/1293","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/comments?post=1293"}],"version-history":[{"count":0,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/1293\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/media?parent=1293"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/categories?post=1293"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/tags?post=1293"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}