Leanplum/Leanplum-Android-SDK

FCM Push ListenerService and Receiver shouldn't be in the SDK's AndroidManifest.xml

tinsukE opened this issue · 0 comments

Since the docs state that one should subclass LeanplumPushFirebaseMessagingService and LeanplumPushFcmListenerService and add the subclasses in the App's AndroidManifest.xml, those classes shouldn't be present in the SDK's AndroidManifest.xml.

If the App developer follows this subclass approach they'll end up with both MyAppPushFirebaseMessagingService and LeanplumPushFirebaseMessagingService in the final, APK's AndroidManifest.xml.

The manifest merger makes it so that the App's one appears above Leanplum's one. And Android's IntentResolver ranks them all by priority (in this case, the App's and Leanplum's would have the same, default one) and picks the first, which, in a way that isn't guaranteed not to change in a future Android version, ends up being the App's one.

One can solve that by adding to their own AndroidManifest.xml:
<service android:name="com.leanplum.LeanplumPushFirebaseMessagingService" tools:node="remove" />

An this works, but makes Leanplum complain, logging:
E/[ERROR][Leanplum]: [com.leanplum.internal.LeanplumManifestHelper::checkComponent::252]: Push notifications requires you to add the service com.leanplum.LeanplumPushFirebaseMessagingService to your AndroidManifest.xml file.Add this code within the <application> section: ...

The same can be said about LeanplumPushFcmListenerService.

Specifications

  • Version: 4.2.3
  • Platform: Android
  • Subsystem: AndroidSDKFcm