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

An uncaught Exception : Context.startForegroundService() #278

Open
EinatGit opened this issue Dec 28, 2020 · 1 comment
Open

An uncaught Exception : Context.startForegroundService() #278

EinatGit opened this issue Dec 28, 2020 · 1 comment

Comments

@EinatGit
Copy link

Hello,
We are using nativescript-background-http on NativeScript with Angular to upload photos.
After 3-10 uploads (we've checked that each upload is ending before a new one begins) the APP is crashing and we get this error:

System.err: An uncaught Exception occurred on "main" thread.
System.err: Context.startForegroundService() did not then call Service.startForeground(): ServiceRecord{3947ebe u0 org.nativescript.MyApp/net.gotev.uploadservice.UploadService}
System.err: 
System.err: StackTrace:
System.err: android.app.RemoteServiceException: Context.startForegroundService() did not then call Service.startForeground(): ServiceRecord{3947ebe u0 org.nativescript.MyApp/net.gotev.uploadservice.UploadService}
System.err:     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2005)
System.err:     at android.os.Handler.dispatchMessage(Handler.java:106)
System.err:     at android.os.Looper.loop(Looper.java:223)
System.err:     at android.app.ActivityThread.main(ActivityThread.java:7656)
System.err:     at java.lang.reflect.Method.invoke(Native Method)
System.err:     at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
System.err:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)

The issue occur on:

  • Android 11
  • Devices : Google Pixel 2, Xiaomi Note 10 PRO

Version numbers:

-CLI 6.5.1
[email protected]
-tns-android": {
"version": "6.5.3"
}
nativescript-background-http is updated to the last one ^4.2.1

package.json:

{
  "nativescript": {
    "id": "My App",
    "tns-ios": {
      "version": "6.5.2"
    },
    "tns-android": {
      "version": "6.5.3"
    }
  },
  "description": "NativeScript Application",
  "license": "SEE LICENSE IN <your-license-filename>",
  "repository": "<fill-your-repository-here>",
  "dependencies": {
    "@angular/animations": "~8.2.0",
    "@angular/common": "~8.2.0",
    "@angular/compiler": "~8.2.0",
    "@angular/core": "~8.2.0",
    "@angular/forms": "~8.2.0",
    "@angular/http": "8.0.0-beta.10",
    "@angular/platform-browser": "~8.2.0",
    "@angular/platform-browser-dynamic": "~8.2.0",
    "@angular/router": "~8.2.0",
    "@nativescript/theme": "^3.0.1",
    "@ngx-translate/core": "^11.0.1",
    "@ngx-translate/http-loader": "^4.0.0",
    "@nstudio/nativescript-camera-plus": "^3.1.0",
    "@nstudio/nativescript-loading-indicator": "^1.0.0",
    "@nstudio/nativescript-pulltorefresh": "^2.0.0",
    "nativescript-angular": "^8.20.4",
    "nativescript-background-http": "^4.2.1",
    "nativescript-camera": "^4.4.0",
    "nativescript-datetimepicker": "^1.2.3",
    "nativescript-imagecropper": "^3.0.0",
    "nativescript-imagepicker": "^7.1.0",
    "nativescript-nfc": "4.0.1",
    "nativescript-permissions": "^1.3.8",
    "nativescript-plugin-firebase": "9.0.2",
    "nativescript-theme-core": "~1.0.4",
    "nativescript-ui-chart": "^7.1.1",
    "nativescript-ui-sidedrawer": "^8.0.1",
    "reflect-metadata": "~0.1.10",
    "rxjs": "^6.4.0",
    "tns-core-modules": "^6.3.2",
    "zone.js": "^0.9.1"
  },
  "devDependencies": {
    "@angular/compiler-cli": "~8.2.0",
    "@nativescript/schematics": "~0.5.0",
    "@ngtools/webpack": "~8.2.0",
    "@types/jasmine": "^3.5.11",
    "nativescript-dev-webpack": "^1.4.1",
    "tns-platform-declarations": "6.0.1",
    "typescript": "~3.5.3"
  },
  "readme": "NativeScript Application"
}

Can you please help with this error and the way to fix it?
Thank you

@chimmelb
Copy link

chimmelb commented Jan 4, 2021

Nativescript plugins are being maintained elsewhere, and this looks like a duplicate bug of NativeScript/plugins#63

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