Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Messaging Activity not launching from Notifications #31

Open
Sakpal opened this issue Jan 3, 2019 · 9 comments
Open

Messaging Activity not launching from Notifications #31

Sakpal opened this issue Jan 3, 2019 · 9 comments

Comments

@Sakpal
Copy link

Sakpal commented Jan 3, 2019

When app is in killed state and user receives a chat, a notification is shown. When tapped on that notification, nothing happens...

Tried it on Android 7.0 and 8.1

One observation is that if the app is in foreground and you get a message notification, kill the app and now tap on the notification. It works.

@Sakpal
Copy link
Author

Sakpal commented Jan 16, 2019

Seems like the issue was with incorrect click_action setting. This fixes the app launching but crashes on the launch.

Attached crashlog
screen shot 2019-01-16 at 9 30 14 pm

@andrealeo83
Copy link
Contributor

try to update your chat21-cloud-function code. https://github.com/chat21/chat21-cloud-functions

@Sakpal
Copy link
Author

Sakpal commented Jan 16, 2019

Hi @andrealeo83 ,

Will give it a try and update you.

@nakul-kabra
Copy link

Facing the same issue. Tried updating cloud function, still it did not help. What exactly to fix in Cloud Functions?

@andrealeo83
Copy link
Contributor

Cloud Functions now send different Click_action for each devices (ios, android, ionic):
This is the code:
https://github.com/chat21/chat21-cloud-functions/blob/master/functions/push-notification.js

   var clickAction = "NEW_MESSAGE";
        var icon = "ic_notification_small";
        if (platform=="ionic"){
            clickAction = "https://support.tiledesk.com/chat/";
            icon = "/chat/assets/img/icon.png"
        }

@PlutusM
Copy link

PlutusM commented Jul 28, 2019

Any Solution, Facing same problem. i have setup Ionic web and android app sdk.

When i try to chat from ionic web to android. i am getting notification in android but when i try to open it nothing happening.

Here is logs i receive when i tap to notification :

2019-07-28 15:54:48.075 1818-1818/com.testing.app E/FirebaseMessaging: Notification pending intent canceled
2019-07-28 15:54:48.080 13718-16824/? W/audio_hw_generic: Not supplying enough data to HAL, expected position 30537465 , only wrote 30535920
2019-07-28 15:54:48.097 1818-1818/com.testing.app W/FirebaseMessaging: Error while parsing timestamp in GCM event
java.lang.NumberFormatException: s == null
at java.lang.Integer.parseInt(Integer.java:577)
at java.lang.Integer.parseInt(Integer.java:650)
at com.google.firebase.messaging.zzb.zzb(Unknown Source:81)
at com.google.firebase.messaging.zzb.zzd(Unknown Source:116)
at com.google.firebase.messaging.FirebaseMessagingService.zzc(Unknown Source:44)
at com.google.firebase.iid.zzf.zza(Unknown Source:30)
at com.google.firebase.iid.zzh.zzc(Unknown Source:77)
at com.google.firebase.iid.zzh.zza(Unknown Source:29)
at com.google.firebase.iid.FirebaseInstanceIdReceiver.zza(Unknown Source:139)
at com.google.firebase.iid.FirebaseInstanceIdReceiver.onReceive(Unknown Source:19)
at android.app.ActivityThread.handleReceiver(ActivityThread.java:3379)
at android.app.ActivityThread.access$1200(ActivityThread.java:199)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1661)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6669)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)

Looking forward for solution, Thanks..

@PlutusM
Copy link

PlutusM commented Jul 29, 2019

Any Solution, Facing same problem. i have setup Ionic web and android app sdk.

When i try to chat from ionic web to android. i am getting notification in android but when i try to open it nothing happening.

Here is logs i receive when i tap to notification :

2019-07-28 15:54:48.075 1818-1818/com.testing.app E/FirebaseMessaging: Notification pending intent canceled
2019-07-28 15:54:48.080 13718-16824/? W/audio_hw_generic: Not supplying enough data to HAL, expected position 30537465 , only wrote 30535920
2019-07-28 15:54:48.097 1818-1818/com.testing.app W/FirebaseMessaging: Error while parsing timestamp in GCM event
java.lang.NumberFormatException: s == null
at java.lang.Integer.parseInt(Integer.java:577)
at java.lang.Integer.parseInt(Integer.java:650)
at com.google.firebase.messaging.zzb.zzb(Unknown Source:81)
at com.google.firebase.messaging.zzb.zzd(Unknown Source:116)
at com.google.firebase.messaging.FirebaseMessagingService.zzc(Unknown Source:44)
at com.google.firebase.iid.zzf.zza(Unknown Source:30)
at com.google.firebase.iid.zzh.zzc(Unknown Source:77)
at com.google.firebase.iid.zzh.zza(Unknown Source:29)
at com.google.firebase.iid.FirebaseInstanceIdReceiver.zza(Unknown Source:139)
at com.google.firebase.iid.FirebaseInstanceIdReceiver.onReceive(Unknown Source:19)
at android.app.ActivityThread.handleReceiver(ActivityThread.java:3379)
at android.app.ActivityThread.access$1200(ActivityThread.java:199)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1661)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6669)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)

Looking forward for solution, Thanks..

I solved this issue by upgrading firebase messaging : implementation 'com.google.firebase:firebase-messaging:17.3.4'

I got another issue When i click on notification : E/FirebaseMessaging: Notification pending intent canceled

@PlutusM
Copy link

PlutusM commented Jul 30, 2019

Any Solution, Facing same problem. i have setup Ionic web and android app sdk.
When i try to chat from ionic web to android. i am getting notification in android but when i try to open it nothing happening.
Here is logs i receive when i tap to notification :
2019-07-28 15:54:48.075 1818-1818/com.testing.app E/FirebaseMessaging: Notification pending intent canceled
2019-07-28 15:54:48.080 13718-16824/? W/audio_hw_generic: Not supplying enough data to HAL, expected position 30537465 , only wrote 30535920
2019-07-28 15:54:48.097 1818-1818/com.testing.app W/FirebaseMessaging: Error while parsing timestamp in GCM event
java.lang.NumberFormatException: s == null
at java.lang.Integer.parseInt(Integer.java:577)
at java.lang.Integer.parseInt(Integer.java:650)
at com.google.firebase.messaging.zzb.zzb(Unknown Source:81)
at com.google.firebase.messaging.zzb.zzd(Unknown Source:116)
at com.google.firebase.messaging.FirebaseMessagingService.zzc(Unknown Source:44)
at com.google.firebase.iid.zzf.zza(Unknown Source:30)
at com.google.firebase.iid.zzh.zzc(Unknown Source:77)
at com.google.firebase.iid.zzh.zza(Unknown Source:29)
at com.google.firebase.iid.FirebaseInstanceIdReceiver.zza(Unknown Source:139)
at com.google.firebase.iid.FirebaseInstanceIdReceiver.onReceive(Unknown Source:19)
at android.app.ActivityThread.handleReceiver(ActivityThread.java:3379)
at android.app.ActivityThread.access$1200(ActivityThread.java:199)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1661)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6669)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
Looking forward for solution, Thanks..

I solved this issue by upgrading firebase messaging : implementation 'com.google.firebase:firebase-messaging:17.3.4'

I got another issue When i click on notification : E/FirebaseMessaging: Notification pending intent canceled

Got Solution,

On Cloud Functions
https://github.com/chat21/chat21-cloud-functions/blob/master/functions/push-notification.js

Dont Pass : click_action in notification
Like below :

const payload = {
        notification: {
            title: message.sender_fullname,
            body: text,
            icon : icon,
            sound : "default",
          //   click_action: clickAction,
            //click_action: "https://support.tiledesk.com/chat/",   // uncomment for intent filter in your custom project
            //click_action: "NEW_MESSAGE",   // uncomment for intent filter in your custom project

            // "content-available": "1",
            "content_available": "true",
            badge : "1"
        },

it will take main activity from app.

@shashankshahplutus
Copy link

@andrealeo83 @Sakpal Do we need to enable anything in our code for sending and receiving push notifications? We have implemented chat21-SDK successfully we are able to get the message on another end as well but notifications are not working on android and ios devices. I see there is js under the functions/push-notification.js seems it should work but it is not. am I doing something wrong or missing any configuration? please help! thanks in advance!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants