Anna Blanca 0 Posted January 9 Hi. I'm trying getting permission from Android in my app, i'm using standart code for this: procedure TForm1.GetPermission; begin if not PermissionsService.IsPermissionGranted(JStringToString(TJManifest_permission.JavaClass.VIBRATE)) then PermissionsService.RequestPermissions([JStringToString(TJManifest_permission.JavaClass.VIBRATE)], procedure(const APermissions: TClassicStringDynArray; const AGrantResults: TClassicPermissionStatusDynArray) begin if (Length(AGrantResults) = 1) and (AGrantResults[0] = TPermissionStatus.Granted) then ShowMessage('Access granted') else ShowMessage('Access denied'); end); end; But that not works. My app not asking permission on the launch this code, it just sending message 'Access denied'. What's wrong and how fix it? Also, when i'm using this code for getting permission WRITE_EXTERNAL_STORAGE, all working right. Share this post Link to post
Dave Nottage 575 Posted January 9 Just now, Anna Blanca said: Hi. I'm trying getting permission from Android in my app, i'm using standart code for this: You do not need to request the VIBRATE permission at runtime. Just enable it in the Uses Permissions section of the Project Options. Share this post Link to post
Anna Blanca 0 Posted January 9 (edited) 20 minutes ago, Dave Nottage said: Just enable it in the Uses Permissions section of the Project Options. When i making it, my app not asking permission. It's just silent and dead. Edited January 9 by Anna Blanca Share this post Link to post
Dave Nottage 575 Posted January 9 Just now, Anna Blanca said: When i making it, my app not asking permission When making what? As I said, you do not need to request permission at runtime, just execute the code that does the vibration. If that code is not working, please show your code. Share this post Link to post
Anna Blanca 0 Posted January 9 17 minutes ago, Dave Nottage said: When making what? As I said, you do not need to request permission at runtime, just execute the code that does the vibration. If that code is not working, please show your code. Oh, thank you, vibrations working. But why application not asking permission for vibrate from user? Usually, when you not pushed button for get access, app cant't working.... Share this post Link to post
Rollo62 542 Posted January 10 (edited) Yes, that is strange. I never tried to get a runtime permission for a "normal" permission, but I had expected that the IsPermissionGrant would also work in same way. Since it is not explicitely forbidden anywhere in the docs, at least I find no rule for that, maybe the best place to logically derive this from is here: https://source.android.com/docs/core/permissions/runtime_perms?hl=en It states more or less, that the runtime expressios are intended for >= dangerous permissions, from this we could logically deduct that "normal" permissions doesn't need (or better doesn't allow) such requests. Negative logic is sometimes confusing ... Edited January 10 by Rollo62 Share this post Link to post
Dave Nottage 575 Posted January 10 22 hours ago, Anna Blanca said: But why application not asking permission for vibrate from user? Usually, when you not pushed button for get access, app cant't working.... That's only for "dangerous" permissions. It would help to read the entire page I linked to, so you know the difference. Share this post Link to post