日期:
来源:郭霖收集编辑:黄林晴
https://juejin.cn/post/7198067983775973432
Pixel 4a (5G) Pixel 5 and 5a Pixel 6 and 6 Pro Pixel 6a Pixel 7 and 7 Pro
android {
compileSdkPreview "UpsideDownCake"
defaultConfig {
targetSdkPreview "UpsideDownCake"
}
}
connectedDevice dataSync health location mediaPlayback mediaProjection microphone phoneCall remoteMessaging shortService specialUse systemExempted
<manifest ...>
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_TYPE_MEDIA_PLAYPACK" />
<application ...>
<service
android:name=".MyMediaPlaybackService"
android:foregroundServiceType="mediaPlayback"
android:permission="android.permission.FOREGROUND_SERVICE_TYPE_MEDIA_PLAYPACK"
android:exported="false">
</service>
</application>
</manifest>
Service.startForeground(0, notification, FOREGROUND_SERVICE_TYPE_LOCATION)
<activity
android:name=".AppActivity"
android:exported="false">
<intent-filter>
<action android:name="com.example.action.APP_ACTION" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
context.startActivity(Intent("com.example.action.APP_ACTION"))
val explicitIntent =
Intent("com.example.action.APP_ACTION")
explicitIntent.apply {
package = context.packageName
}
context.startActivity(explicitIntent)
Contract.Contacts#ENTERPRISE_CONTENT_URI ContactsContract.CommonDataKinds.Phone#ENTERPRISE_CONTENT_URI