IDriveConnectAddons
IDriveConnectAddons copied to clipboard
auto grant screen mirroring permission?
Hi,
We could add OP_PROJECT_MEDIA AppOps to the app to make click grant permission without popup an alert.
like: adb shell cmd appops set <pkg> PROJECT_MEDIA allow
so is there a way we can auto-grant it on the car without opening the app and clicking the button?
or how can I change the code to call this func https://github.com/BimmerGestalt/IDriveConnectAddons/blob/main/screen_mirror/src/main/java/io/bimmergestalt/idriveconnectaddons/screenmirror/MainController.kt#L7C17-L7C17
automatically when opening the screen-mirroring menu on the car.
I tried adding code to check for the appops grant and automatically request the mirroring permission, but because it requires startActivity
it only works if AAIdrive and thus Screen Mirror are in the foreground. Otherwise, the appops grant merely removes the second click after clicking the notification.
I tried adding code to check for the appops grant and automatically request the mirroring permission, but because it requires
startActivity
it only works if AAIdrive and thus Screen Mirror are in the foreground. Otherwise, the appops grant merely removes the second click after clicking the notification.
It seems the iOS BMW app can open itself automatically when connected to the car's Bluetooth. Is there a way to open our app also?
iOS is not at all related to Android, and so iOS behavior should not be considered. Android restricts activity launches from the background except for a few exceptions. The iOS BMW behavior would be able to have similar behavior on Android by registering as a CompanionDeviceManager as of API33, but neither AAIdrive nor ScreenMirror are directly connected to the car over Bluetooth so I don't think this option is available.
I posted the branch of code for you to experiment with, I don't know enough Android internals to explore this further.
by adding permission we can start an activity from backgrand.
https://github.com/galenzhao/IDriveConnectAddons/blob/35050e969d3b8a2846c9e0eaccacb23b763d62fe/screen_mirror/src/main/AndroidManifest.xml#L12
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
https://github.com/galenzhao/IDriveConnectAddons/blob/35050e969d3b8a2846c9e0eaccacb23b763d62fe/screen_mirror/src/main/java/io/bimmergestalt/idriveconnectaddons/screenmirror/MainActivity.kt#L113-L117
val uri = Uri.parse("package:$packageName")
val intent = Intent(ACTION_MANAGE_OVERLAY_PERMISSION, uri)
startActivityForResult(intent, REQUEST_PERMISSION_CODE)
but I didn't find a perfect timeframe to call our RequestActivity