Skip to content

Commit 4476701

Browse files
committed
[RELEASE] 3.2.0 with Android Q / iOS 13 and react-native 0.60 auto-linking support
1 parent f0456a1 commit 4476701

File tree

53 files changed

+337
-284
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+337
-284
lines changed

CHANGELOG.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,21 @@
11
# Change Log
22

3+
## [3.2.0] - 2019-08-16
4+
- [Added] iOS 13 support.
5+
- [Added] Auto-linking support. Do not use `react-native link` anymore. See the Setup docs for Android and iOS. Before installing `3.2.0`, first `react-native unlink` both `background-geolocation` and `background-fetch`.
6+
7+
:warning: If you have a previous version of **`react-native-background-geolocation-android < 3.2.0`** installed into **`react-native >= 0.60`**, you should first `unlink` your previous version as `react-native link` is no longer required.
8+
9+
```bash
10+
$ react-native unlink react-native-background-geolocation-android
11+
```
12+
13+
- [Fixed] Android Geofence `DWELL` transition (`notifyOnDwell: true`) not firing.
14+
- [Fixed] iOS `logMaxDays` was hard-coded to `7`; Config option not being respected.
15+
- [Added] Android `Q` support (API 29) with new iOS-like location permission model which now requests `When In Use` or `Always`. Android now supports the config option `locationAuthorizationRequest` which was traditionally iOS-only. Also, Android Q now requires runtime permission from user for `ACTIVITY_RECOGNITION`.
16+
- [Changed] Another Android tweak to mitigate against error `Context.startForegroundService() did not then call Service.startForeground()`.
17+
- [Added] Add new Android gradle config parameter `appCompatVersion` to replace `supportLibVersion` for better AndroidX compatibility. If `appCompatVersion` is not found, the plugin's gradle file falls back to `supportLibVersion`. For react-native@0.60, you should start using the new `appCompatVersion`.
18+
319
## [3.0.9] - 2019-07-06
420
[Changed] Implement `react-native.config.js` ahead of deprecated `rnpm` config.
521
- [Fixed] Added logic to detect when app is configured to use **AndroidX** dependencies, adjusting the required `appcompat` dependency accordingly. If the gradle config `ext.supportLibVersion` corresponds to an AndroidX version (eg: `1.0.0`), the plugin assumes AndroidX.

README.md

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,16 @@ The **[Android module](http://www.transistorsoft.com/shop/products/react-native-
4242

4343
## :large_blue_diamond: Installing the Plugin
4444

45+
-------------------------------------------------------------
46+
47+
:warning: If you have a previous version of **`react-native-background-geolocation < 3.2.0`** installed into **`react-native >= 0.60`**, you should first `unlink` your previous version as `react-native link` is no longer required.
48+
49+
```bash
50+
$ react-native unlink react-native-background-geolocation
51+
```
52+
53+
-------------------------------------------------------------
54+
4555
### With `yarn`
4656

4757
```bash
@@ -55,14 +65,26 @@ $ npm install react-native-background-geolocation --save
5565

5666
## :large_blue_diamond: Setup Guides
5767

58-
:warning: For `react-native >= 0.60.0`, use **only** `react-native link` Setup. :warning:
68+
## iOS
69+
70+
### `react-native >= 0.60`
71+
72+
- [Auto-linking Setup](help/INSTALL-IOS-AUTO.md)
73+
74+
### `react-native < 0.60`
5975

60-
### iOS
6176
- [`react-native link` Setup](help/INSTALL-IOS-RNPM.md) (**recommended**)
6277
- [Cocoapods](help/INSTALL-IOS-COCOAPODS.md)
6378
- [Manual Setup](help/INSTALL-IOS.md)
6479

65-
### Android
80+
## Android
81+
82+
### `react-native >= 0.60`
83+
84+
- [Auto-linking Setup](help/INSTALL-ANDROID-AUTO.md)
85+
86+
### `react-native < 0.60`
87+
6688
* [`react-native link` Setup](help/INSTALL-ANDROID-RNPM.md) (**recommended**)
6789
* [Manual Setup](help/INSTALL-ANDROID.md)
6890

android/app.gradle

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
2+
android {
3+
purgeBackgroundGeolocationDebugResources(applicationVariants)
4+
}
5+
6+
/**
7+
* Background Geolocation's aar includes about 1.5M of mp3 sound-files for its debugging sound FX.
8+
* This method strips those mp3s out in RELEASE builds.
9+
*/
10+
def purgeBackgroundGeolocationDebugResources(applicationVariants) {
11+
if ((rootProject.ext.has("removeBackgroundGeolocationDebugSoundsInRelease")) && (rootProject.ext.removeBackgroundGeolocationDebugSoundsInRelease == false)) return
12+
applicationVariants.all { variant ->
13+
if (variant.buildType.name == "release") {
14+
println("[react-native-background-geolocation] Purging debug resources in release build")
15+
variant.mergeResourcesProvider.configure {
16+
doLast {
17+
delete(fileTree(dir: outputDir, includes: ["raw_tslocationmanager*"]))
18+
}
19+
}
20+
}
21+
}
22+
}

android/build.gradle

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,13 @@ apply plugin: 'com.android.library'
33
// Android dependencies
44
def DEFAULT_COMPILE_SDK_VERSION = 28
55
def DEFAULT_TARGET_SDK_VERSION = 28
6-
def DEFAULT_SUPPORT_LIB_VERSION = "28.0.0"
6+
def DEFAULT_APP_COMPAT_VERSION = "28.0.0"
77

88
// Plugin dependencies
99
def DEFAULT_GOOGLE_PLAY_SERVICES_LOCATION_VERSION = "17.0.0"
1010
def DEFAULT_OK_HTTP_VERSION = "3.12.1"
1111
def DEFAULT_ANDROID_PERMISSIONS_VERSION = "0.1.8"
1212
def DEFAULT_EVENTBUS_VERSION = "3.0.0"
13-
def DEFAULT_REMOVE_DEBUG_SOUNDS_IN_RELEASE = true
1413

1514
def safeExtGet(prop, fallback) {
1615
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
@@ -25,9 +24,6 @@ android {
2524
versionCode 1
2625
versionName "1.0"
2726
}
28-
29-
// TODO
30-
def removeDebugSounds = safeExtGet('removeBackgroundGeolocationDebugSoundsInRelase', DEFAULT_REMOVE_DEBUG_SOUNDS_IN_RELEASE)
3127
}
3228

3329
repositories{
@@ -37,20 +33,24 @@ repositories{
3733
}
3834

3935
dependencies {
40-
def supportLibVersion = safeExtGet('supportLibVersion', DEFAULT_SUPPORT_LIB_VERSION)
41-
def supportLibMajorVersion = supportLibVersion.split('\\.')[0] as int
42-
def appCompatLibName = (supportLibMajorVersion < 20) ? "androidx.appcompat:appcompat" : "com.android.support:appcompat-v7"
36+
// Prefer appCompatVersion vs supportLibVersion.
37+
def appCompatVersion = safeExtGet('appCompatVersion', safeExtGet('supportLibVersion', DEFAULT_APP_COMPAT_VERSION))
38+
39+
def appCompatMajorVersion = appCompatVersion.split('\\.')[0] as int
40+
def appCompatLibName = (appCompatMajorVersion < 20) ? "androidx.appcompat:appcompat" : "com.android.support:appcompat-v7"
4341
def playServicesLocationVersion = safeExtGet('googlePlayServicesLocationVersion', DEFAULT_GOOGLE_PLAY_SERVICES_LOCATION_VERSION)
4442
def okHttpVersion = safeExtGet('okHttpVersion', DEFAULT_OK_HTTP_VERSION)
4543
def androidPermissionsVersion = safeExtGet('androidPermissionsVersion', DEFAULT_ANDROID_PERMISSIONS_VERSION)
4644
def eventBusVersion = safeExtGet('eventBusVersion', DEFAULT_EVENTBUS_VERSION)
4745

4846
compileOnly 'com.facebook.react:react-native:+'
49-
implementation "$appCompatLibName:$supportLibVersion"
47+
// tslocationmanager.aar
48+
implementation fileTree(include: ['*.aar'], dir: 'libs')
49+
50+
implementation "$appCompatLibName:$appCompatVersion"
5051
implementation "com.google.android.gms:play-services-location:$playServicesLocationVersion"
5152
implementation "org.greenrobot:eventbus:$eventBusVersion"
5253
implementation "com.squareup.okhttp3:okhttp:$okHttpVersion"
53-
implementation(group: 'com.transistorsoft', name:'tslocationmanager', version: '+')
5454
implementation 'org.slf4j:slf4j-api:1.7.25'
5555
implementation 'com.github.tony19:logback-android:1.3.0-2'
5656
implementation "com.intentfilter:android-permissions:$androidPermissionsVersion"

android/libs/com/transistorsoft/tslocationmanager/3.0.22/tslocationmanager-3.0.22.aar.md5

Lines changed: 0 additions & 1 deletion
This file was deleted.

android/libs/com/transistorsoft/tslocationmanager/3.0.22/tslocationmanager-3.0.22.aar.sha1

Lines changed: 0 additions & 1 deletion
This file was deleted.

android/libs/com/transistorsoft/tslocationmanager/3.0.22/tslocationmanager-3.0.22.pom

Lines changed: 0 additions & 9 deletions
This file was deleted.

android/libs/com/transistorsoft/tslocationmanager/3.0.22/tslocationmanager-3.0.22.pom.md5

Lines changed: 0 additions & 1 deletion
This file was deleted.

android/libs/com/transistorsoft/tslocationmanager/3.0.22/tslocationmanager-3.0.22.pom.sha1

Lines changed: 0 additions & 1 deletion
This file was deleted.

android/libs/com/transistorsoft/tslocationmanager/maven-metadata.xml

Lines changed: 0 additions & 16 deletions
This file was deleted.

0 commit comments

Comments
 (0)