Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-27739] Android: Location permissions not auto-added when using Ti.Geolocation API as of 9.0.0

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2020-01-30T23:58:21.000+0000
Affected Version/sRelease 9.0.0
Fix Version/sRelease 9.0.0
ComponentsAndroid
Labelsandroid, build, geolocation, location, permission, regression
ReporterJoshua Quick
AssigneeJoshua Quick
Created2020-01-25T05:05:12.000+0000
Updated2020-01-30T23:58:21.000+0000

Description

_This issue was caught before release._ *Summary:* When doing a "device" or "production" build, Titanium's build system is supposed to auto-add the below permissions to the "AndroidManifest.xml" when the app uses the Ti.Geolocation APIs. * android.permission.ACCESS_COARSE_LOCATION * android.permission.ACCESS_FINE_LOCATION This has stopped working as of Titanium 9.0.0 (before release). *Steps to reproduce:*

Set up a Classic app with the below code.

Build and run on an Android device. (Not an emulator.)

Notice app reports error: Failed to acquire location permission

app.js
function monitorLocation() {
	function start() {
		Ti.Geolocation.addEventListener("location", function(e) {
			label.text = JSON.stringify(e, null, 4);
			Ti.API.info("@@@ location received: " + JSON.stringify(e));
		});
	}
	var hasPermission = Ti.Geolocation.hasLocationPermissions(Ti.Geolocation.AUTHORIZATION_WHEN_IN_USE);
	if (!hasPermission) {
		Ti.Geolocation.requestLocationPermissions(Ti.Geolocation.AUTHORIZATION_WHEN_IN_USE, function(e) {
			Ti.API.info("@@@ permission result: " + JSON.stringify(e));
			if (e.success) {
				start();
			} else {
				label.text = "\nFailed to acquire location permission from end-user.";
			}
		});
	} else {
		start();
	}
}
var window = Ti.UI.createWindow();
var scrollView = Ti.UI.createScrollView({
	layout: "vertical",
	scrollType: "vertical",
	width: Ti.UI.FILL,
	height: Ti.UI.FILL,
});
var label = Ti.UI.createLabel({
	text: "\nWaiting for GPS data...",
	top: (Ti.App.iOS ? "25dp" : "5dp"),
	height: Ti.UI.SIZE,
	left: "5dp",
	right: "5dp",
	bottom: "5dp",
});
scrollView.add(label);
window.add(scrollView);
window.addEventListener("open", function(e) {
	monitorLocation();
});
window.open();

Comments

  1. Joshua Quick 2020-01-25

    PR (master): https://github.com/appcelerator/titanium_mobile/pull/11450
  2. Satyam Sekhri 2020-01-27

    FR Passed. Waiting for Jenkins.
  3. Christopher Williams 2020-01-30

    merged to master for 9.0.0
  4. Satyam Sekhri 2020-01-30

    Verified on: Mac OS: 10.15.1 SDK: 9.0.0.v20200130113429 Appc CLI: 7.1.2 JDK: 11.0.4 Node: 10.16.3 Studio: 6.0.0.201911251516 Device: Pixel3(v9.0) device, Pixel3(v10.0) emulator

JSON Source