[TIMOB-27739] Android: Location permissions not auto-added when using Ti.Geolocation API as of 9.0.0
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | High |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2020-01-30T23:58:21.000+0000 |
Affected Version/s | Release 9.0.0 |
Fix Version/s | Release 9.0.0 |
Components | Android |
Labels | android, build, geolocation, location, permission, regression |
Reporter | Joshua Quick |
Assignee | Joshua Quick |
Created | 2020-01-25T05:05:12.000+0000 |
Updated | 2020-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 Notice app reports error:
app.js
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();
PR (master): https://github.com/appcelerator/titanium_mobile/pull/11450
FR Passed. Waiting for Jenkins.
merged to master for 9.0.0
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