6

So i just added Google Analytics to my app's activities. When uploading the new .apk to the play store, it told me that the app now requires 1 more Permission: WAKE_LOCK.

Now I'm 100% sure that this permission is not in my manifest, so it has to be added by Google Analytics. Is there a way to disable that? Or would that ruin google analytics?

Thanks in advance!

The_Vinci
  • 65
  • 1
  • 7
  • did you added this permission to your manifest file. – curiousMind Nov 23 '15 at 13:13
  • i did not, and I'd prefer not to use the permission, even if it makes google analytics less reliable. The thing is: the permission is still being added to my apks, and I wonder how to disable that? – The_Vinci Nov 23 '15 at 13:16

3 Answers3

10

Try using the "tools" namespace and then explicitly removing the "WAKE_LOCK" permission. I've written up a full explanation here but, in summary:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:tools="http://schemas.android.com/tools">

    ...
    ...
    <uses-permission android:name="android.permission.WAKE_LOCK" tools:node="remove" />
Community
  • 1
  • 1
Ian
  • 7,480
  • 2
  • 47
  • 51
4

On Google Play devices, a background service is almost always running as "Google Play Services", so WAKE_LOCK is not required.

On non-Google Play devices, WAKE_LOCK helps keeping the dispatching process / service of Google Analytics alive so it has more chances to report / upload data.

Community
  • 1
  • 1
Luca Ziegler
  • 3,236
  • 1
  • 22
  • 39
1

Yeah android.permission.WAKE_LOCK is most definitely being added by Google. They did the same thing with the Fit API adding GPS a while back. LAME

astryk
  • 1,256
  • 13
  • 20