Requesting permissions on Android wear - permissions

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?

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:
android.view.WindowManager$BadTokenException: Unable to add window android.view.ViewRootImpl$W#a597673 -- permission denied for this window type
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:
startActivity(new Intent(Settings.ACTION_MANAGE_OVERLAY_PERMISSION,
Uri.parse("package:" + getPackageName())));

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

Related

android.permission.CAMERA error when publishing app on play store

When publishing my app (using react native expo) on play store I got this error
APK or Android App Bundle must use authorizations that require a privacy policy: (android.permission.CAMERA).
But.... nothing that I have on my app requires camera!
if you read the message carefully you will see that you are using the permissions like camera and you don't supply a privacy policy. you need to supply a privacy policy if you do that. you can find more information about android privacy policy on google, for example here's the first link that came up in my search: https://www.iubenda.com/blog/privacy-policy-for-android-app/

AppStore Connect - Is IDFA gone?

I'm uploading a new build of my iOS app and as always, I was going to check the IDFA options but I can't find them anywhere! Did something change?
It seems after requirement that apps use IDFA must ask users permission, Apple doesn't ask developers to select whether app use IDFA in App Store connect anymore.
So just submit app and don't care about it. I have submited an app successfully.

How Expo(React Native) can access gallery and external storage without CAMERA_ROLL permission?

I have a terrible question..
I hope there is anyone who know this problem..
In EXPO App which is a wrapper API for React Native,
How can Expo Image picker example app can access Gallery(external storage) without requesting any external storage access permission to user???
original source code is here..
https://docs.expo.io/versions/latest/sdk/imagepicker/
I tried with removing any askAsync(CAMERA_ROLL.permission) or getAsync(CAMERA_ROLL.permission).
So the example app has no permission about accessing external storage...
BUT!! I press the button, It access the Gallery....
How can it be possible??
I double check permission on the app, but there is no granted permission to external storage...
Please let me know...
I think it is the appropriate thing which firstly asked permission, then access the external storage..
P.S I tested it with android phone only.
i have never checked permissions..
To stop expo app from having this permission, do the following:
Remove all reference to the permission requests (That you already did)
Remove the Image launcher (but it seems you don't want to do that)
Clear the expo application permission of media access
Step 3 is what you are looking for, to clear application settings go to your phones settings -> application management -> select expo app -> permissions and clear the gallery/media permission.
Now when you run the application again you will not be able to access the gallery even if you press the button as you mentioned and if you include the getAsync to request for permission you will be prompt with asking for permission.
EDIT:
To explicitly set permissions for stand alone applications modify your app.json file and add the "permissions" parameter under the android configurations there, by default expo uses all permissions of your device. specify there the permissions you want your application to have.
Please refer to this link for further details on how to configure your app.json file.
Hope this helps!

How do I request permissions during installation / before app starts for a React Native app?

I would like for the user to grant permissions during installation /before the app begins, rather than being prompted while the app is running. Currently, I'm requesting Coarse Location and Microphone access on the Android version of my app and BLE and Microphone access on the IOS version of the app.
That's not possible to do, according to the Android documentations, you can ask for permissions at the installation time only if the android version is less than Marshmallow (i.e. < SDK 23). If the android version is marshmallow or greater then permissions will be asked at the run time, you can't change it.
If the device is running Android 6.0 (API level 23) or higher, and the
app's targetSdkVersion is 23 or higher, the app requests permissions
from the user at run-time. The user can revoke the permissions at any
time, so the app needs to check whether it has the permissions every
time it accesses permission-protected APIs. For more information about
requesting permissions in your app, see the Working with System
Permissions training guide.
If the device is running Android 5.1.1 (API level 22) or lower, or the
app's targetSdkVersion is 22 or lower, the system asks the user to
grant the permissions when the user installs the app. If you add a new
permission to an updated version of the app, the system asks the user
to grant that permission when the user updates the app. Once the user
installs the app, the only way they can revoke the permission is by
uninstalling the app.
https://developer.android.com/guide/topics/permissions/requesting.html
And for iOS too, permissions are asked at the runtime, that's like that since iOS 9. I am not sure about what the flow was before iOS 9.

Facebook messenger heads popup

In my application I'm trying to implement a popup which will be overlay on other applications. I did it by adding this permission SYSTEM_ALERT_WINDOW in the manifest. It works fine, but on Android 6 I know that I need to request on runtime a permission to "Draw over other apps".
I entered to this settings in my phone and saw that Facebook, Messenger, Skyoe and other apps are allowed to draw over other apps without asking this permission during the installation process (on android 6) and was wondering how can I do that? is targeting to sdk version below 22 will solved this? if so, is there another solution instead of targeting to a lower sdk version?
for example, I uninstalled the facebook messenger application, and install it again, just opened it without completing the registration process, then I opened the settings and clicked on "Draw over other apps" and it was automatically set to "Yes" means that the messneger app can draw over other applications.