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

Fixed VERSIONS getApplicationId #56

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
Background Geolocation for Android
# Background Geolocation for Android

[![CircleCI](https://circleci.com/gh/mauron85/background-geolocation-android/tree/master.svg?style=shield)](https://circleci.com/gh/mauron85/background-geolocation-android/tree/master)
### Updated with some PRs not merged on original package:

-> [Always allow permission for android 10](https://github.com/mauron85/background-geolocation-android/pull/52)

-> [Update AndroidManifest.xml for android 10](https://github.com/mauron85/background-geolocation-android/pull/51)

-> [Remove deprecated option android.enableUnitTestBinaryResources](https://github.com/mauron85/background-geolocation-android/pull/49)

-> [Fix Android10 hasMockLocationsEnabled()](https://github.com/mauron85/background-geolocation-android/pull/46)

used by:

* [react-native-background-geolocation](https://github.com/mauron85/react-native-background-geolocation)
- [react-native-background-geolocation](https://github.com/mauron85/react-native-background-geolocation)

* [cordova-plugin-background-geolocation](https://github.com/mauron85/cordova-plugin-background-geolocation)
- [cordova-plugin-background-geolocation](https://github.com/mauron85/cordova-plugin-background-geolocation)
4 changes: 2 additions & 2 deletions VERSIONS.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ def RESOURCE_PREFIX = "mauron85_bgloc_"
ext {
getApplicationId = { ->
def applicationId = "com.marianhello.app"
if (findProject('..:app') != null) {
if (findProject('..:app') != null && project('..:app').hasProperty('android')) {
applicationId = project('..:app').android.defaultConfig.applicationId
} else if (findProject(':app') != null) {
} else if (findProject(':app') != null && project(':app').hasProperty('android')) {
applicationId = project(':app').android.defaultConfig.applicationId
}
if (rootProject.hasProperty('applicationId')) {
Expand Down
1 change: 0 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
android.enableUnitTestBinaryResources=true
android.builder.sdkDownload=true
6 changes: 5 additions & 1 deletion src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,11 @@
android:authorities="@string/mauron85_bgloc_content_authority"
android:exported="false"
android:syncable="true"/>
<service android:enabled="true" android:exported="false" android:name="com.marianhello.bgloc.service.LocationServiceImpl" />
<service
android:foregroundServiceType="location"
android:enabled="true"
android:exported="false"
android:name="com.marianhello.bgloc.service.LocationServiceImpl" />
<receiver android:enabled="true" android:exported="true" android:name="com.marianhello.bgloc.BootCompletedReceiver">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ public class BackgroundGeolocationFacade {

public static final String[] PERMISSIONS = {
Manifest.permission.ACCESS_COARSE_LOCATION,
Manifest.permission.ACCESS_FINE_LOCATION
Manifest.permission.ACCESS_FINE_LOCATION,
Manifest.permission.ACCESS_BACKGROUND_LOCATION
};

private boolean mServiceBroadcastReceiverRegistered = false;
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/com/marianhello/bgloc/LocationManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ public class LocationManager {

public static final String[] PERMISSIONS = {
Manifest.permission.ACCESS_COARSE_LOCATION,
Manifest.permission.ACCESS_FINE_LOCATION
Manifest.permission.ACCESS_FINE_LOCATION,
Manifest.permission.ACCESS_BACKGROUND_LOCATION
};

private LocationManager(Context context) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import android.content.IntentFilter;
import android.location.Location;
import android.media.AudioManager;
import android.os.Build;
import android.provider.Settings;
import android.widget.Toast;

Expand Down Expand Up @@ -155,7 +156,7 @@ protected void showDebugToast (String text) {
}

public Boolean hasMockLocationsEnabled() {
return Settings.Secure.getString(mContext.getContentResolver(), android.provider.Settings.Secure.ALLOW_MOCK_LOCATION).equals("1");
return Build.VERSION.SDK_INT < Build.VERSION_CODES.M && Settings.Secure.getString(mContext.getContentResolver(), android.provider.Settings.Secure.ALLOW_MOCK_LOCATION).equals("1");
}

/**
Expand Down