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?
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."
Sign in to Firebase. Click. , then select Permissions. On the Permissions page, click Add member.
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.
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.
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With