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

Android 8.1 app crashes when sending notifications from console #604

Closed
LukasAnda opened this issue Jul 27, 2018 · 3 comments
Closed

Android 8.1 app crashes when sending notifications from console #604

LukasAnda opened this issue Jul 27, 2018 · 3 comments

Comments

@LukasAnda
Copy link

LukasAnda commented Jul 27, 2018

Description:

When I send notification from OneSignal console, on Android 8.1 the app force closes when user receives notification. When user later does receive another notification, the app does not display any. Tested on Emulator

Environment

gradle

Steps to Reproduce Issue:

  1. Add the OneSignal SDK to your project
  2. Place your App ID in the application's gradle file
  3. Attempt to receive a push notification on Emulator with API 27

Anything else:

(crash stacktraces, as well as any other information here)

Process: com.vacatuner.internal.test.grandAfrika, PID: 4884
    android.app.RemoteServiceException: Bad notification for startForeground: java.lang.RuntimeException: invalid channel for service notification: Notification(channel=null pri=0 contentView=null vibrate=null sound=null defaults=0x0 flags=0x40 color=0x00000000 vis=PRIVATE)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1768)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loop(Looper.java:164)
        at android.app.ActivityThread.main(ActivityThread.java:6494)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
@jkasten2
Copy link
Member

@LukasAnda Thanks for reporting. This could either happen with if;

  1. The OneSignal SDK version is in your app is older than 3.6.0
  2. Your using an Android Support Library version older than 26
  3. Or if another GCM / FCM BroadcastReceiver in your app is also displaying a notification

To confirm if this issue is from 2. make sure any com.android.support entries in your build.gradle are 26 or newer. You run ./gradlew app:dependencies from the terminal to check all versions in your project.
To check if 3. is the issue you can enable filtering of other GCM / FCM when a notification is sent from OneSignal by calling filterOtherGCMReceivers(true) on init;

OneSignal
  .startInit(this)
  .filterOtherGCMReceivers(true)
  .init();

@LukasAnda
Copy link
Author

This is my dependencies section:

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
testImplementation 'junit:junit:4.12'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
implementation 'com.crashlytics.sdk.android:crashlytics:2.9.4'
implementation 'com.github.dimorinny:floating-text-button:0.0.4'
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'eu.inloop:androidviewmodel:1.0.0'
implementation 'com.android.support:design:27.1.1'
implementation 'com.jakewharton:butterknife:8.8.1'
implementation 'com.google.code.gson:gson:2.8.2'
implementation 'com.squareup.retrofit2:retrofit:2.4.0'
implementation 'com.squareup.retrofit2:converter-gson:2.4.0'
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'com.android.support:support-v4:27.1.1'
implementation 'com.jakewharton:disklrucache:2.0.2'
implementation 'joda-time:joda-time:2.9.9'
implementation 'com.android.support:cardview-v7:27.1.1'
implementation 'jp.wasabeef:picasso-transformations:2.1.1'
implementation 'com.wdullaer:materialdatetimepicker:3.4.0'
implementation 'com.squareup:otto:1.3.8'
implementation 'com.github.chrisbanes:PhotoView:2.1.3'
implementation 'com.squareup.okhttp3:logging-interceptor:3.10.0'
implementation 'com.squareup:tape:1.2.3'
implementation 'com.google.android.gms:play-services-analytics:11.6.2'
implementation 'uk.co.chrisjenx:calligraphy:2.3.0'
implementation 'com.thoughtbot:expandablerecyclerview:1.3'
implementation 'nl.qbusict:cupboard:2.2.0'
implementation 'com.github.arimorty:floatingsearchview:2.1.1'
implementation 'com.github.bumptech.glide:glide:4.7.1'
implementation "com.github.bumptech.glide:okhttp3-integration:4.7.1"
annotationProcessor 'com.github.bumptech.glide:compiler:4.7.1'
implementation 'com.firebase:firebase-jobdispatcher:0.8.5'
implementation 'com.google.android.exoplayer:exoplayer:2.7.2'
implementation 'com.google.android.exoplayer:extension-okhttp:2.6.1'

implementation 'com.onesignal:OneSignal:3.9.2'
}

apply plugin: 'com.google.gms.google-services' 

@jkasten2
Copy link
Member

@LukasAnda Thanks for the list. After looking at your crash log again it is crashing from a call to startForeground. However OneSignal does not use this method so this must be from your app or one of the other dependencies in your project.

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

2 participants