[TIMOB-26016] iOS 11: Expose "showsBackgroundLocationIndicator" property on Ti.Geolocation
| GitHub Issue | n/a |
|---|---|
| Type | New Feature |
| Priority | Critical |
| Status | Closed |
| Resolution | Fixed |
| Resolution Date | 2018-05-19T13:46:40.000+0000 |
| Affected Version/s | Release 7.1.1 |
| Fix Version/s | Release 7.3.0 |
| Components | iOS |
| Labels | demo_app, geolocation |
| Reporter | Emmanuel Francis |
| Assignee | Hans Knöchel |
| Created | 2018-05-06T04:49:59.000+0000 |
| Updated | 2018-06-21T17:51:42.000+0000 |
Description
Is this flag showsBackgroundLocationIndicator in Ti.Geolocation available?
Attachments
| File | Date | Size |
|---|---|---|
| Bildschirmfoto 2018-05-09 um 17.00.24.png | 2018-05-10T07:43:03.000+0000 | 1072683 |
| Screen Shot 2018-06-21 at 18.47.59.png | 2018-06-21T17:50:28.000+0000 | 1526873 |
Currently not, but it should be easy to implement for iOS 11+. Not sure if Android has something related that could be used for parity.
Hyperloop helped for now var CLLocationManager = require('CoreLocation/CLLocationManager'); CLLocationManager.showsBackgroundLocationIndicator = true/false;
PR: https://github.com/appcelerator/titanium_mobile/pull/10034 Test-case:
/* Required plist entries: <key>UIBackgroundModes</key> <array> <string>location</string> </array> <!-- For iOS 11+, you need "Always and When in Use" even when requesting "Always" --> <key>NSLocationAlwaysAndWhenInUseUsageDescription</key> <string>Can we access your location?</string> <!-- Required for general background location monitoring --> <key>NSLocationAlwaysUsageDescription</key> <string>Can we always access your location</string> <!-- For iOS 11+, you need "Always and When in Use" even when requesting "Always" --> <key>NSLocationWhenInUseUsageDescription</key> <string>Can we access your location when using the app?</string> */ Ti.Geolocation.showBackgroundLocationIndicator = true; Ti.Geolocation.addEventListener('location', function(e) { Ti.API.info(e); }) var win = Ti.UI.createWindow({ backgroundColor: '#fff' }); var btn = Ti.UI.createButton({ title: 'Start location updates' }); btn.addEventListener('click', function() { if (!Ti.Geolocation.hasLocationPermissions(Ti.Geolocation.AUTHORIZATION_ALWAYS)) { Ti.Geolocation.requestLocationPermissions(Ti.Geolocation.AUTHORIZATION_ALWAYS, function (e) { if (!e.success) { Ti.API.error('Permissions denied!'); return; } else { updatePosition(); } }); } else { updatePosition(); } }); win.add(btn); win.open(); function updatePosition() { Ti.Geolocation.getCurrentPosition(function (e) { Ti.API.info(e); }); }*Closing ticket*. New feature can be seen in SDK Version:
7.3.0.v20180618182516*FR (Passed) Test Steps:*Created an application using the code above
Ran the program
Accepted all required permissions
Pressed
Start Location UpdatesMinimised the application
Able to see
!Screen Shot 2018-06-21 at 18.47.59.png|thumbnail! *Test Environment*showsBackgroundLocationIndicator