3

In my Android application in manifest file i have following receiver and service declaration:

<receiver
   android:name="com.google.android.gms.analytics.AnalyticsReceiver"
   android:enabled="true">
   <intent-filter>
      <action android:name="com.google.android.gms.analytics.ANALYTICS_DISPATCH" />
   </intent-filter>
</receiver>
<service
   android:name="com.google.android.gms.analytics.AnalyticsService"
   android:enabled="true"
   android:exported="false" />

To be honest it's quite old app and I don't remember why I've put that there. It was probably taken from Google Analytics docs. But now I can't find any up-to-date information about it.

What is more Android Studio shows me warning with that receiver:

Receiver does not require permission

Exported receivers (receivers which either set exported=true or contain an intent-filter and do not specify exported=false) should define a permission that an entity must have in order to launch the receiver or bind to it. Without this, any application can use this receiver.

Do I really need that receiver and service in my code? What is this responsible for? Is it still actual?

michalsol
  • 752
  • 8
  • 29

1 Answers1

2

If you are using the latest version of Google Analytics, no, you do not need to manually specify the service and receiver in your manifest file.

Here is the Google Analytics getting start guide for Android. Note that if you are upgrading from a significantly older version, you may have additional work to perform elsewhere to upgrade. You should read through the entire guide to ensure that your app is still configured properly.

Bryan Herbst
  • 66,602
  • 10
  • 133
  • 120
  • OK, thanks! I also looked at that page and didn't find anything related to those receiver and service so I thought it can be outdated. Thanks for confirmation! – michalsol Aug 18 '16 at 15:01
  • This issue still remains. The Getting Started guide links to a page that specifies the config the posted in this question. It seems this config is used as a fallback for dispatching on non-Google Play devices. – JPM Apr 27 '17 at 22:53
  • As a follow up, adding tools:ignore="ExportedReceiver" to the receiver will remove the warning if Lint is becoming problematic for you. – JPM Apr 27 '17 at 22:58