pathsense / pathsense-samples-android

Sample Applications for the PathSense SDK
Other
26 stars 10 forks source link

Bad notification for startForeground on Android 8.0 #13

Closed Kahtaf closed 6 years ago

Kahtaf commented 6 years ago

In pathsense.properties, if oreo_show_notification=true is not specified, it results in the following crash on Android 8.0+. A notification channel needs to be set when startForeground is called in com.pathsense.locationengine.apklib.LocationEngineService.onStartCommand();

android.app.RemoteServiceException: Bad notification for startForeground: java.lang.RuntimeException: invalid channel for service notification: Notification(channel=null pri=-2 contentView=null vibrate=null sound=null tick 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)

I don't see this issue when oreo_show_notification=true is specified.

dyerjo commented 6 years ago

This error has been fixed on the latest release. Please, update to PathSense Android SDK 3.1.0.6.