We are moving to Discord!

Join us on the Countly Community Discord Server! Engage in discussions, share your feature ideas, and learn from fellow Countly users to build exceptional apps and experiences.

Android - Rich notification

Hi

I’m trying to test rich push notifications on android. There’s a button and a link included with the notification. Everything works fine, but when I touch the button on the push notification (app already in background) the app in the background crashes with this log:

2019-06-24 16:57:49.359 11876-11876/com.nizek.drops E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.nizek.drops, PID: 11876
java.lang.RuntimeException: Error receiving broadcast Intent { act=ly.count.android.sdk.CountlyPush.NOTIFICATION_BROADCAST flg=0x10000010 bnds=[63,1009][1017,1130] (has extras) } in ly.count.android.sdk.messaging.CountlyPush$NotificationBroadcastReceiver@1dea5ed
at android.app.LoadedApk$ReceiverDispatcher$Args.lambda$getRunnable$0(LoadedApk.java:1493)
at android.app.-$$Lambda$LoadedApk$ReceiverDispatcher$Args$_BumDX2UKsnxLVrE6UJsJZkotuA.run(Unknown Source:2)
at android.os.Handler.handleCallback(Handler.java:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7045)
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:965)
Caused by: android.util.AndroidRuntimeException: Calling startActivity() from outside of an Activity context requires the FLAG_ACTIVITY_NEW_TASK flag. Is this really what you want?
at android.app.ContextImpl.startActivity(ContextImpl.java:974)
at android.app.ContextImpl.startActivity(ContextImpl.java:950)
at android.content.ContextWrapper.startActivity(ContextWrapper.java:384)
at ly.count.android.sdk.messaging.CountlyPush$NotificationBroadcastReceiver.onReceive(CountlyPush.java:247)
at android.app.LoadedApk$ReceiverDispatcher$Args.lambda$getRunnable$0(LoadedApk.java:1483)
at android.app.-$$Lambda$LoadedApk$ReceiverDispatcher$Args$_BumDX2UKsnxLVrE6UJsJZkotuA.run(Unknown Source:2)
at android.os.Handler.handleCallback(Handler.java:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7045)
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:965)

Do you have any idea how to resolve this issue?

0

Comments

6 comments
  • Thanks. Let's check this. CC @artem

    0
    Comment actions Permalink
  • I guess updating SDK to a recent version would solve it for you @Mahan. Which version are you on by the way?

    0
    Comment actions Permalink
  • Hi @artem. I'm on version 18.04 which I think is the latest version. (at least according to the documentation here)

    implementation 'ly.count.android:sdk-messaging-fcm:18.04'
    implementation 'ly.count.android:sdk:18.04'

    0
    Comment actions Permalink
  • Latest is 19.02.3, I updated the doc.

    0
    Comment actions Permalink
  • Cool. Thank you @artem.

    0
    Comment actions Permalink
  • @artem, The latest version solved the issue. Thank you for your help.

    0
    Comment actions Permalink

Please sign in to leave a comment.