Giter Club home page Giter Club logo

cordova-background-geolocation-plugin's People

Contributors

acognigni-evotecnia avatar andreandersson avatar athorcis avatar christocracy avatar coderroggie avatar djereg avatar eakkew avatar eliesauveterre avatar ernestohegi avatar github-actions[bot] avatar harelm avatar jancellor avatar jdupuis avatar jhonimaike avatar jwasnoggin avatar keesschollaart81 avatar kingjan1999 avatar lucamazz1 avatar m165437 avatar mauron85 avatar mehuge avatar nathan-xiao1 avatar raddishiow avatar rrrasti avatar rtholmes avatar samsonasu avatar spr-joshlamkin avatar tfelici avatar yannbertrand avatar zgiles avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cordova-background-geolocation-plugin's Issues

Example repository

Is your feature request related to a problem? Please describe.
The problem is that we want to make sure the plugin code is working and does not cause build failures

Describe the solution you'd like
A separate repository with the simplest code to run the plugin.

Describe alternatives you've considered
Fork this repo: https://github.com/mauron85/cordova-plugin-background-geolocation-example
Create one from scratch.

Additional context
I think creating one from scratch would allow to simply test that the plugin code compiles and works.
The existing example is vary good to test the plugin in all kind of cases, but maintaining it might require a bit too much effort as opposed to a very very basic vanilla html/javascript cordova application which only allow basic functionality that can be changed via code changes and not UI changes to reduce implementation complexity...

My vote is for a clean repo with basic vanilla html/js.

Looking for maintainers

We are looking for people to help maintain this and the related repositories, so that the project doesn't end up being orphaned.

If you are interested in helping out in any way, from monitoring and responding to issues and PRs to working on core components, please let me know below!

Fix Android Export in AuthenticatorService

Error in Android Manifest
Add android:exported = false in com.marianhello.bgloc.sync.AuthenticatorService

<service android:exported="false" android:name="com.marianhello.bgloc.sync.AuthenticatorService"> <intent-filter> <action android:name="android.accounts.AccountAuthenticator"/> </intent-filter> <meta-data android:name="android.accounts.AccountAuthenticator" android:resource="@xml/authenticator" /> </service>

Make the tests run on every commit

Currently there are tests in the repo which are not running.
Also compilation should be done on every commit.
Both are missing.
We need to investigate how the old CI was running in order to migrate it here, probably to github actions (assuming it have macos environment)

Clean up a bit

The following need to be cleaned up a bit I think:

  • CI definitions from common submodules which were added to this repo
  • Old tags and releases from this repo that are not relevant (forked from previous repo)
  • Phone gap references in documentation
  • #41

Adjust android-permissions package name

Describe the bug
android-permissions is only in jcenter which was announced to be closed.
Need to remove this package and find the relevant alternative as this won't continue working and needs an extra configuration to work with cordova-android 10.

Improve issue templates

It would be good to create a separate issue template for feature requests alongside making sure the bug template is up-to-date.

Not working with cordova-plugin-mobile-ocr

I try to use this plugin with the cordova-plugin-mobile-ocr plugin. I cannot get a project build or compiled event with just only these two plugins. The error messages is:

D:\Cordova\Multitrans3\platforms\android\gradlew: Command failed with exit code 1 Error output:
D:\Cordova\Multitrans3\platforms\android\app\src\main\java\com\marianhello\bgloc\data\BackgroundActivity.java:20: error: cannot access zzbfm
confidence = activity.getConfidence();
^
class file for com.google.android.gms.internal.zzbfm not found
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
1 error

My Environment is

Plugin versions:
cordova-background-geolocation-plugin 2.0.4
cordova-plugin-mobile-ocr 3.1.2
Platform: Android 8.x/9.x/10.x
Cordova version: 11
Cordova platform version (cordova platform ls): 8.1.0

Steps to Reproduce

Create a new cordova project
cordova plugin add https://github.com/HaylLtd/cordova-background-geolocation-plugin.git
cordova plugin add cordova-plugin-mobile-ocr
cordova platform add android@8
cordova build android

I tried also android@9 and android@10 without success. Each plugin for its own do work correctly, but not both together.

Any suggestion or help is welcome.

App cashes on Android 10

Describe the bug
App Crashes on some devices with Android 10 once the user allows all the permissions.

To Reproduce
Steps to reproduce the behavior:

Simply run this code:

function onDeviceReady() {
  BackgroundGeolocation.configure({
    locationProvider: BackgroundGeolocation.ACTIVITY_PROVIDER,
    desiredAccuracy: BackgroundGeolocation.HIGH_ACCURACY,
    stationaryRadius: 50,
    distanceFilter: 50,
    notificationTitle: 'Background tracking',
    notificationText: 'enabled',
    debug: true,
    interval: 10000,
    fastestInterval: 5000,
    activitiesInterval: 10000,
    url: 'http://192.168.81.15:3000/location',
    httpHeaders: {
      'X-FOO': 'bar'
    },
    // customize post properties
    postTemplate: {
      lat: '@latitude',
      lon: '@longitude',
      foo: 'bar' // you can also add your own properties
    }
  });

  BackgroundGeolocation.on('location', function(location) {


    alert(location);
    // handle your locations here
    // to perform long running operation on iOS
    // you need to create background task
    BackgroundGeolocation.startTask(function(taskKey) {
      // execute long running task
      // eg. ajax post location
      // IMPORTANT: task has to be ended by endTask
      BackgroundGeolocation.endTask(taskKey);
    });
  });

  BackgroundGeolocation.on('stationary', function(stationaryLocation) {
    // handle stationary locations here

    
    alert('st');
  });

  BackgroundGeolocation.on('error', function(error) {
    alert('[ERROR] BackgroundGeolocation error:', error.code, error.message);
  });

  BackgroundGeolocation.on('start', function() {
    alert('[INFO] BackgroundGeolocation service has been started');
  });

  BackgroundGeolocation.on('stop', function() {
    alert('[INFO] BackgroundGeolocation service has been stopped');
  });

  BackgroundGeolocation.on('authorization', function(status) {
    alert('[INFO] BackgroundGeolocation authorization status: ' + status);
    if (status !== BackgroundGeolocation.AUTHORIZED) {
      // we need to set delay or otherwise alert may not be shown
      setTimeout(function() {
        var showSettings = confirm('App requires location tracking permission. Would you like to open app settings?');
        if (showSettings) {
          return BackgroundGeolocation.showAppSettings();
        }
      }, 1000);
    }
  });

  BackgroundGeolocation.on('background', function() {
    alert('[INFO] App is in background');
    // you can also reconfigure service (changes will be applied immediately)
    BackgroundGeolocation.configure({ debug: true });
  });

  BackgroundGeolocation.on('foreground', function() {
    alert('[INFO] App is in foreground');
    BackgroundGeolocation.configure({ debug: false });
  });

  BackgroundGeolocation.on('abort_requested', function() {
    alert('[INFO] Server responded with 285 Updates Not Required');

    // Here we can decide whether we want stop the updates or not.
    // If you've configured the server to return 285, then it means the server does not require further update.
    // So the normal thing to do here would be to `BackgroundGeolocation.stop()`.
    // But you might be counting on it to receive location updates in the UI, so you could just reconfigure and set `url` to null.
  });

  BackgroundGeolocation.on('http_authorization', () => {
    alert('[INFO] App needs to authorize the http requests');
  });

  BackgroundGeolocation.checkStatus(function(status) {
    alert('[INFO] BackgroundGeolocation service is running', status.isRunning);
    alert('[INFO] BackgroundGeolocation services enabled', status.locationServicesEnabled);
    alert('[INFO] BackgroundGeolocation auth status: ' + status.authorization);

    // you don't need to check status before start (this is just the example)
    if (!status.isRunning) {
      BackgroundGeolocation.start(); //triggers start on start event
    }
  });



  // you can also just start without checking for status
  // BackgroundGeolocation.start();

  // Don't forget to remove listeners at some point!
  // BackgroundGeolocation.removeAllListeners();
}

document.addEventListener('deviceready', onDeviceReady, false);

Expected behavior

It should work as its intended to. The above code has been tested on Nexus 5 and Galaxy Tab s7 both Android 11 and it worked fine. but the same code crashes another Nexus 5 Android 10.

Screenshots
N/A

Smartphone (please complete the following information):

  • Device: Nexus 5
  • OS: Android 10

plugin.xml version does not match package.json version

The version is not consistent between plugin.xml and package.json:

This causes confusion because:

cordova plugin list
cordova-background-geolocation-plugin 2.0.1 "CDVBackgroundGeolocation"

even though 2.0.3 is installed.

Similarly, the name field is inconsistent between the two files (likely both should be cordova-background-geolocation-plugin, instead of plugin.xml being CDVBackgroundGeolocation).

Add guide on contributing

It would be good to add a guide on contributing and developing the plugin, with the steps needed to setup a dev environment, the process for submitting a PR, etc.

Ionic Capacitor Problem

Describe the bug
Trying to add this plugin to my Ionic-Angular-Capacitor project results in error when building the project:

[ng] ./node_modules/cordova-background-geolocation-plugin/www/BackgroundGeolocation.js:13:14-40 - Error: Module not found: Error: Can't resolve 'cordova/channel' in 'my-app/node_modules/cordova-background-geolocation-plugin/www'

To Reproduce
Steps to reproduce the behavior:

  1. create new ionic project with Angular and Capacitor
  2. add cordova-background-geolocation-plugin to project:
    npm install cordova-background-geolocation-plugin
  3. add plugin example code to your project
  4. execute ionic serve
  5. above mentioned error pops up

Expected behavior
project builds without error

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: LinuxMint 19
  • Browser: Firefox
  • Version: latest

Smartphone (please complete the following information):

  • Device: MotoG7
  • OS: Android 11

Capture in a regular basis

Hello, Mr. Radestock,

Thanks for your work with this plugin. I am testing it in our app and it is working well.

But, it has a behavior that is inconvenient to us. When the mobile is stationary the location capture is delayed more and more.

Is possible to change it? Is there a configuration to do that? We need to capture in a regular basis, or no more than 10 minutes.

Thanks in advance.

Vinicios Torres

Heading and bearing undefined

Describe the bug
the app returns the value of bearing and heading as undefined sometimes. Anyone know how to fix this issue

Location posting stops randomly and resumes only after switching the aeroplane mode on/off

I am using the cordova-background-geolocation-plugin 2.0.4 in our Cordova 10.0 application. The issue is the location submission randomly stops after some time, and resumes only after the aeroplane mode of the device is switched on and then off.

Other JS HXR based functionalities are working fine even when the location posting is stopped.

Using Motorola Moto G41 with Android 11.

Using RAWPROVIDER with startForeground = true.
Happens when the app is in both foreground and background.

Consider removing SQLiteLocationDAO.java

This is a spinoff from #18 as I've see there that there's a file that appears not to be in use:
com.marianhello.bgloc.data.sqlite.SQLiteLocationDAO.java
As such, it might be better to remove it.
I need to be sure this is the case, but I don't want to hold #18 hostage due to this issue, so I split this to another issue so I won't forget to take a look at it...

Request permission full prompt

FeatureRequest

Description

When making the permission request, the permission selection alert should be full prompt, like the attached image.
According to the Android documentation, two permissions must be requested at the same time for it to display the permission request that way.

https://developer.android.com/training/location/permissions#fig-approximate-only

Platform(s)

Android

Preferred Solution

Let the permission request come out like the image
Request ACCESS_FINE_LOCATION and ACCESS_COARSE_LOCATION in a single runtime request.

[ASK} Authenticate_accounts permission

Hello!

For which plugins functionalities is this permission needed? I assume the sync part? If i'm not using that functionality could i safely remove this permission?

Failure Build with AAPT: error: attribute android:foregroundServiceType not found

Hello,

I try to use this plugin to my cordova project. when I build android, i got build failed result with details below :

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':app:processDebugResources'.

Android resource linking failed
/Applications/Ampps/www/app/ema0/platforms/android/app/build/intermediates/merged_manifests/debug/AndroidManifest.xml:98: AAPT: error: attribute android:foregroundServiceType not found.


my cordova project spec :

9.0.0 ([email protected])
android 8.1.0

cordova-background-geolocation-plugin 2.0.4 "cordova-background-geolocation-plugin"
cordova-plugin-androidx 3.0.0 "cordova-plugin-androidx"
cordova-plugin-androidx-adapter 1.1.3 "cordova-plugin-androidx-adapter"
cordova-plugin-camera 4.1.0 "Camera"
cordova-plugin-device 2.1.0 "Device"
cordova-plugin-dialogs 2.0.2 "Notification"
cordova-plugin-file 6.0.2 "File"
cordova-plugin-file-transfer 1.7.1 "File Transfer"
cordova-plugin-geolocation 4.1.0 "Geolocation"
cordova-plugin-inappbrowser 4.1.0 "InAppBrowser"
cordova-plugin-media 5.0.4 "Media"
cordova-plugin-media-capture 3.0.3 "Capture"
cordova-plugin-network-information 3.0.0 "Network Information"
cordova-plugin-screen-orientation 3.0.2 "Screen Orientation"
cordova-plugin-whitelist 1.3.5 "Whitelist"
es6-promise-plugin 4.2.2 "Promise"

HTTP Posting Not Working

I tried to test this plugin following the example but with my staging API. I dont know how to make this plugin works, since it's never send any post request to my API.

BackgroundGeolocation.configure({
    locationProvider: BackgroundGeolocation.ACTIVITY_PROVIDER,
    desiredAccuracy: BackgroundGeolocation.HIGH_ACCURACY,
    stationaryRadius: 10,
    distanceFilter: 10,
    notificationTitle: 'ITAPANDGO',
    notificationText: 'Location Service: ENABLED',
    notificationsEnabled: true,
    debug: true,
    interval: 10000,
    fastestInterval: 5000,
    activitiesInterval: 10000,
    maxLocations: 1000,
    startOnBoot: true,
    stopOnTerminate: true,
    startForeground:true,
    url: 'http://my.staging.com/my/location',
    httpHeaders: {
        'Authorization': 'Bearer ' + token.accessToken
    },
    postTemplate: {
        altitude: '@altitude',
        latitude: '@latitude',
        longitude: '@longitude',
        speed: '@speed',
        accuracy: '@accuracy'
    }
});

BackgroundGeolocation.on('location', function(location) {
    BackgroundGeolocation.startTask(function(taskKey) {
        BackgroundGeolocation.endTask(taskKey);
    });
});

BackgroundGeolocation.on('error', function(error) {
    console.log('[ERROR] BackgroundGeolocation error:', error.code, error.message);
});
BackgroundGeolocation.on('start', function() {
    console.log('[INFO] BackgroundGeolocation service has been started');
});

BackgroundGeolocation.on('stop', function() {
    console.log('[INFO] BackgroundGeolocation service has been stopped');
});

BackgroundGeolocation.on('authorization', function(status) {
    if (status !== BackgroundGeolocation.AUTHORIZED) {
        setTimeout(function() {
            var showSettings = confirm('App requires location tracking permission. Would you like to open app settings?');
            if (showSettings) {
              return BackgroundGeolocation.showAppSettings();
            }
        }, 1000);
    }
});

BackgroundGeolocation.on('http_authorization', () => {
    console.log('[INFO] App needs to authorize the http requests');
});

BackgroundGeolocation.checkStatus(function(status) {
    console.log('[INFO] BackgroundGeolocation service is running', status.isRunning);
    console.log('[INFO] BackgroundGeolocation services enabled', status.locationServicesEnabled);
    console.log('[INFO] BackgroundGeolocation auth status: ' + status.authorization);

    if (!status.isRunning) {
        BackgroundGeolocation.start(); //triggers start on start event
    }
});

Improve documentation around android background location posting

As it currently stands on Android, the plug-in does not execute the callback function in JS when the location changes while the app is in the background/the phone is locked.
The only way that the plug-in can communicate location changes to an API/server is through the http posting functionality.

This is different to the behaviour on iOS, where the callback function is called, allowing the app to post, even when in the background.

This needs to be communicated better in the documentation, as it is not clear.

Android 12 issues

Describe the bug
Location is not working well for android 12.
I'm still not sure what and why and this requires more investigation.
The only lead I have is this article:
https://developer.android.com/training/location/permissions#approximate-request

To Reproduce
Not sure...

Expected behavior
GPS should work

Desktop (please complete the following information):

  • OS: [e.g. iOS] android 12

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6] pixel 4a

Send data doesn't work

Description:
I'm trying to send the coordinates to my backend in the background, but it doesn't do anything
The background tracking works properly but the plugin doesn't send the coordinates with the configuration
This is my config
image

This is my background subscription
image

Expected behavior
Send each location to the backend even in the background

Smartphone (please complete the following information):

  • Huawei Y5 2019

Additional context
If anyone can help me, I really appreciate it

Send data every 30 Seconds(or X seconds)

Describe the bug
i want to sent the location data even in foreground or in background in every 30 seconds. i tried to set the Interval and fastest interval to 30000 but still the data sending before the given second. anyone have an idea to fix this?

Move documentation to GitHub Pages

It would be good to get the rather long README.md and other docs into a better layout, probably using GitHub pages.

The README.md should just include a quick intro, relevant details on installing and quick setup. Any further details should be broken out into their own documents.

We should make a FAQ too - there's a few things in the README.md that would make FAQ points.

Cannot use the plugin in iOS

Describe the bug
It's not really a bug but more a help request. I'm switching from the mauron plugin to this new version and managed to make it work on android. When I try to run it on iOS I'm not able to find the plugin in any variable and therefore use it. I'm quite sure I'm doing something wrong but I cannot find out why

What I have done
I am using Ionic v4. Since the plugin does not have the ionic-native support yet I tried to initialize it using
declare var BackgroundGeolocation: BackgroundGeolocationPlugin; and then using the BackgroundGeolovation variable inside my code. Unfortunately this seems to work only on android and I don't understand why it does not work in iOS. Every test I made resulted in a "cannot find function of undefined" error

Expected behavior
As in android I would like to have the BackgroundGeolocation global variable available to use with all the plugin functions but I cannot find it

Smartphone (please complete the following information):

  • Device: iPhone 8 Plus Simulator
  • OS: iOS 14.5
  • Plugin version 1.1.0

Additional context
By the way, great work!

Background Geolocation Tracking joins immediately to Stationary mode

Describe the bug
The tracking is always going to stationary mode even while I'm moving and never goes out.
To Reproduce
Steps to reproduce the behavior:

  1. This is my configuration:
    image
    I set up stationaryRadius, distanceFilter to 0 for always tracking the location
    Stationary listener
    image
    Location listener
    image
    While tracking is started
    stationary
    Expected behavior
    Tracking location properly

Smartphone (please complete the following information):

  • Huawei Y5 2019- Android 9
  • Redmi note 9 - Android 11

I really appreciate any help

Missing org.apache.http.legacy library dependency

Describe the bug
On a fresh install of the plugin, android builds fail with the error:
error: package org.apache.http does not exist import org.apache.http.HttpResponse etc.

This is due to a missing library dependency.

To Reproduce
Steps to reproduce the behavior:

  1. Install the plugin in a cordova project
  2. Build for android
  3. See error

Expected behavior
The plugin registers all required dependencies on install.

Additional context
The app's AndroidManifest.xml requires the following to be added:
<uses-library android:name="org.apache.http.legacy" android:required="true" />

The app's build.gradle requires the following to be added:
useLibrary 'org.apache.http.legacy'

Add promises and subscription to js interface

I'm not sure how this is done, but most of the plugins has a nice Ionic Native wrapper which helps using them and works in promises and modern stuff.
I would like this plugin to enjoy this support, I'm not familiar with the Ionic Native process in order to make this work, I guess we'll need to learn...
Adding this as a place holder for future improvements.

Android notification

Describe the bug
Remove the android notification

To Reproduce
Steps to reproduce the behavior:
Install the app in android and set it in background. You can see a notification of the app that running in background
Expected behavior
Remove this notification

Additional context
I tried to startForeground value false still it shows the notification

Issue with firebase plugin compatibility

Describe the bug

Tried using this plugin along side of the https://github.com/dpa99c/cordova-plugin-firebasex plugin and I get this error and the build fails:

Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.

To Reproduce
Steps to reproduce the behavior:

  1. Install this plugin with https://github.com/dpa99c/cordova-plugin-firebasex plugin
  2. Try to build the app
  3. build fails
  4. See error: Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.

Expected behavior
App needs to be built without any issue.

Screenshots
N/A

Background location doesn't work in Android >= 10 (API level 29)

Describe the bug
Background location updates are blocked on Android >=10 (API level 29) due to missing permissions.

Expected behavior
The plugin should include the permissions necessary to enable background location tracking on Android >=10 (API level 29).

According to the docs, the plugin must include the ACCESS_BACKGROUND_LOCATION permission.

[Feature] Transaction-based access to the GPS positions buffer

See here: IsraelHikingMap/Site#1427

When using the locations buffer to get the location from the plugin and after that deleting the location buffer it might get to a race condition where the delete happens after a location was added or that getting all location will happen before all locations were deleted.

Your Environment

  • Plugin version: 1.0
  • Platform: Android (observed there but might be on iOS too)
  • OS version: 9
  • Device manufacturer and model: An old tablet
  • Cordova version (cordova -v): 10.0
  • Cordova platform version (cordova platform ls): Android 9.1
  • Plugin configuration options: Not so relevant
  • Link to your project: See issue above for a link to the project

Context

Problem in getting GPS positions while the app is going back and forth from the background

Expected Behavior

Allow the app not to miss or duplicate positions

Actual Behavior

Positions are duplicated or missed

Possible Fix

Add an API method to do both get and delete

Steps to Reproduce

  1. Hard to say, but using the get locations and then right after the delete locations

Context

See screen shot in linked issue

Debug logs

Not available

[Android] Fresh install fails on resources (icon) not found

Describe the bug
When adding the plugin to a cordova project the android build fails due to missing icon

To Reproduce
Steps to reproduce the behavior:
cordova plugin add <this plugin>
cordova build android

Expected behavior
Should work

Desktop (please complete the following information):

  • OS: [Android]

Additional context
changing the @mipmap/icon to @mipmap/ic_launcher solves this issue.
Might be only my environment though, not sure, but it's not a great developer experience.
Also the icon that exists is a default one and not the app icon.
The build has warnings.

I would like to address all these issues related to icon definition in this issue, either by documentation or by proper cordova intallation/build code.

Error in plugin_bgloc_content_authority

I have a giant error that I can't do make project, when I try it, it gives me the following error:

ERROR:D:\Projects\vitarrico\vitaricoapp\android\app\build\intermediates\packaged_manifests\debug\AndroidManifest.xml:98: AAPT: error: resource string/plugin_bgloc_content_authority (aka com.venetronic.vitarrico:string/plugin_bgloc_content_authority) not found.

It is an application made in Ionic 3
Then add the plugin and try to compile with android studio and capacitor.

I will add my json package and my gradle
build.grandle

apply plugin: 'com.android.application' android { compileSdkVersion rootProject.ext.compileSdkVersion defaultConfig { applicationId "com.venetronic.vitarrico" minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion versionCode 1 versionName "1.0" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" aaptOptions { // Files and dirs to omit from the packaged assets dir, modified to accommodate modern web apps. // Default: https://android.googlesource.com/platform/frameworks/base/+/282e181b58cf72b6ca770dc7ca5f91f135444502/tools/aapt/AaptAssets.cpp#61 ignoreAssetsPattern '!.svn:!.git:!.ds_store:!*.scc:.*:!CVS:!thumbs.db:!picasa.ini:!*~' } } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } } repositories { flatDir{ dirs '../capacitor-cordova-android-plugins/src/main/libs', 'libs' } } dependencies { implementation fileTree(include: ['*.jar'], dir: 'libs') implementation "androidx.appcompat:appcompat:$androidxAppCompatVersion" implementation project(':capacitor-android') testImplementation "junit:junit:$junitVersion" androidTestImplementation "androidx.test.ext:junit:$androidxJunitVersion" androidTestImplementation "androidx.test.espresso:espresso-core:$androidxEspressoCoreVersion" implementation project(':capacitor-cordova-android-plugins') } apply from: 'capacitor.build.gradle' try { def servicesJSON = file('google-services.json') if (servicesJSON.text) { apply plugin: 'com.google.gms.google-services' } } catch(Exception e) { logger.info("google-services.json not found, google-services plugin not applied. Push Notifications won't work") }

package json
{ "name": "Vitarico", "version": "0.1.32", "author": "Venetronic", "homepage": "http://ionicframework.com/", "private": true, "scripts": { "start": "ionic-app-scripts serve", "clean": "ionic-app-scripts clean", "build": "ionic-app-scripts build", "lint": "ionic-app-scripts lint" }, "dependencies": { "@angular/animations": "5.2.11", "@angular/common": "5.2.11", "@angular/compiler": "5.2.11", "@angular/compiler-cli": "^8.2.10", "@angular/core": "5.2.11", "@angular/forms": "5.2.11", "@angular/http": "5.2.11", "@angular/platform-browser": "5.2.11", "@angular/platform-browser-dynamic": "5.2.11", "@auth0/angular-jwt": "1.2.0", "@capacitor/android": "3.3.3", "@capacitor/app": "1.0.7", "@capacitor/core": "3.3.3", "@capacitor/haptics": "1.1.3", "@capacitor/keyboard": "1.2.0", "@capacitor/status-bar": "1.0.6", "@ionic-native/android-permissions": "^4.7.0", "@ionic-native/background-geolocation": "^4.20.0", "@ionic-native/background-mode": "^4.20.0", "@ionic-native/barcode-scanner": "~4.17.0", "@ionic-native/camera": "~4.17.0", "@ionic-native/core": "~4.18.0", "@ionic-native/diagnostic": "^4.20.0", "@ionic-native/file": "~4.17.0", "@ionic-native/file-path": "~4.17.0", "@ionic-native/file-transfer": "~4.17.0", "@ionic-native/geolocation": "~4.17.0", "@ionic-native/onesignal": "^4.20.0", "@ionic-native/splash-screen": "~4.18.0", "@ionic-native/status-bar": "~4.18.0", "@ionic/pro": "2.0.4", "@ionic/storage": "2.2.0", "chart.js": "^2.7.3", "cordova-android": "9.1.0", "cordova-background-geolocation-plugin": "^1.1.0", "cordova-browser": "5.0.4", "cordova-plugin-camera": "^4.0.3", "cordova-plugin-device": "^2.0.2", "cordova-plugin-file": "^6.0.1", "cordova-plugin-file-transfer": "^1.7.1", "cordova-plugin-geolocation": "^4.0.1", "cordova-plugin-ionic-keyboard": "^2.1.3", "cordova-plugin-ionic-webview": "^3.1.2", "cordova-plugin-splashscreen": "^5.0.2", "cordova-plugin-statusbar": "^2.4.2", "cordova-plugin-whitelist": "^1.3.3", "cordova.plugins.diagnostic": "4.0.12", "ionic-angular": "3.9.3", "ionicons": "3.0.0", "rxjs": "5.5.11", "sw-toolbox": "3.6.0", "zone.js": "0.8.29" }, "devDependencies": { "@capacitor/cli": "3.3.3", "@ionic/app-scripts": "^3.2.4", "cordova-plugin-android-permissions": "^1.1.3", "typescript": "~2.6.2" }, "description": "An Ionic project", "cordova": { "plugins": { "cordova-plugin-geolocation": { "GPS_REQUIRED": "true" }, "cordova-plugin-whitelist": {}, "cordova-plugin-statusbar": {}, "cordova-plugin-device": {}, "cordova-plugin-splashscreen": {}, "cordova-plugin-ionic-webview": { "ANDROID_SUPPORT_ANNOTATIONS_VERSION": "27.+" }, "cordova-plugin-ionic-keyboard": {}, "cordova-plugin-file-transfer": {}, "onesignal-cordova-plugin": {}, "cordova.plugins.diagnostic": { "ANDROID_SUPPORT_VERSION": "28.+" }, "cordova-plugin-android-permissions": {} }, "platforms": [ "browser", "android" ] } }

Can someone guide me what can I do?

Support AndroidX

Feature Request

Seems that most updated plugins support AndroidX.
As far as I understand this is a breaking change in terms of the plugin (meaning you either support the old way or the new way) so I would avoid this change in a minor release.
I'm still not sure what needs to be done in order to support this and what's the status of the other community plugins. If most modern plugins already support this then it should be a high priority for next major release, but if not then it can wait.
I currently don't use AndroidX in my project since I think not all the plugins support this, but I need to check...

Pluggin dont work

cordova -version
11.0.0

Installed platforms:
android 10.1.2

cordova-background-geolocation-plugin 2.0.4 "cordova-background-geolocation-plugin"

The program ask for permision for geolocation, but never give a event of location.

===========================
index.js
function onDeviceReady() {
BackgroundGeolocation.configure({
locationProvider: BackgroundGeolocation.ACTIVITY_PROVIDER,
desiredAccuracy: BackgroundGeolocation.HIGH_ACCURACY,
stationaryRadius: 50,
distanceFilter: 50,
notificationTitle: "Background tracking",
notificationText: "enabled",
debug: true,
interval: 10000,
fastestInterval: 5000,
activitiesInterval: 10000,
url: "http://192.168.81.15:3000/location",
httpHeaders: {
"X-FOO": "bar",
},
// customize post properties
postTemplate: {
lat: "@latitude",
lon: "@longitude",
foo: "bar", // you can also add your own properties
},
});

BackgroundGeolocation.on("location", function (location) {
// handle your locations here
// to perform long running operation on iOS
// you need to create background task
console.log('localizado');
BackgroundGeolocation.startTask(function (taskKey) {
// execute long running task
// eg. ajax post location
// IMPORTANT: task has to be ended by endTask
BackgroundGeolocation.endTask(taskKey);
});
});

BackgroundGeolocation.on("stationary", function (stationaryLocation) {
// handle stationary locations here
});

BackgroundGeolocation.on("error", function (error) {
console.log(
"[ERROR] BackgroundGeolocation error:",
error.code,
error.message
);
});

BackgroundGeolocation.on("start", function () {
console.log("[INFO] BackgroundGeolocation service has been started");
});

BackgroundGeolocation.on("stop", function () {
console.log("[INFO] BackgroundGeolocation service has been stopped");
});

BackgroundGeolocation.on("authorization", function (status) {
console.log("[INFO] BackgroundGeolocation authorization status: " + status);
if (status !== BackgroundGeolocation.AUTHORIZED) {
// we need to set delay or otherwise alert may not be shown
setTimeout(function () {
var showSettings = confirm(
"App requires location tracking permission. Would you like to open app settings?"
);
if (showSettings) {
return BackgroundGeolocation.showAppSettings();
}
}, 1000);
}
});

BackgroundGeolocation.on("background", function () {
console.log("[INFO] App is in background");
// you can also reconfigure service (changes will be applied immediately)
BackgroundGeolocation.configure({ debug: true });
});

BackgroundGeolocation.on("foreground", function () {
console.log("[INFO] App is in foreground");
BackgroundGeolocation.configure({ debug: false });
});

BackgroundGeolocation.on("abort_requested", function () {
console.log("[INFO] Server responded with 285 Updates Not Required");

// Here we can decide whether we want stop the updates or not.
// If you've configured the server to return 285, then it means the server does not require further update.
// So the normal thing to do here would be to `BackgroundGeolocation.stop()`.
// But you might be counting on it to receive location updates in the UI, so you could just reconfigure and set `url` to null.

});

BackgroundGeolocation.on("http_authorization", () => {
console.log("[INFO] App needs to authorize the http requests");
});

BackgroundGeolocation.checkStatus(function (status) {
console.log(
"[INFO] BackgroundGeolocation service is running",
status.isRunning
);
console.log(
"[INFO] BackgroundGeolocation services enabled",
status.locationServicesEnabled
);
console.log(
"[INFO] BackgroundGeolocation auth status: " + status.authorization
);

// you don't need to check status before start (this is just the example)
if (!status.isRunning) {
  BackgroundGeolocation.start(); //triggers start on start event
}

});

// you can also just start without checking for status
// BackgroundGeolocation.start();

// Don't forget to remove listeners at some point!

// BackgroundGeolocation.removeAllListeners();
console.log("Running cordova-" + cordova.platformId + "@" + cordova.version);
document.getElementById("deviceready").classList.add("ready");

}

document.addEventListener("deviceready", onDeviceReady, false);

Clearer documentation of what this plugin provides or does better than Transistorsoft

Is your feature request related to a problem? Please describe.
Nice work on this plugin! I'd like to get a better idea of what developers stand to gain by using this plugin instead of the one by Transistorsoft. The README only has this line:

It is more battery and data efficient than html5 geolocation or cordova-geolocation plugin...

Transistorsoft claim that their plugin is the best one available, so I'd like to know some more about what this fork has improved upon.

Describe the solution you'd like
A discussion in this thread, and ultimately an update to the README of this plugin describing the improvements.

Remove old/stale branches

Remove old/stale branches (like 1.x-stable, and features/telephony) from the repo, as they could be confusing, especially in the case of the 1.x-stable and 2.0.

Use Github actions to automate npm publish

I'm still new to this, so I might need a little help here but it would be extremely helpful if we could automate testing and releasing of npm packages by using Github actions.

The way I see it:
If we create a tag on master branch it will create an npm package with the relevant tag
On any commit to master tests and lint will run (assuming there are tests and lint is defined)

The first one is the most important from my point of view to reduce manual work that tends to be error prone...

Update notification while service is running

Description
As we well know, currently if we use the service in the background, it requires a permanent notification. It is possible that the message that one sets in the notification can be updated in real time.

I attach example images of what I need to do

Description of images 1.- Service started, shows type of activity, time and miles traveled, with button to stop 2.- Service stopped, shows type of activity, time and miles traveled, with button to resume 3.- Service started, but the notification is minimized

please apply this fix to IOS file /ios/common/BackgroundGeolocation/MAURConfig.m

hi teams,
there is a bug in this file

/ios/common/BackgroundGeolocation/MAURConfig.m

which is causing incorrect permissions to be asked under IOS

please change the below lines

if ([activityType caseInsensitiveCompare:@"AutomotiveNavigation"]) {
return CLActivityTypeAutomotiveNavigation;
}
if ([activityType caseInsensitiveCompare:@"OtherNavigation"]) {
return CLActivityTypeOtherNavigation;
}
if ([activityType caseInsensitiveCompare:@"Fitness"]) {
return CLActivityTypeFitness;
}

to

if ([activityType caseInsensitiveCompare:@"AutomotiveNavigation"] == NSOrderedSame) {
return CLActivityTypeAutomotiveNavigation;
}
if ([activityType caseInsensitiveCompare:@"OtherNavigation"] == NSOrderedSame) {
return CLActivityTypeOtherNavigation;
}
if ([activityType caseInsensitiveCompare:@"Fitness"] == NSOrderedSame) {
return CLActivityTypeFitness;
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.