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

Notification Channel Error using >= Android 0 #194

Closed
alexgilbertDG opened this issue May 18, 2018 · 8 comments
Closed

Notification Channel Error using >= Android 0 #194

alexgilbertDG opened this issue May 18, 2018 · 8 comments
Labels
stale auto labeled abandoned issues after a period of inactivity

Comments

@alexgilbertDG
Copy link

alexgilbertDG commented May 18, 2018

This library seem's to have a problem when I use it with a Google Pixel under android 8.1.0.

The error in the adb logcat is:

E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.travlingbuddies, PID: 11763
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=0x62 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)

This error occur when the .configure is call and the service is starting, I only receive 1 location before this error occur, it's probably inside LocationService.java that the error occur.

I search in the code and it's seems not ready to use the new Channel API under OREO, seem's like it required a channel id to notify the user.

EXEMPLE : builder.setChannelId(ID);

react-native-mauron85-background-geolocation: 0.5.0-alpha.14

  • Platform: Android
  • OS version: 8.1.0
  • Device manufacturer and model: Google Pixel
  • React Native version: 0.51.0

I had a working version using this version of the library a month ago, without any issue, now I only got that problem and can't make it work.
I try using the new version alpha-25, but it only make new errors that other people have open issue can't have a fix, so I figure just stick to this version since I don't have all the other errors.

Thanks

OTHER INFO:
app/build.gradle:

android {
compileSdkVersion 27
buildToolsVersion "26.0.2"

defaultConfig {
    applicationId "com.travlingbuddies"
    minSdkVersion 16
    targetSdkVersion 27
    versionCode 1
    versionName "1.0"
    ndk {
        abiFilters "armeabi-v7a", "x86"
    }
    multiDexEnabled true
}

...

compile project(':react-native-vector-icons')
compile project(':react-native-mauron85-background-geolocation')
compile project(':react-native-linear-gradient')
compile project(':react-native-firebase')
compile fileTree(dir: "libs", include: ["*.jar"])
compile "com.android.support:appcompat-v7:27.0.2"
compile "com.facebook.react:react-native:+" // From node_modules
compile "com.google.android.gms:play-services-base:15.0.0"
compile 'com.google.android.gms:play-services-location:15.0.0'
compile 'com.google.firebase:firebase-core:15.0.2'
compile "com.google.firebase:firebase-firestore:16.0.0"
compile "com.google.firebase:firebase-auth:15.1.0"
compile "com.google.firebase:firebase-storage:15.0.2"

project/build.gradle:
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
classpath 'com.google.gms:google-services:3.2.1'

    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
}

}

allprojects {
repositories {
mavenLocal()
jcenter()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url "$rootDir/../node_modules/react-native/android"
}
google()
}
}

@mauron85
Copy link
Owner

Upgrade your version. 0.5.0-alpha.14 is too old.

@alexgilbertDG
Copy link
Author

alexgilbertDG commented May 18, 2018

I try but then I get this issue #191 , do you have a fixed on this ?

Thanks,
great work !!

@alexgilbertDG
Copy link
Author

Can't I make it work by removing all the NotificationBuilder in java, only need to be android and don't need the notification ?

@mauron85
Copy link
Owner

Yes, but it will not work reliably in background. As service will not get promoted to foreground service.

@alexgilbertDG
Copy link
Author

Okay, I will try updating, and will try to fix this issue #191 !
Thanks

@mauron85
Copy link
Owner

mauron85 commented May 19, 2018 via email

@stale
Copy link

stale bot commented Nov 15, 2018

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale auto labeled abandoned issues after a period of inactivity label Nov 15, 2018
@stale
Copy link

stale bot commented Nov 23, 2018

This issue has been automatically closed, because it has not had recent activity. If you believe this issue shouldn't be closed, please reopen or write down a comment requesting issue reopening with explanation why you think it's important. Thank you for your contributions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale auto labeled abandoned issues after a period of inactivity
Projects
None yet
Development

No branches or pull requests

2 participants