Closed AlexMCon closed 5 years ago
I declared com as any, as I got a suggestion, but now this shows up: ERROR Error: Uncaught (in promise): TypeError: Cannot read property 'location' of undefined
Hi @AlexMCon,
Please review the current state of https://github.com/NativeScript/nativescript-geolocation/blob/master/demo/app/background-service.ts. It was updated a while ago to fix a crash - https://github.com/NativeScript/nativescript-geolocation/pull/237.
:wave: @AlexMCon, we use the issue tracker exclusively for bug reports and feature requests. However, this issue appears to be a support request. Please, use Stackoverflow to get help.
I'm having trouble to implement this with angular, I can't make it work.
Error: com.tns.system.classes.loading.LookedUpClassNotFound: Class "com.nativescript.location.BackgroundService" not found.
the background-service is the same like in the example.
I use Angular 8.
Added to AndroidManifest, built with cleaned environment ` <service android:name="com.nativescript.location.BackgroundService" android:exported="false" >
<service android:name="com.nativescript.location.BackgroundService26"
android:permission="android.permission.BIND_JOB_SERVICE"
android:enabled="true"
android:exported="false">
</service>`
I don't understand why it's still missing the packages.
I'm using this geolocation-plugin (https://github.com/NativeScript/nativescript-geolocation/tree/e125998c07ced42a215aca1a8feac1b7dbe7b6d6) to get constant location updates while app is in the background.
I tried using the code in the demo, but I'm not figuring out how to make it work.
I would like the user to press a button and the app to start monitoring his location, even if the app goes in the background.
home.component.ts
geolocation.service.ts
background.service.ts
Firstly, there is a problem with the 'com' namespace as it says "Property 'nativescript' does not exist on type 'typeof com' ". The problem appears in the home.component.ts on these 3 lines:
const component = new android.content.ComponentName(context, com.nativescript.location.BackgroundService26.class); let intent = new android.content.Intent(context, com.nativescript.location.BackgroundService.class); let intent = new android.content.Intent(context, com.nativescript.location.BackgroundService.class);
Secondly, I don't know what is the purpose of background-service as it i not used anywhere in the demo (or maybe it is, but in a way that I'm not familiar with).
Thank you!