I have written an application that takes advantage of system_alert_window on android wear. Since marshmallow this permission is revoked by default. I have enabled this permission on the phone side app from the phone settings. But the permission is still denied on the android wear side app and causes the android wear side app to crash with permission denied exception. Is there a way to enable this permission on Android wear side?
相关问题
- Django check user group permissions
- SQL Server 2012- Create Database permission denied
- PostgreSQL + Rails: is it possible to have a write
- Python Permission Error when reading
- How to ask for location permission in Android Stud
相关文章
- Flutter - http.get fails on macos build target: Co
- unable to access '/Users/dida/.config/git/attr
- BroadcastReceiver permission for adb shell
- Android 6 revoked permissions checked as granted
- Permission Denial: broadcasting Intent android.pro
- AWS EC2 tomcat permission denied creating/writing
- NFC Android wear (Huawei watch 2.0)
- Launch application with less permissions than “Run
You should dynamically request the permissions from user on wearable devices just the same way you do on the phone side. Checkout the official tutorial Requesting Permissions on Android Wear
Short answer: keep your watch app on targetSdkVersion 22.
Long answer: this permission doesn't use the usual requestPermissions() flow. There's more info in the docs, but it boils down to a special Settings UI for the user to enable this permission - and it doesn't appear that Google has implemented that UI on Wear. Without it, no (non-system) app can be granted this permission, and any app which tries to use it will crash on an error like the following:
But, this restriction only applies to apps targeting SDK level 23 (and above). So keep your app on 22 for the time being, and hopefully Google will fill this gap before you need to increment it.
UPDATE 22-Dec-2016: This issue is fixed on Android Wear 2.0. There's still no better solution than the above for Wear 1.x, but Google has implemented the permission UI for Wear 2, and when that's released watch apps should be able to link to it with the standard intent: