[AC-5216] Ti.Android.requestPermissions callback not firing when first requesting permissions
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | n/a |
Status | Closed |
Resolution | Needs more info |
Resolution Date | 2017-10-25T22:50:00.000+0000 |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | Titanium SDK & CLI |
Labels | n/a |
Reporter | eric harms |
Assignee | Yordan Banev |
Created | 2017-09-20T22:00:38.000+0000 |
Updated | 2018-07-18T07:34:55.000+0000 |
Description
Hi,
Having a strange issue requesting permissions with Android. Running the following code on first run will not show the SUCCESS log, the callback does not fire. But once the permissions are set and the app is closed and re-opened, the code runs as expected.
var permissions = ['android.permission.CAMERA', 'android.permission.READ_EXTERNAL_STORAGE'];
Ti.Android.requestPermissions(permissions, function(e) {
if (e.success) {
Ti.API.info("SUCCESS");
} else {
Ti.API.info("ERROR: " + e.error);
}
});
This is right out of the documentation here
http://docs.appcelerator.com/platform/latest/#!/api/Titanium.Android
Please advise if I am doing something wrong here.
Thanks
Make sure you have:
in your tiapp.xml file. I was not able to reproduce the issue on any version from 6.0.1.GA to 6.2.0.GA on Android 7 device, having these lines added.
Hello [~eric.harms@gmail.com], did you tried [~ybanev], guide?
Hi @Sharif AbuDarda and @Yordan Banev, I'm facing a similar problem. When I'm trying to requestCalendarPermissions and the user on Android haven't given the permission, the callback is not being fired. Steps: a. The user doesn't have allowed the access to the calendar for the app. (i.e., calendar permission); b. The Calendar Permission is requested through the Ti.Calendar.requestCalendarPermission(callback); c. The user accepts or denies the permission. d. The event callback is not fired to inform if the user has accepted or not. :(
Please ignore my previous comment. I found the bug, was something related to the showing a window (like a dialog) before requesting the permissions, so the request dialog was not being fired.