Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Permissions for Firebase Analytics and Crash

I used

//Analytics
compile 'com.google.firebase:firebase-core:9.2.1'
// Crash
compile 'com.google.firebase:firebase-crash:9.2.1'

and obtained those guys in my generated manifest:

<!-- Required permission for App measurement to run. -->
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<!-- Optional permission for App measurement to run. -->
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />

Then we have the following block

<permission
    android:name="my.package.name.permission.C2D_MESSAGE"
    android:protectionLevel="signature" />
<uses-permission android:name="my.package.name.permission.C2D_MESSAGE" />

My questions:

If I use only Firebase Analytics and Crash and don't need any messaging functional, is it Ok to remove the second block as follows:

<uses-permission android:name="my.package.name.permission.C2D_MESSAGE" tools:node="remove" />

What does it mean "Optional permission for App measurement to run" in the first block? Is it safe to remove that too?

like image 728
user35603 Avatar asked Jul 23 '16 09:07

user35603


People also ask

How do I stop Firebase from crashing?

To mark a cluster as closed, click the three dots on the far right of the row that appear when hovering over the row, then click "close cluster."

How do I give permission to Firebase?

Sign in to Firebase. Click. , then select Permissions. On the Permissions page, click Add member.

How do I turn off Firebase Analytics?

If you need to deactivate Analytics collection permanently in a version of your app, set FIREBASE_ANALYTICS_COLLECTION_DEACTIVATED to YES (Boolean) in your app's Info.

How do I know if Firebase is crashing?

Open your app from the home screen of your test device or simulator. In your app, press the "Test Crash" button that you added using the code above. After your app crashes, run it again from Xcode so that your app can send the crash report to Firebase.


2 Answers

Yes , you can remove both of them and they're not necessary. Also in google sample none these two permissions granted.

According to documentation:

Firebase Analytics helps you understand how people use your iOS or Android app. The SDK automatically captures a number of events and user properties and also allows you to define your own custom events to measure the things that uniquely matter to your business. Once the data is captured, it's available in a dashboard through the Firebase console. This dashboard provides detailed insights about your data — from summary data such as active users and demographics, to more detailed data such as identifying your most purchased items.

Also seeing this video maybe give you better idea about measurement.

like image 23
Amir Avatar answered Nov 05 '22 07:11

Amir


Firebase Analytics uses FirebaseInstanceId. This can be seen by running the dependencies task in the Android Studio tool window for Gradle. This portion of the output shows the dependency on FirebaseInstanceId :

+--- com.google.firebase:firebase-core:9.2.1
|    \--- com.google.firebase:firebase-analytics:9.2.1
|         +--- com.google.android.gms:play-services-basement:9.2.1
|         |    \--- com.android.support:support-v4:24.1.0
|         |         \--- LOCAL: internal_impl-24.1.0.jar
|         +--- com.google.firebase:firebase-common:9.2.1
|         |    +--- com.google.android.gms:play-services-basement:9.2.1
|         |    |    \--- com.android.support:support-v4:24.1.0
|         |    |         \--- LOCAL: internal_impl-24.1.0.jar
|         |    \--- com.google.android.gms:play-services-tasks:9.2.1
|         |         \--- com.google.android.gms:play-services-basement:9.2.1
|         |              \--- com.android.support:support-v4:24.1.0
|         |                   \--- LOCAL: internal_impl-24.1.0.jar
|         \--- com.google.firebase:firebase-analytics-impl:9.2.1
|              +--- com.google.android.gms:play-services-basement:9.2.1
|              |    \--- com.android.support:support-v4:24.1.0
|              |         \--- LOCAL: internal_impl-24.1.0.jar
|              +--- com.google.firebase:firebase-iid:9.2.1  <== FirebaseInstanceId
|              |    +--- com.google.android.gms:play-services-basement:9.2.1
|              |    |    \--- com.android.support:support-v4:24.1.0
|              |    |         \--- LOCAL: internal_impl-24.1.0.jar
|              |    \--- com.google.firebase:firebase-common:9.2.1
|              |         +--- com.google.android.gms:play-services-basement:9.2.1
|              |         |    \--- com.android.support:support-v4:24.1.0
|              |         |         \--- LOCAL: internal_impl-24.1.0.jar
|              |         \--- com.google.android.gms:play-services-tasks:9.2.1
|              |              \--- com.google.android.gms:play-services-basement:9.2.1
|              |                   \--- com.android.support:support-v4:24.1.0
|              |                        \--- LOCAL: internal_impl-24.1.0.jar
|              \--- com.google.firebase:firebase-common:9.2.1
|                   +--- com.google.android.gms:play-services-basement:9.2.1
|                   |    \--- com.android.support:support-v4:24.1.0
|                   |         \--- LOCAL: internal_impl-24.1.0.jar
|                   \--- com.google.android.gms:play-services-tasks:9.2.1
|                        \--- com.google.android.gms:play-services-basement:9.2.1
|                             \--- com.android.support:support-v4:24.1.0
|                                  \--- LOCAL: internal_impl-24.1.0.jar

The C2D_MESSAGE permission comes from the manifest associated with the firebase-iid library. My guess is that without it, FirebaseAnalytics would not be able to obtain a unique ID for the device and would be unable to report data.

Regarding the WAKE_LOCK permission, see this related answer.

I doubt it is safe to remove any of the permissions. You could find out by running without them and seeing if analytics reports any events.

like image 69
Bob Snyder Avatar answered Nov 05 '22 07:11

Bob Snyder