{ "id": "167249", "key": "MOD-2334", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "10034", "key": "MOD", "name": "Appcelerator Modules", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [ { "id": "18919", "name": "Release 6.2.0", "archived": false, "released": true } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2017-08-10T01:14:56.000+0000", "created": "2017-04-23T12:10:52.000+0000", "priority": { "name": "Critical", "id": "1" }, "labels": [ "android", "map", "permissions" ], "versions": [], "issuelinks": [], "assignee": { "name": "gmathews", "key": "gmathews", "displayName": "Gary Mathews", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2017-08-29T00:25:03.000+0000", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "13700", "name": "Map" } ], "description": "A MapView with {{userLocation:true}} in TSS will crash the app if you don't allow the Android M ACCESS_FINE_LOCATION. \r\n\r\nWhile it is correct behavior, that it shouldn't display the userLocation because of the permissions it would be nice to still use the app and just display a warning instead of crashing.\r\n\r\n*Workaround*\r\nremove the TSS entry and add userLocation in your controller once you've checked the {{Ti.Geolocation.requestLocationPermissions}}.\r\n\r\n*Fix*\r\nA better fix would be to add a permission check at:\r\nhttps://github.com/appcelerator-modules/ti.map/blob/24e9a4014f42dc4412f29979736b13f0f2c8caff/android/src/ti/map/TiUIMapView.java#L302\r\n\r\n\r\n*untested example*\r\n{code:java}\r\nContext context = TiApplication.getInstance().getApplicationContext();\r\nif (Build.VERSION.SDK_INT < 23 || context.checkSelfPermission(Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED) {\r\n\tmap.setMyLocationEnabled(enabled);\r\n} else {\r\n\tLog.e(TAG, \"Enable ACCESS_FINE_LOCATION permission to use userLocation\")\r\n}\r\n\r\n{code}\r\n", "attachment": [], "flagged": false, "summary": "Android: Ti.Map will crash with userLocation enabled when Android M permissions are denied", "creator": { "name": "michael", "key": "michael", "displayName": "Michael Gangolf", "active": true, "timeZone": "Europe/Berlin" }, "subtasks": [], "reporter": { "name": "michael", "key": "michael", "displayName": "Michael Gangolf", "active": true, "timeZone": "Europe/Berlin" }, "environment": null, "comment": { "comments": [ { "id": "418015", "author": { "name": "sdarda", "key": "sdarda", "displayName": "Sharif AbuDarda", "active": false, "timeZone": "Asia/Dhaka" }, "body": "Hello, Can you provide a demo app for us to test the issue? Thanks.", "updateAuthor": { "name": "sdarda", "key": "sdarda", "displayName": "Sharif AbuDarda", "active": false, "timeZone": "Asia/Dhaka" }, "created": "2017-04-25T16:13:11.000+0000", "updated": "2017-04-25T16:13:11.000+0000" }, { "id": "418016", "author": { "name": "michael", "key": "michael", "displayName": "Michael Gangolf", "active": true, "timeZone": "Europe/Berlin" }, "body": "Of course, sorry:\r\n\r\n* add {{ti.map}} to tiapp.xml\r\n* add this to the {{}} block (no real key needed):\r\n{code:xml}\r\n \r\n \r\n \r\n\r\n{code}\r\n\r\n* add {{Alloy.Globals.Map = require('ti.map');}} to alloy.js\r\n\r\n*index.xml*\r\n{code:xml}\r\n\r\n\t\r\n\t\t\r\n\t\r\n\r\n{code}\r\n\r\n*index.tss*\r\n{code:css}\r\n\"#mapview\": {\r\n\tuserLocation:true\r\n}\r\n{code}\r\n\r\nRun the app.\r\n\r\nCrash:\r\n\r\n{noformat}\r\n[ERROR] TiApplication: (main) [1519,1519] Sending event: exception on thread: main msg:java.lang.SecurityException: my location requires permission ACCESS_FINE_LOCATION or ACCESS_COARSE_LOCATION; Titanium 6.0.3,2017/03/22 12:00,undefined\r\n[ERROR] TiApplication: java.lang.SecurityException: my location requires permission ACCESS_FINE_LOCATION or ACCESS_COARSE_LOCATION\r\n\r\n{noformat}\r\n", "updateAuthor": { "name": "michael", "key": "michael", "displayName": "Michael Gangolf", "active": true, "timeZone": "Europe/Berlin" }, "created": "2017-04-25T16:33:04.000+0000", "updated": "2017-04-25T16:33:04.000+0000" }, { "id": "423519", "author": { "name": "michael", "key": "michael", "displayName": "Michael Gangolf", "active": true, "timeZone": "Europe/Berlin" }, "body": "PR: https://github.com/appcelerator-modules/ti.map/pull/208", "updateAuthor": { "name": "michael", "key": "michael", "displayName": "Michael Gangolf", "active": true, "timeZone": "Europe/Berlin" }, "created": "2017-07-05T17:19:58.000+0000", "updated": "2017-07-05T17:19:58.000+0000" }, { "id": "426435", "author": { "name": "lchoudhary", "key": "lchoudhary", "displayName": "Lokesh Choudhary", "active": true, "timeZone": "America/Los_Angeles" }, "body": "FR Passed.\r\nPR merged.", "updateAuthor": { "name": "lchoudhary", "key": "lchoudhary", "displayName": "Lokesh Choudhary", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2017-08-10T01:14:50.000+0000", "updated": "2017-08-10T01:14:50.000+0000" }, { "id": "427340", "author": { "name": "lchoudhary", "key": "lchoudhary", "displayName": "Lokesh Choudhary", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Verified the fix with module 3.3.0.\r\n\r\nClosing.\r\n\r\nStudio Ver: 4.9.1.201707200100\r\nSDK Ver: 6.2.0.v20170828140722\r\nOS Ver: 10.12.3\r\nXcode Ver: Xcode 8.3.3\r\nAppc NPM: 4.2.9\r\nAppc CLI: 6.2.3\r\nTi CLI Ver: 5.0.14\r\nAlloy Ver: 1.9.13\r\nNode Ver: 6.10.1\r\nJava Ver: 1.8.0_101\r\nDevices: ⇨ google Nexus 5 --- Android 6.0.1\r\n ⇨ google Pixel --- Android 7.1.1\r\nMap Module : 3.3.0", "updateAuthor": { "name": "lchoudhary", "key": "lchoudhary", "displayName": "Lokesh Choudhary", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2017-08-29T00:24:57.000+0000", "updated": "2017-08-29T00:24:57.000+0000" } ], "maxResults": 6, "total": 6, "startAt": 0 } } }