click_action throwing exception in firebase push notification

ArvindrajaArvindraja INMember ✭✭✭

Hi,
I am developing FCM notification in android app. It is working fine except click_action attribute.
after passing click_action:"MainActivity" it is throwing exception

Java.Lang.RuntimeException: Unable to instantiate activity com.app.MainActivity: java.lang.ClassNotFoundException: Didn't find class "com.app.MyFirebaseMessagingService" on path: DexPathList[[zip file "/data/app/com.app-1/base.apk"],nativeLibraryDirectories=[/data/app/com.sisapp-1/lib/arm, /system/fake-libs, /data/app/com.app-1/base.apk!/lib/armeabi-v7a, /system/lib, /vendor/lib, /system/vendor/lib]]

My FCM data passing using Postman
{
"to": "dyYIJYveIfg:APA91bFGmzhdq3RxOEGlLIW_0cVWKE2q6XZ8SRpDWBeLxPrKaaOh9t0E2xnILIfbIiWHfuAexjjdYuv0HgzCC7wi2MKuie7IPv54NJpxzQBXPwMSMYmTlmoKql5s",

 "notification" : {
 "body" : "great match!",
 "click_action": "MainActivity",
 "content_available" : true,
 "priority" : "high",
 "title" : "Portugal vs. Denmark"
 },
 "data" : {
 "body" : "great match!",
 "content_available" : true,
 "priority" : "high",
 "title" : "Portugal vs. Denmark"
 }
}

Menifest File

    <activity android:name=".MainActivity">
      <intent-filter>
        <action android:name= "MainActivity" />
        <category android:name="android.intent.category.DEFAULT" />
      </intent-filter>
    </activity>

C# code to handle notifications

            public override void OnMessageReceived(RemoteMessage message)
                 {
                     if ((message.Data != null))
                     {
                         var data = message.Data.ToDictionary(i => i.Key, i => i.Value);
                         SendNotification("body", message.GetNotification().ClickAction);
                     }
                     if (message.GetNotification() != null)
                     {
                        SendNotification("this is body", message.GetNotification().ClickAction);

                     }
                 }

Thank you where i am making mistake please let me know

Best Answer

Answers

Sign In or Register to comment.