简体   繁体   中英

How to launch activity while screen is Locked screen in Android 10

I have to launch an activity when the device is locked, I used the below code to launch the activity from service. it works fine below the android 10 device.

val callIntent = Intent(this, CallActivity::class.java)
callIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
callIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK)
callIntent.putExtra(EXTRA_CALL_TYPE, callType)
callIntent.putExtra(EXTRA_CALL_DIRECTION, callDirection)
startActivity(callIntent)

This code not working in Android 10, any other way to launch the activity in Android 10

You should send a notification instead, with fullScreenIntent .

I think you need permission to background services

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM