Watch, Follow, &
Connect with Us

Welcome, Guest
Guest Settings
Help

Thread: How to remove GET_ACCOUNTS permission in my FMX Android app


This question is answered. Helpful answers available: 1. Correct answers available: 1.


Permlink Replies: 9 - Last Post: Apr 11, 2017 12:58 PM Last Post By: Dave Nottage
Robert [NL] Mit...

Posts: 78
Registered: 5/23/04
How to remove GET_ACCOUNTS permission in my FMX Android app  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Apr 6, 2017 3:44 AM
Hi,
Using Delph 10.2 Berlin Update 2, Multi Device project (FMX)

In Project - Options - Uses Permissions (Release configuration - Android Platform) I set "Get accounts" and "Wake lock" to false.
Still after building my app for Android, in the Android/Release/AndroidManifest.xml, I find:

<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.WAKE_LOCK" />

How can I get rid of these permissions, especially GET_ACCOUNTS? Why is it aded automatically (it is not in my manifest template).

Note: I use "Receive push notifications" in Project - Options - Entitlement List, but afaik GET_ACCOUNT is not needed for receiving push notifications in android since sdk 4.04.

Thanks.
Dave Nottage

Posts: 1,450
Registered: 1/7/00
Re: How to remove GET_ACCOUNTS permission in my FMX Android app  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Apr 6, 2017 4:58 AM   in response to: Robert [NL] Mit... in response to: Robert [NL] Mit...
Robert [NL] Mittendorff wrote:

In Project - Options - Uses Permissions (Release configuration - Android Platform) I set "Get accounts" and "Wake
lock" to false. Still after building my app for Android, in the Android/Release/AndroidManifest.xml, I find:

<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.WAKE_LOCK" />

When I start a new app, they're both false, by default. Just out of curiosity: What are they set to in All
Configurations, and Debug Configuration?

--
Dave Nottage [MVP, TeamB]
Hints, tips and tricks at: http://www.delphiworlds.com/blog
Robert [NL] Mit...

Posts: 78
Registered: 5/23/04
Re: How to remove GET_ACCOUNTS permission in my FMX Android app  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Apr 6, 2017 5:52 AM   in response to: Dave Nottage in response to: Dave Nottage
Dave Nottage wrote:
Robert [NL] Mittendorff wrote:

In Project - Options - Uses Permissions (Release configuration - Android Platform) I set "Get accounts" and "Wake
lock" to false. Still after building my app for Android, in the Android/Release/AndroidManifest.xml, I find:

<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.WAKE_LOCK" />

When I start a new app, they're both false, by default. Just out of curiosity: What are they set to in All
Configurations, and Debug Configuration?

Both in All Configuration and Debug Configuration they are also set to false.

But now I started a new blank multi device project. As you said "Get accounts" appears to be false by default and after building my blank project I will not found "android.permission.GET_ACCOUNTS" in the generated manifest.
Now i check "Receive push notifications" to true in Project-Options-Entitlement List. "Get accounts" in Options-User Permissions is still false, but now after rebuild, GET_ACCOUNTS (and WAKE_LOCK) is added in the manifest.
So now I know what causes GET_ACCOUNTS to get added.
But actually I do not want this, since I understand it is not required for receiving push notifications using Google/Firebase Cloud Messaging, and users may be concerned why my app will require GET_ACCOUNTS permission.

BTW I changed minSdkVersion and targetSdkVersion to 16 in the manifest template (hardcoded; can this been done in de IDE?), but GET_ACCOUNT is still automatically added.

So why is Delphi always adding GET_ACCOUNTS permission if "Receive push notification" entitlement is true?
Dave Nottage

Posts: 1,450
Registered: 1/7/00
Re: How to remove GET_ACCOUNTS permission in my FMX Android app  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Apr 6, 2017 6:28 AM   in response to: Robert [NL] Mit... in response to: Robert [NL] Mit...
Robert [NL] Mittendorff wrote:

But actually I do not want this, since I understand it is not required for receiving push notifications using
Google/Firebase Cloud Messaging, and users may be concerned why my app will require GET_ACCOUNTS permission.

BTW I changed minSdkVersion and targetSdkVersion to 16 in the manifest template (hardcoded; can this been done in de
IDE?)

No, it can't be done in the IDE, but why are you changing it?

but GET_ACCOUNT is still automatically added.

So why is Delphi always adding GET_ACCOUNTS permission if "Receive push notification" entitlement is true?

This does not happen for me, in either of Delphi 10.1 Berlin, or 10.2 Tokyo, so I'm at a loss as to why

--
Dave Nottage [MVP, TeamB]
Hints, tips and tricks at: http://www.delphiworlds.com/blog
Robert [NL] Mit...

Posts: 78
Registered: 5/23/04
Re: How to remove GET_ACCOUNTS permission in my FMX Android app  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Apr 6, 2017 7:04 AM   in response to: Dave Nottage in response to: Dave Nottage
Dave Nottage wrote:
Robert [NL] Mittendorff wrote:

BTW I changed minSdkVersion and targetSdkVersion to 16 in the manifest template (hardcoded; can this been done in de
IDE?)

No, it can't be done in the IDE, but why are you changing it?

Since it defaults to sdk 14, and I wanted to be sure that this is not the reason why GET_ACCOUNT permission is implicitly added by Delphi (as far as I know GET_ACCOUNT is required for GCM/FCM until sdk 15, but not for sdk 16 and up)


This does not happen for me, in either of Delphi 10.1 Berlin, or 10.2 Tokyo, so I'm at a loss as to why

I intentionally started a new fresh blank project, to be sure no other settings changed in the past could be effective. Very strange it can not be reproduced by you. Are you sure you are looking in the generated manifest in the android/release directory and not in the manifest template in the project root directory?

--
Dave Nottage [MVP, TeamB]
Hints, tips and tricks at: http://www.delphiworlds.com/blog
Dave Nottage

Posts: 1,450
Registered: 1/7/00
Re: How to remove GET_ACCOUNTS permission in my FMX Android app
Helpful
Click to report abuse...   Click to reply to this thread Reply
  Posted: Apr 6, 2017 2:08 PM   in response to: Robert [NL] Mit... in response to: Robert [NL] Mit...
Robert [NL] Mittendorff wrote:

Are you sure you are looking in the generated manifest in the android/release directory and not in the manifest
template in the project root directory?

Sorry, yes: it is adding those two permissions to the resulting manifest. You should report it as a bug, here:

https://quality.embarcadero.com

Does it affect the resulting application at all?

--
Dave Nottage [MVP, TeamB]
Hints, tips and tricks at: http://www.delphiworlds.com/blog
Robert [NL] Mit...

Posts: 78
Registered: 5/23/04
Re: How to remove GET_ACCOUNTS permission in my FMX Android app  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Apr 11, 2017 3:04 AM   in response to: Dave Nottage in response to: Dave Nottage
{quote:title=Dave Nottage wrote:}
Sorry, yes: it is adding those two permissions to the resulting manifest. You should report it as a bug, here:

https://quality.embarcadero.com

I added [RSP-17799|https://quality.embarcadero.com/browse/RSP-17799] for this.


Does it affect the resulting application at all?

My app works fine with or without GET_ACCOUNTS permission (I supplied an alternative manifest without GET_ACCOUNT permission thru the deployment list), in both ways I can receive remote notification from FCM on my Android 6.0 device.
But since GET_ACCOUNTS is considered a dangerous permission, one should not request it if it is not needed.
Dave Nottage

Posts: 1,450
Registered: 1/7/00
Re: How to remove GET_ACCOUNTS permission in my FMX Android app  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Apr 11, 2017 4:45 AM   in response to: Robert [NL] Mit... in response to: Robert [NL] Mit...
Robert [NL] Mittendorff wrote:

But since GET_ACCOUNTS is considered a dangerous permission, one should not request it if it is not needed.

That would apply only if you manually set the targetSdkVersion value in the manifest to 23 or higher. At present, doing
so is not officially supported with Delphi. There are ways around this, but it is not pretty.

--
Dave Nottage [MVP, TeamB]
Hints, tips and tricks at: http://www.delphiworlds.com/blog
Robert [NL] Mit...

Posts: 78
Registered: 5/23/04
Re: How to remove GET_ACCOUNTS permission in my FMX Android app  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Apr 11, 2017 5:06 AM   in response to: Dave Nottage in response to: Dave Nottage
Dave Nottage wrote:
Robert [NL] Mittendorff wrote:

But since GET_ACCOUNTS is considered a dangerous permission, one should not request it if it is not needed.

That would apply only if you manually set the targetSdkVersion value in the manifest to 23 or higher. At present, doing
so is not officially supported with Delphi. There are ways around this, but it is not pretty.

Well, it is probably potayto-potahto, but afaik Android always considers it as dangerous, but from android 6.0 and targetSdkVersion 23+ the app will requests permissions from the user at run-time, not at installation.
Dave Nottage

Posts: 1,450
Registered: 1/7/00
Re: How to remove GET_ACCOUNTS permission in my FMX Android app  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Apr 11, 2017 12:58 PM   in response to: Robert [NL] Mit... in response to: Robert [NL] Mit...
Robert [NL] Mittendorff wrote:

Well, it is probably potayto-potahto, but afaik Android always considers it as dangerous, but from android 6.0 and
targetSdkVersion 23+ the app will requests permissions from the user at run-time, not at installation.

It's not "potayto-potahto": if you specify a targetSdkVersion lower than 23, the app does not require requesting
permissions at runtime, regardless of whether it's on a device of Android 6.0 or greater.

--
Dave Nottage [MVP, TeamB]
Hints, tips and tricks at: http://www.delphiworlds.com/blog
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02