Skip to content

Commit 7b56adb

Browse files
committed
[RELEASE] 3.3.0
1 parent bb4aec5 commit 7b56adb

File tree

51 files changed

+485
-94
lines changed

Some content is hidden

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

51 files changed

+485
-94
lines changed

CHANGELOG.md

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

3+
## 3.3.0 - 2019-10-17
4+
- [Fixed] Android: Fixed issue executing `#changePace` immediately after `#start`.
5+
- [Fixed] Android: Add guard against NPR in `calculateMedianAccuracy`
6+
- [Added] Add new Geofencing methods: `#getGeofence(identifier)` and `#geofenceExists(identifier)`.
7+
- [Fixed] iOS issue using `disableMotionActivityUpdates: false` with `useSignificantChangesOnly: true` and `reset: true`. Plugin will accidentally ask for Motion Permission. Fixes #1992.
8+
- [Fixed] Resolved a number of Android issues exposed by booting the app in [StrictMode](https://developer.android.com/reference/android/os/StrictMode). This should definitely help alleviate ANR issues related to `Context.startForegroundService`.
9+
- [Added] Android now supports `disableMotionActivityUpdates` for Android 10 which now requires run-time permission for "Physical Activity". Setting to `true` will not ask user for this permission. The plugin will fallback to using the "stationary geofence" triggering, like iOS.
10+
- [Changed] Android: Ensure all code that accesses the database is performed in background-threads, including all logging (addresses `Context.startForegroundService` ANR issue).
11+
- [Changed] Android: Ensure all geofence event-handling is performed in background-threads (addresses `Context.startForegroundService` ANR issue).
12+
- [Added] Android: implement logic to handle operation without Motion API on Android 10. v3 has always used a "stationary geofence" like iOS as a fail-safe, but this is now crucial for Android 10 which now requires run-time permission for "Physical Activity". For those users who [Deny] this permission, Android will trigger tracking in a manner similar to iOS (ie: requiring movement of about 200 meters). This also requires handling to detect when the device has become stationary.
13+
314
## [3.2.2] - 2019-09-18
415
- [Changed] Android: move more location-handling code into background-threads to help mitigate against ANR referencing `Context.startForegroundService`
516
- [Changed] Android: If BackgroundGeolocation adapter is instantiated headless and is enabled, force ActivityRecognitionService to start.

android/src/main/java/com/transistorsoft/rnbackgroundgeolocation/RNBackgroundGeolocationModule.java

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ public void onHostResume() {
295295
public void onHostPause() {
296296
Context context = getReactApplicationContext();
297297
TSConfig config = TSConfig.getInstance(context);
298-
if (config.getEnabled() && config.getEnableHeadless() && !config.getStopOnTerminate()) {
298+
if (config.getEnabled()) {
299299
TSScheduleManager.getInstance(context).oneShot(TerminateEvent.ACTION, 10000);
300300
}
301301
}
@@ -700,6 +700,42 @@ public void getGeofences(final Callback success, final Callback failure) {
700700
});
701701
}
702702

703+
@ReactMethod
704+
public void getGeofence(String identifier, final Callback success, final Callback failure) {
705+
getAdapter().getGeofence(identifier, new TSGetGeofenceCallback() {
706+
@Override public void onSuccess(TSGeofence geofence) {
707+
try {
708+
WritableMap data = new WritableNativeMap();
709+
data.putString("identifier", geofence.getIdentifier());
710+
data.putDouble("latitude", geofence.getLatitude());
711+
data.putDouble("longitude", geofence.getLongitude());
712+
data.putDouble("radius", geofence.getRadius());
713+
data.putBoolean("notifyOnEntry", geofence.getNotifyOnEntry());
714+
data.putBoolean("notifyOnExit", geofence.getNotifyOnExit());
715+
data.putBoolean("notifyOnDwell", geofence.getNotifyOnDwell());
716+
data.putInt("loiteringDelay", geofence.getLoiteringDelay());
717+
if (geofence.getExtras() != null) {
718+
data.putMap("extras", jsonToMap(geofence.getExtras()));
719+
}
720+
success.invoke(data);
721+
} catch (JSONException e) {
722+
e.printStackTrace();
723+
failure.invoke(e.getMessage());
724+
}
725+
}
726+
@Override public void onFailure(String error) { failure.invoke(error); }
727+
});
728+
}
729+
730+
@ReactMethod
731+
public void geofenceExists(String identifier, final Callback callback) {
732+
getAdapter().geofenceExists(identifier, new TSGeofenceExistsCallback() {
733+
@Override public void onResult(boolean exists) {
734+
callback.invoke(exists);
735+
}
736+
});
737+
}
738+
703739
// TODO Rename #beginBackgroundTask -> #startBackgroundTask
704740
@ReactMethod
705741
public void beginBackgroundTask(final Callback success, Callback failure) {

docs/assets/js/search.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/classes/_react_native_background_geolocation_.backgroundgeolocation.html

Lines changed: 145 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
<li class="state loading">Preparing search index...</li>
2424
<li class="state failure">The search index is not available</li>
2525
</ul>
26-
<a href="../globals.html" class="title">[API Docs] React Native Background Geolocation</a>&nbsp;<span class="tsd-flag ts-flagOptional ts-flagVersion">v 3.2.2</span>
26+
<a href="../globals.html" class="title">[API Docs] React Native Background Geolocation</a>&nbsp;<span class="tsd-flag ts-flagOptional ts-flagVersion">v 3.3.0</span>
2727
</div>
2828
<div class="" id="tsd-widgets">
2929
<a class="github" href="https://github.com/transistorsoft/react-native-background-geolocation">Github</a>
@@ -310,8 +310,10 @@ <h3>Methods</h3>
310310
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-static"><a href="_react_native_background_geolocation_.backgroundgeolocation.html#destroylog" class="tsd-kind-icon">destroy<wbr>Log</a></li>
311311
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-static"><a href="_react_native_background_geolocation_.backgroundgeolocation.html#emaillog" class="tsd-kind-icon">email<wbr>Log</a></li>
312312
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-static"><a href="_react_native_background_geolocation_.backgroundgeolocation.html#finish" class="tsd-kind-icon">finish</a></li>
313+
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-static"><a href="_react_native_background_geolocation_.backgroundgeolocation.html#geofenceexists" class="tsd-kind-icon">geofence<wbr>Exists</a></li>
313314
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-static"><a href="_react_native_background_geolocation_.backgroundgeolocation.html#getcount" class="tsd-kind-icon">get<wbr>Count</a></li>
314315
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-static"><a href="_react_native_background_geolocation_.backgroundgeolocation.html#getcurrentposition" class="tsd-kind-icon">get<wbr>Current<wbr>Position</a></li>
316+
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-static"><a href="_react_native_background_geolocation_.backgroundgeolocation.html#getgeofence" class="tsd-kind-icon">get<wbr>Geofence</a></li>
315317
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-static"><a href="_react_native_background_geolocation_.backgroundgeolocation.html#getgeofences" class="tsd-kind-icon">get<wbr>Geofences</a></li>
316318
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-static"><a href="_react_native_background_geolocation_.backgroundgeolocation.html#getlocations" class="tsd-kind-icon">get<wbr>Locations</a></li>
317319
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-static"><a href="_react_native_background_geolocation_.backgroundgeolocation.html#getlog" class="tsd-kind-icon">get<wbr>Log</a></li>
@@ -1707,6 +1709,62 @@ <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</
17071709
</li>
17081710
</ul>
17091711
</section>
1712+
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-static">
1713+
<a name="geofenceexists" class="tsd-anchor"></a>
1714+
<h3><span class="tsd-flag ts-flagStatic">Static</span> geofence<wbr>Exists</h3>
1715+
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-static">
1716+
<li class="tsd-signature tsd-kind-icon">geofence<wbr>Exists<span class="tsd-signature-symbol">(</span>identifier<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span>, callback<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">function</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">&gt;</span></li>
1717+
</ul>
1718+
<ul class="tsd-descriptions">
1719+
<li class="tsd-description">
1720+
<aside class="tsd-sources">
1721+
</aside>
1722+
<div class="tsd-comment tsd-typography">
1723+
<div class="lead">
1724+
<p>Determine if a particular geofence exists in the SDK&#39;s database.</p>
1725+
</div>
1726+
<dl class="tsd-comment-tags">
1727+
<dt class="tsd-comment-tag-example">example</dt>
1728+
<dd><pre><code class="language-javascript"><span class="hljs-keyword">let</span> exists = <span class="hljs-keyword">await</span> BackgroundGeolocation.geofenceExists(<span class="hljs-string">"HOME"</span>);
1729+
<span class="hljs-built_in">console</span>.log(<span class="hljs-string">'[geofenceExists] '</span>, exists);</code></pre>
1730+
<h3 id="-see-also-">ℹ️ See also:</h3>
1731+
<ul>
1732+
<li>📘 <a href="../interfaces/_react_native_background_geolocation_.geofence.html">Geofence</a> Guide.</li>
1733+
</ul>
1734+
</dd>
1735+
</dl>
1736+
</div>
1737+
<h4 class="tsd-parameters-title">Parameters</h4>
1738+
<ul class="tsd-parameters">
1739+
<li>
1740+
<h5>identifier: <span class="tsd-signature-type">string</span></h5>
1741+
</li>
1742+
<li>
1743+
<h5><span class="tsd-flag ts-flagOptional">Optional</span> callback: <span class="tsd-signature-type">function</span></h5>
1744+
<ul class="tsd-parameters">
1745+
<li class="tsd-parameter-siganture">
1746+
<ul class="tsd-signatures tsd-kind-type-literal tsd-is-not-exported">
1747+
<li class="tsd-signature tsd-kind-icon"><span class="tsd-signature-symbol">(</span>exists<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li>
1748+
</ul>
1749+
<ul class="tsd-descriptions">
1750+
<li class="tsd-description">
1751+
<h4 class="tsd-parameters-title">Parameters</h4>
1752+
<ul class="tsd-parameters">
1753+
<li>
1754+
<h5>exists: <span class="tsd-signature-type">boolean</span></h5>
1755+
</li>
1756+
</ul>
1757+
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4>
1758+
</li>
1759+
</ul>
1760+
</li>
1761+
</ul>
1762+
</li>
1763+
</ul>
1764+
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">&gt;</span></h4>
1765+
</li>
1766+
</ul>
1767+
</section>
17101768
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-static">
17111769
<a name="getcount" class="tsd-anchor"></a>
17121770
<h3><span class="tsd-flag ts-flagStatic">Static</span> get<wbr>Count</h3>
@@ -1852,6 +1910,83 @@ <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</
18521910
</li>
18531911
</ul>
18541912
</section>
1913+
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-static">
1914+
<a name="getgeofence" class="tsd-anchor"></a>
1915+
<h3><span class="tsd-flag ts-flagStatic">Static</span> get<wbr>Geofence</h3>
1916+
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-static">
1917+
<li class="tsd-signature tsd-kind-icon">get<wbr>Geofence<span class="tsd-signature-symbol">(</span>identifier<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span>, success<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">function</span>, failure<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">function</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><a href="../interfaces/_react_native_background_geolocation_.geofence.html" class="tsd-signature-type">Geofence</a><span class="tsd-signature-symbol">&gt;</span></li>
1918+
</ul>
1919+
<ul class="tsd-descriptions">
1920+
<li class="tsd-description">
1921+
<aside class="tsd-sources">
1922+
</aside>
1923+
<div class="tsd-comment tsd-typography">
1924+
<div class="lead">
1925+
<p>Fetch a single <a href="../interfaces/_react_native_background_geolocation_.geofence.html">Geofence</a> by identifier from the SDK&#39;s database.</p>
1926+
</div>
1927+
<dl class="tsd-comment-tags">
1928+
<dt class="tsd-comment-tag-example">example</dt>
1929+
<dd><pre><code class="language-javascript"><span class="hljs-keyword">let</span> geofence = <span class="hljs-keyword">await</span> BackgroundGeolocation.getGeofence(<span class="hljs-string">"HOME"</span>);
1930+
<span class="hljs-built_in">console</span>.log(<span class="hljs-string">'[getGeofence] '</span>, geofence);</code></pre>
1931+
<h3 id="-see-also-">ℹ️ See also:</h3>
1932+
<ul>
1933+
<li>📘 <a href="../interfaces/_react_native_background_geolocation_.geofence.html">Geofence</a> Guide.</li>
1934+
</ul>
1935+
</dd>
1936+
</dl>
1937+
</div>
1938+
<h4 class="tsd-parameters-title">Parameters</h4>
1939+
<ul class="tsd-parameters">
1940+
<li>
1941+
<h5>identifier: <span class="tsd-signature-type">string</span></h5>
1942+
</li>
1943+
<li>
1944+
<h5><span class="tsd-flag ts-flagOptional">Optional</span> success: <span class="tsd-signature-type">function</span></h5>
1945+
<ul class="tsd-parameters">
1946+
<li class="tsd-parameter-siganture">
1947+
<ul class="tsd-signatures tsd-kind-type-literal tsd-is-not-exported">
1948+
<li class="tsd-signature tsd-kind-icon"><span class="tsd-signature-symbol">(</span>geofence<span class="tsd-signature-symbol">: </span><a href="../interfaces/_react_native_background_geolocation_.geofence.html" class="tsd-signature-type">Geofence</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li>
1949+
</ul>
1950+
<ul class="tsd-descriptions">
1951+
<li class="tsd-description">
1952+
<h4 class="tsd-parameters-title">Parameters</h4>
1953+
<ul class="tsd-parameters">
1954+
<li>
1955+
<h5>geofence: <a href="../interfaces/_react_native_background_geolocation_.geofence.html" class="tsd-signature-type">Geofence</a></h5>
1956+
</li>
1957+
</ul>
1958+
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4>
1959+
</li>
1960+
</ul>
1961+
</li>
1962+
</ul>
1963+
</li>
1964+
<li>
1965+
<h5><span class="tsd-flag ts-flagOptional">Optional</span> failure: <span class="tsd-signature-type">function</span></h5>
1966+
<ul class="tsd-parameters">
1967+
<li class="tsd-parameter-siganture">
1968+
<ul class="tsd-signatures tsd-kind-type-literal tsd-is-not-exported">
1969+
<li class="tsd-signature tsd-kind-icon"><span class="tsd-signature-symbol">(</span>error<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li>
1970+
</ul>
1971+
<ul class="tsd-descriptions">
1972+
<li class="tsd-description">
1973+
<h4 class="tsd-parameters-title">Parameters</h4>
1974+
<ul class="tsd-parameters">
1975+
<li>
1976+
<h5>error: <span class="tsd-signature-type">string</span></h5>
1977+
</li>
1978+
</ul>
1979+
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4>
1980+
</li>
1981+
</ul>
1982+
</li>
1983+
</ul>
1984+
</li>
1985+
</ul>
1986+
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><a href="../interfaces/_react_native_background_geolocation_.geofence.html" class="tsd-signature-type">Geofence</a><span class="tsd-signature-symbol">&gt;</span></h4>
1987+
</li>
1988+
</ul>
1989+
</section>
18551990
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-static">
18561991
<a name="getgeofences" class="tsd-anchor"></a>
18571992
<h3><span class="tsd-flag ts-flagStatic">Static</span> get<wbr>Geofences</h3>
@@ -4242,12 +4377,18 @@ <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</spa
42424377
<li class=" tsd-kind-method tsd-parent-kind-class tsd-is-static">
42434378
<a href="_react_native_background_geolocation_.backgroundgeolocation.html#finish" class="tsd-kind-icon">finish</a>
42444379
</li>
4380+
<li class=" tsd-kind-method tsd-parent-kind-class tsd-is-static">
4381+
<a href="_react_native_background_geolocation_.backgroundgeolocation.html#geofenceexists" class="tsd-kind-icon">geofence<wbr>Exists</a>
4382+
</li>
42454383
<li class=" tsd-kind-method tsd-parent-kind-class tsd-is-static">
42464384
<a href="_react_native_background_geolocation_.backgroundgeolocation.html#getcount" class="tsd-kind-icon">get<wbr>Count</a>
42474385
</li>
42484386
<li class=" tsd-kind-method tsd-parent-kind-class tsd-is-static">
42494387
<a href="_react_native_background_geolocation_.backgroundgeolocation.html#getcurrentposition" class="tsd-kind-icon">get<wbr>Current<wbr>Position</a>
42504388
</li>
4389+
<li class=" tsd-kind-method tsd-parent-kind-class tsd-is-static">
4390+
<a href="_react_native_background_geolocation_.backgroundgeolocation.html#getgeofence" class="tsd-kind-icon">get<wbr>Geofence</a>
4391+
</li>
42514392
<li class=" tsd-kind-method tsd-parent-kind-class tsd-is-static">
42524393
<a href="_react_native_background_geolocation_.backgroundgeolocation.html#getgeofences" class="tsd-kind-icon">get<wbr>Geofences</a>
42534394
</li>
@@ -4429,6 +4570,9 @@ <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</spa
44294570
<li class=" tsd-kind-type-alias tsd-parent-kind-module tsd-is-not-exported">
44304571
<a href="../modules/_react_native_background_geolocation_.html#authorizationstatus" class="tsd-kind-icon">Authorization<wbr>Status</a>
44314572
</li>
4573+
<li class=" tsd-kind-type-alias tsd-parent-kind-module tsd-is-not-exported">
4574+
<a href="../modules/_react_native_background_geolocation_.html#extras" class="tsd-kind-icon">Extras</a>
4575+
</li>
44324576
<li class=" tsd-kind-type-alias tsd-parent-kind-module tsd-is-not-exported">
44334577
<a href="../modules/_react_native_background_geolocation_.html#httpmethod" class="tsd-kind-icon">Http<wbr>Method</a>
44344578
</li>

docs/globals.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
<li class="state loading">Preparing search index...</li>
2424
<li class="state failure">The search index is not available</li>
2525
</ul>
26-
<a href="globals.html" class="title">[API Docs] React Native Background Geolocation</a>&nbsp;<span class="tsd-flag ts-flagOptional ts-flagVersion">v 3.2.2</span>
26+
<a href="globals.html" class="title">[API Docs] React Native Background Geolocation</a>&nbsp;<span class="tsd-flag ts-flagOptional ts-flagVersion">v 3.3.0</span>
2727
</div>
2828
<div class="" id="tsd-widgets">
2929
<a class="github" href="https://github.com/transistorsoft/react-native-background-geolocation">Github</a>

0 commit comments

Comments
 (0)