Anna Blanca 0 Posted 19 hours ago 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 571 Posted 19 hours ago 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 18 hours ago (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 18 hours ago by Anna Blanca Share this post Link to post
Dave Nottage 571 Posted 18 hours ago 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 18 hours ago 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 9 hours ago (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 9 hours ago by Rollo62 Share this post Link to post