Skip to content

Commit

Permalink
Add support for AndroidX (#49)
Browse files Browse the repository at this point in the history
* Set theme jekyll-theme-hacker

* Update Changelog

* docs: move to github pages (#35)

Fixes #32

* Update Changelog

* Adds promises and subscription (#36)

Resolves #16 

* Add promises and subscription to js interface #16 - initial commit

* #16 - fix subscriable interface

* bump version, fix docs

* fix incorrect link

* Update Changelog

* Support AndroidX #15 - main commit

* Bump version, update readme.

Co-authored-by: Adam Radestock <[email protected]>
Co-authored-by: RaddishIoW <[email protected]>
Co-authored-by: HarelM <[email protected]>
  • Loading branch information
4 people authored Oct 1, 2021
1 parent 3a7346f commit 7fd6f94
Show file tree
Hide file tree
Showing 28 changed files with 58 additions and 64 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ The NPM package can be found at [cordova-background-geolocation-plugin](https://

### Installing the plugin

**Note:** for non AndroidX project please use version 1.x of this plugin. Version 2.x and on will support AndroidX.

```bash
cordova plugin add cordova-background-geolocation-plugin
```
Expand All @@ -37,7 +39,6 @@ You may also want to change default iOS permission prompts and set specific goog
```bash
cordova plugin add cordova-background-geolocation-plugin \
--variable GOOGLE_PLAY_SERVICES_VERSION=11+ \
--variable ANDROID_SUPPORT_LIBRARY_VERSION=26+ \
--variable ALWAYS_USAGE_DESCRIPTION="App requires ..." \
--variable MOTION_USAGE_DESCRIPTION="App requires motion detection"
```
Expand Down
2 changes: 1 addition & 1 deletion android/CDVBackgroundGeolocation/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ android {
buildToolsVersion project.ext.getBuildToolsVersion()

defaultConfig {
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
minSdkVersion project.ext.getMinSdkVersion()
targetSdkVersion project.ext.getTargetSdkVersion()
versionCode 1
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.evgenii.jsevaluator;

import android.content.Context;
import android.support.annotation.VisibleForTesting;
import androidx.annotation.VisibleForTesting;
import android.webkit.WebView;

import com.evgenii.jsevaluator.interfaces.CallJavaResultInterface;
Expand Down
2 changes: 1 addition & 1 deletion android/common/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ android {
resValue "string", resourcePrefix + "account_name", 'Locations'
resValue "string", resourcePrefix + "account_type", accountPrefix + '.account'
resValue "string", resourcePrefix + "content_authority", accountPrefix + '.provider'
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
minSdkVersion project.ext.getMinSdkVersion()
versionCode 1
versionName "1.0"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.marianhello.bgloc;

import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.ext.junit.runners.AndroidJUnit4;

import com.marianhello.bgloc.data.BackgroundLocation;
import com.marianhello.bgloc.provider.TestLocationProviderFactory;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import android.support.test.filters.SmallTest;
import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import androidx.test.filters.SmallTest;
import android.util.JsonReader;
import android.util.JsonToken;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import java.util.Collection;
import java.util.Iterator;

import static android.support.test.InstrumentationRegistry.getContext;
import static androidx.test.platform.app.InstrumentationRegistry.getContext;
import static com.marianhello.bgloc.data.sqlite.SQLiteLocationContract.LocationEntry.SQL_DROP_LOCATION_TABLE;
import static junit.framework.Assert.assertEquals;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package com.marianhello.bgloc;

import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import android.support.test.filters.SmallTest;
import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import androidx.test.filters.SmallTest;

import com.marianhello.logging.DBLogReader;
import com.marianhello.logging.LogEntry;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,17 @@
import android.content.IntentFilter;
import android.os.Bundle;
import android.os.IBinder;
import android.support.test.InstrumentationRegistry;
import android.support.test.rule.ServiceTestRule;
import android.support.test.runner.AndroidJUnit4;
import android.support.v4.content.LocalBroadcastManager;
import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.rule.ServiceTestRule;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import androidx.localbroadcastmanager.content.LocalBroadcastManager;

import com.marianhello.bgloc.provider.TestLocationProviderFactory;
import com.marianhello.bgloc.service.LocationServiceImpl;
import com.marianhello.bgloc.service.LocationServiceIntentBuilder;
import com.marianhello.bgloc.service.LocationServiceProxy;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
import android.location.Location;
import android.os.Bundle;
import android.os.IBinder;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.test.InstrumentationRegistry;
import android.support.test.rule.ServiceTestRule;
import android.support.test.runner.AndroidJUnit4;
import android.support.v4.content.LocalBroadcastManager;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.rule.ServiceTestRule;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import androidx.localbroadcastmanager.content.LocalBroadcastManager;

import com.marianhello.bgloc.data.BackgroundLocation;
import com.marianhello.bgloc.provider.MockLocationProvider;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import android.support.test.filters.SmallTest;
import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import androidx.test.filters.SmallTest;

import com.marianhello.bgloc.Config;
import com.marianhello.bgloc.data.HashMapLocationTemplate;
import com.marianhello.bgloc.data.LocationTemplate;
import com.marianhello.bgloc.data.LocationTemplateFactory;
Expand All @@ -24,7 +23,6 @@

import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashSet;

/**
* Created by finch on 13/07/16.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.location.Location;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import android.support.test.filters.SmallTest;
import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import androidx.test.filters.SmallTest;

import com.marianhello.bgloc.data.BackgroundLocation;
import com.marianhello.bgloc.data.sqlite.SQLiteLocationDAO;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.location.Location;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import android.support.test.filters.SmallTest;
import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import androidx.test.filters.SmallTest;

import com.marianhello.bgloc.data.BackgroundLocation;
import com.marianhello.bgloc.data.sqlite.SQLiteLocationDAO;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.location.Location;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import android.support.test.filters.SmallTest;
import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import androidx.test.filters.SmallTest;

import com.marianhello.bgloc.data.BackgroundLocation;
import com.marianhello.bgloc.data.sqlite.SQLiteConfigurationContract;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
import android.os.Bundle;
import android.provider.Settings;
import android.provider.Settings.SettingNotFoundException;
import android.support.v4.content.ContextCompat;
import android.support.v4.content.LocalBroadcastManager;
import androidx.core.content.ContextCompat;
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import android.text.TextUtils;

import com.github.jparkie.promise.Promise;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import android.os.Bundle;
import android.os.Parcel;
import android.os.Parcelable;
import android.support.annotation.Nullable;
import androidx.annotation.Nullable;

import com.marianhello.bgloc.data.AbstractLocationTemplate;
import com.marianhello.bgloc.data.LocationTemplate;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@
import android.os.Bundle;
import android.os.Parcel;
import android.os.Parcelable;
import android.support.v4.util.TimeUtils;
import androidx.core.util.TimeUtils;

import com.marianhello.bgloc.data.sqlite.SQLiteLocationContract;
import com.marianhello.bgloc.data.sqlite.SQLiteLocationContract.LocationEntry;

import org.json.JSONException;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
package com.marianhello.bgloc.data;

import android.content.Context;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;

import com.marianhello.bgloc.data.BackgroundLocation;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

public interface LocationTransform
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
import android.os.Looper;
import android.os.Message;
import android.os.Process;
import android.support.annotation.Nullable;
import android.support.v4.content.LocalBroadcastManager;
import androidx.annotation.Nullable;
import androidx.localbroadcastmanager.content.LocalBroadcastManager;

import com.marianhello.bgloc.Config;
import com.marianhello.bgloc.ConnectivityListener;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import android.content.Intent;
import android.os.Bundle;
import android.os.Parcelable;
import android.support.annotation.IntDef;
import androidx.annotation.IntDef;

import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
import android.graphics.BitmapFactory;
import android.graphics.Color;
import android.os.Build;
import android.support.annotation.RequiresApi;
import android.support.v4.app.NotificationCompat;
import androidx.annotation.RequiresApi;
import androidx.core.app.NotificationCompat;

import com.marianhello.bgloc.ResourceResolver;
import com.marianhello.logging.LoggerManager;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.support.v4.app.NotificationCompat;
import android.support.v4.content.LocalBroadcastManager;
import androidx.core.app.NotificationCompat;
import androidx.localbroadcastmanager.content.LocalBroadcastManager;

import com.marianhello.bgloc.Config;
import com.marianhello.bgloc.HttpPostService;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.marianhello.backgroundgeolocation;

import android.os.Build;
import android.support.test.filters.SmallTest;
import androidx.test.filters.SmallTest;

import com.marianhello.bgloc.data.BackgroundLocation;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.marianhello.backgroundgeolocation;

import android.support.test.filters.SmallTest;
import androidx.test.filters.SmallTest;

import com.marianhello.bgloc.Config;
import com.marianhello.bgloc.data.ArrayListLocationTemplate;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.marianhello.backgroundgeolocation;

import android.support.test.filters.SmallTest;
import androidx.test.filters.SmallTest;

import com.marianhello.logging.DBLogReader;

Expand Down
4 changes: 3 additions & 1 deletion android/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,6 @@
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
# org.gradle.parallel=true
android.enableJetifier=true
android.useAndroidX=true
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cordova-background-geolocation-plugin",
"version": "1.1.0",
"version": "2.0.0",
"description": "Cordova Background Geolocation Plugin",
"main": "./www/BackgroundGeolocation.js",
"types": "./www/BackgroundGeolocation.d.ts",
Expand Down
5 changes: 2 additions & 3 deletions plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
<!-- android -->
<platform name="android">
<preference name="GOOGLE_PLAY_SERVICES_VERSION" default="11+"/>
<preference name="ANDROID_SUPPORT_LIBRARY_VERSION" default="26+"/>
<preference name="ICON" default="@mipmap/ic_launcher" />
<preference name="SMALL_ICON" default="@mipmap/ic_launcher" />
<preference name="ACCOUNT_NAME" default="@string/app_name" />
Expand All @@ -34,8 +33,8 @@
<preference name="CONTENT_AUTHORITY" default="$PACKAGE_NAME" />

<framework src="com.google.android.gms:play-services-location:$GOOGLE_PLAY_SERVICES_VERSION" />
<framework src="com.android.support:support-v4:$ANDROID_SUPPORT_LIBRARY_VERSION" />
<framework src="com.android.support:appcompat-v7:$ANDROID_SUPPORT_LIBRARY_VERSION" />
<framework src="androidx.core:core:1.1.0" />
<framework src="androidx.appcompat:appcompat:1.1.0" />
<framework src="android/dependencies.gradle" custom="true" type="gradleReference"/>
<!-- Generated with gen_sources.sh @ 2019-09-24 08:28:46 -->
<source-file src="android/CDVBackgroundGeolocation/src/main/java/com/evgenii/jsevaluator/HandlerWrapper.java" target-dir="src/com/evgenii/jsevaluator" />
Expand Down

0 comments on commit 7fd6f94

Please sign in to comment.