Reputation: 471
First I've added FirebaseAnalytics to my Android Unity project, and it works fine on the test. Then when I add FirebaseMessaging and build the app and send a message from my FireBase panel, The message will not show on the device/emulator and I get this error in Logcat :
E/FirebaseInstanceId: Failed to resolve target intent service, skipping classname enforcement
1722-4448/system_process W/ActivityManager: Unable to start service Intent { act=com.google.firebase.MESSAGING_EVENT pkg=pack_name (has extras) } U=0: not found
E/FirebaseInstanceId: Error while delivering the message: ServiceIntent not found.
There is a topic here that has no specific answer to the problem.
I followed FireBase walkthrough to add FirebaseMessaging.unitypackage to my project and according to that I added these lines to my manifest :
<!-- The MessagingUnityPlayerActivity is a class that extends
UnityPlayerActivity to work around a known issue when receiving
notification data payloads in the background. -->
<activity android:name="com.google.firebase.MessagingUnityPlayerActivity" android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<meta-data android:name="unityplayer.UnityActivity" android:value="true" />
</activity>
<service android:name="com.google.firebase.messaging.MessageForwardingService" android:exported="false" />
P.S:
After Adding mentioned service in @jeevashankar answer to my manifest I get this error when a notif arrived :
E/BufferQueueProducer: [SurfaceView - pack_name/com.google.firebase.MessagingUnityPlayerActivity#0] query: BufferQueue has been abandoned [SurfaceView - /com.google.firebase.MessagingUnityPlayerActivity#0] connect: BufferQueue has been abandoned E/BufferQueueProducer: [SurfaceView - pack_name/com.google.firebase.MessagingUnityPlayerActivity#0]
Update: I tested FirebaseMessaging in an empty Unity project and test it on emulator/device and it works till Android 7.1.1. But in Android 8 (API 26) and above makes this error and message will not be received :
system_process E/NotificationService: No Channel found for pkg=, channelId=null, id=0, tag=campaign_collapse_key_4015583716848879920, opPkg=, callingUid=10122, userId=0, incomingUserId=0, notificationUid=10122, notification=Notification(channel=null pri=0 contentView=null vibrate=null sound=null defaults=0x0 flags=0x10 color=0x00000000 vis=PRIVATE)
Upvotes: 2
Views: 7190
Reputation: 10232
I had the same problem:
E/FirebaseInstanceId: Error while delivering the message: ServiceIntent not found
After some time, I found the solution by making the service exported in the manifest
<service
android:name=".MyMessagingService"
android:exported="true"
tools:ignore="ExportedService" >
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
</service>
Upvotes: 3
Reputation: 471
I found the answer. You need to import Analytics & Messaging plugins without PlayServiceResolver folder in them. Then download the last unity-jar-resolver unity package from GitHub and import it to your Unity project. After that just hit the Force Resolve button and get a successful operation message.
Upvotes: 0
Reputation: 1498
Check this link and add intent-filter with MESSAGING_EVENT action inside the Service in Android Manifest file.
<service android:name=".app.FireMsgService">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
</service>
FireMsgService class extends the FirebaseMessagingService class & inside the onMessageReceived method you will get notification messages .
public class FireMsgService extends FirebaseMessagingService {
@Override
public void onMessageReceived(RemoteMessage remoteMessage) {
super.onMessageReceived(remoteMessage);
Log.v("Firebase MSG", ""+remoteMessage.getNotification().toString());
}
}
Upvotes: 1