NativeScript / nativescript-background-http

Background Upload plugin for the NativeScript framework
Apache License 2.0
102 stars 50 forks source link

Android: NAMESPACE is null #117

Closed vtjon closed 6 years ago

vtjon commented 6 years ago

The new version of uploadservice plugin requires you to set the namespace. Despite the namespace being declared on Line 8, it is null when you start the session. This causes the upload as well as the progress indicators to fail inexplicably. I tried setting the namespace in the session(id:string) method and it seems to work.

This may be more of a documentation issue but for any uploads to work now in Android Oreo, androidDisplayNotificationProgress must be set to true.

radeva commented 6 years ago

Hi @vtjon ,

Could you delete your platforms folder and try again? It's a know issue that when a native dependency is updated, you need to remove your platforms and run the app again.

vtjon commented 6 years ago

I think you may be right. It seems to be working though I am testing again. I am going to close this and will reopen if necessary.

vtjon commented 6 years ago

This is still happening. I was confused because I wasn't testing on Android O device. When I tested, I got:

System.err: 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=0x42 color=0x00000000 vis=PRIVATE)

This is because the plugin uses the namespace as the notification channel.

fthuin commented 6 years ago
ActivityManager: Error showing notification for service
ActivityManager: java.lang.RuntimeException: invalid channel for service notification: Notification(channel=null pri=0 contentView=null vibrate=null sound=null defaults=0x0 flags=0x42 color=0x00000000 vis=PRIVATE)
ActivityManager:    at com.android.server.am.ServiceRecord$1.run(ServiceRecord.java:532)
ActivityManager:    at android.os.Handler.handleCallback(Handler.java:790)
ActivityManager:    at android.os.Handler.dispatchMessage(Handler.java:99)
ActivityManager:    at android.os.Looper.loop(Looper.java:164)
ActivityManager:    at android.os.HandlerThread.run(HandlerThread.java:65)
ActivityManager:    at com.android.server.ServiceThread.run(ServiceThread.java:46)
System.err: 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=0x42 color=0x00000000 vis=PRIVATE)
System.err:     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1768)
System.err:     at android.os.Handler.dispatchMessage(Handler.java:106)
System.err:     at android.os.Looper.loop(Looper.java:164)
System.err:     at android.app.ActivityThread.main(ActivityThread.java:6494)
System.err:     at java.lang.reflect.Method.invoke(Native Method)
System.err:     at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
System.err:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
ActivityManager: START u0 {flg=0x14008000 cmp=org.nativescript.tabacstopnativescript/com.tns.ErrorReportActivity (has extras)} from uid 10079
ActivityManager: Process org.nativescript.tabacstopnativescript (pid 4599) has died: fore TOP
ActivityManager: Scheduling restart of crashed service org.nativescript.tabacstopnativescript/net.gotev.uploadservice.UploadService in 1000ms
ActivityManager: Start proc 4709:org.nativescript.tabacstopnativescript/u0a79 for activity org.nativescript.tabacstopnativescript/com.tns.ErrorReportActivity
ActivityManager: Stopping service due to app idle: u0a79 -297ms org.nativescript.tabacstopnativescript/net.gotev.uploadservice.UploadService
ActivityManager: setHasOverlayUi called on unknown pid: 4599
ActivityManager: Displayed org.nativescript.tabacstopnativescript/com.tns.ErrorReportActivity: +804ms
ActivityManager: Killing 3898:com.google.android.videos/u0a74 (adj 906): empty #17
03-31 19:22:50.851  1592  1609 I chatty  : uid=1000(system) ActivityManager identical 1 line
DimitarTodorov commented 6 years ago

The issue is fixed in version 3.2.3, which is now the latest official version in npm.