Unable to start service Intent on calling BackgroundGeolocation.start()
See original GitHub issueYour Environment
- Plugin version: 3.0.0-alpha.50
- Platform: Android
- OS version: 8.1 (API 27)
- Device manufacturer and model: Nexus 5X
- Running in Simulator: Yes
- Cordova version: 8.1.2
- Cordova platform version: 7.1.4 (Android)
Context
Using the example code provided, the GPS tracking doesn’t initialize properly and cannot be used.
Expected Behavior
The GPS tracking service should start, and the foreground notification in the top drawer should be visible.
Actual Behavior
Nothing happens, the service isn’t started. Foreground notification does not appear (but the events for background mode triggers in the console.log)
Possible Fix
There has been changes to background mode, and how you start Intents, in Android 8.0+ https://developer.android.com/about/versions/oreo/background
The following issue in the react-native project may be of interest: https://github.com/mauron85/react-native-background-geolocation/issues/172
Debug logs
02-04 09:04:57.034 5194 5270 I com.marianhello.bgloc.BackgroundGeolocationFacade: Initializing plugin
02-04 09:04:57.082 5194 5270 D com.tenforwardconsulting.bgloc.cordova.BackgroundGeolocationPlugin: Registering event listeners
02-04 09:04:57.109 5194 5270 W PluginManager: THREAD WARNING: exec() call to BackgroundGeolocation.addEventListener blocked the main thread for 27ms. Plugin should use CordovaInterface.getThreadPool().
02-04 09:04:57.117 5194 5230 D NetworkSecurityConfig: No Network Security Config specified, using platform default
02-04 09:04:57.362 5194 5194 D SystemWebChromeClient: file:///android_asset/www/plugins/cordova-plugin-android-softinputmode/www/interface.js: Line 3 : Success
02-04 09:04:57.362 5194 5194 I chromium: [INFO:CONSOLE(3)] "Success", source: file:///android_asset/www/plugins/cordova-plugin-android-softinputmode/www/interface.js (3)
02-04 09:04:57.462 5194 5272 D com.marianhello.bgloc.data.sqlite.SQLiteConfigurationDAO: Configuration persisted with rowId = 1
02-04 09:04:57.466 5194 5272 D com.marianhello.bgloc.BackgroundGeolocationFacade: Service configured with: Config[distanceFilter=50 stationaryRadius=100.0 desiredAccuracy=0 interval=3000 fastestInterval=5000 activitiesInterval=10000 isDebugging=true stopOnTerminate=true stopOnStillActivity=true startOnBoot=false startForeground=true notificationsEnabled=true locationProvider=1 nTitle=PolarFleet GPS tracking nText=enabled nIconLarge= nIconSmall= nIconColor= url=myUrl Threshold=100 httpHeaders={Content-Type=application/json} maxLocations=1 postTemplate={"heading":"@bearing","foo":"bar","lon":"@longitude","id":"ADG198","lat":"@latitude","speed":"@speed","timestamp":""}]
02-04 09:04:57.490 5194 5251 D EGL_emulation: eglMakeCurrent: 0xa9205d80: ver 3 0 (tinfo 0x9563a050)
02-04 09:04:57.508 1638 1941 W ActivityManager: Unable to start service Intent { cmp=myApp/com.marianhello.bgloc.service.LocationServiceImpl (has extras) } U=0: not found
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
Unable to start service Intent on calling ... - GitHub
Unable to start service Intent on calling ... BackgroundGeolocation.start(); is showing not throwing any error but location is not getting ...
Read more >Android 8.0: java.lang.IllegalStateException: Not allowed to ...
After targeting API level 26, my application fails to start service on Android 8.0 on background. Caused by: java.lang.IllegalStateException: ...
Read more >cordova-plugin-saralweb-background-geolocation - npm package ...
cordova-plugin-saralweb-background-geolocation. Description. Cross-platform background location tracking plugin for Cordova / PhoneGap with battery-saving ...
Read more >Cordova Background Geolocation Tracking - Ionic Framework
start (); // If you wish to turn OFF background-tracking, call the #stop method ...
Read more >Access location in the background - Android Developers
When you remove this permission, all-the-time access to location isn't an option for the app on devices that run Android 10. Make sure...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thanks for your inputs, I’ve just got it working, apparently the issue was in the @ionic-native/background-geolocation/ngx
Using the following work properly, I will create my own ionic provider at that point.
and you were correct we do not have the same issue, sorry for stealing your thread
I suspect that we may not have the same problem, because everything else works for me (background/foreground mode, app settings etc) but nothing happens when I call start() in the checkStatus callback, and no notification about background mode is shown in the drawer at the top.
Javascript
console.log output