Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-26016] iOS 11: Expose "showsBackgroundLocationIndicator" property on Ti.Geolocation

GitHub Issuen/a
TypeNew Feature
PriorityCritical
StatusClosed
ResolutionFixed
Resolution Date2018-05-19T13:46:40.000+0000
Affected Version/sRelease 7.1.1
Fix Version/sRelease 7.3.0
ComponentsiOS
Labelsdemo_app, geolocation
ReporterEmmanuel Francis
AssigneeHans Knöchel
Created2018-05-06T04:49:59.000+0000
Updated2018-06-21T17:51:42.000+0000

Description

Is this flag showsBackgroundLocationIndicator in Ti.Geolocation available?

Attachments

FileDateSize
Bildschirmfoto 2018-05-09 um 17.00.24.png2018-05-10T07:43:03.000+00001072683
Screen Shot 2018-06-21 at 18.47.59.png2018-06-21T17:50:28.000+00001526873

Comments

  1. Hans Knöchel 2018-05-06

    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.
  2. Emmanuel Francis 2018-05-06

    Hyperloop helped for now var CLLocationManager = require('CoreLocation/CLLocationManager'); CLLocationManager.showsBackgroundLocationIndicator = true/false;
  3. Hans Knöchel 2018-05-09

    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);
           });
       }
       
  4. Samir Mohammed 2018-06-21

    *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 Updates

    Minimised the application

    Able to see showsBackgroundLocationIndicator

    !Screen Shot 2018-06-21 at 18.47.59.png|thumbnail! *Test Environment*
       APPC Studio: 5.0.0.201712081732
       APPC CLI: 7.0.4
       iphone 6 11.2 emulator
       Operating System Name: Mac OS High Sierra
       Operating System Version: 10.13
       Node.js Version: 8.9.1
       Xcode 9.2
       

JSON Source