Search code examples
androidgoogle-cloud-messagingfirebase-cloud-messagingandroid-permissionswakelock

Does Firebase Cloud Messaging really need a WAKE LOCK permission?


I notice FCM needs an Android wake lock permission. Could I remove the wake lock permission using?

<uses-permission android:name="android.permission.WAKE_LOCK" tools:node="remove" />

or will it disrupt receiving the data/notification payload?

I was reviewing this topic and started wondering if its needed. I remember in GCM its mandatory.

The other question I have is since wake lock is not a dangerous permission, I think on and after API 23, users won't even see or know about this permission as it will be transparent. Even the Play Store will not show them that the app needs a wake lock, is that right?


Solution

  • Referring to the GCM docs, the WAKE_LOCK permission seems to have been only optional and not mandatory:

    Optionally, the android.permission.WAKE_LOCK permission if the application needs to keep the processor from sleeping when a message is received.

    And nothing is stated in the FCM docs that WAKE_LOCK is needed in some way.

    And yes, the app will not show that it needs WAKE_LOCK. For permissions with Normal Protection levels (docs):

    If an app declares that it needs a normal permission, the system automatically grants the permission to the app.