{ "id": "164233", "key": "AC-4581", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "12217", "key": "AC", "name": "Appcelerator - INBOX", "projectCategory": { "id": "10000", "description": "", "name": "Customer Service" } }, "resolution": { "id": "8", "description": "", "name": "Needs more info" }, "resolutiondate": "2016-11-11T15:29:14.000+0000", "created": "2016-10-27T02:46:29.000+0000", "labels": [ "SupportTeam", "android", "defect" ], "versions": [], "issuelinks": [], "assignee": { "name": "shossain", "key": "shossain", "displayName": "Shak Hossain", "active": false, "timeZone": "America/Los_Angeles" }, "updated": "2016-11-11T15:29:14.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": "14551", "name": "Studio", "description": "Please enter tickets related to Titanium Studio here." } ], "description": "*In my tiapp:*\r\n\r\n{{\r\n \r\n \r\n \r\n \r\n \r\n }}\r\n\r\n*in my alloy.js:*\r\n{{\r\nAlloy.Globals.geoLocation = function(e) {\r\n\tvar dialogs = require('alloy/dialogs');\r\n\tvar log = require('log');\r\n\tif (OS_IOS) {\r\n\t\tlog.args('Ti.Geolocation.allowsBackgroundLocationUpdates', Ti.Geolocation.allowsBackgroundLocationUpdates);\r\n\t\tlog.args('Ti.Geolocation.locationServicesEnabled', Ti.Geolocation.locationServicesEnabled);\r\n\t}\r\n\r\n\tvar hasLocationPermissions = Ti.Geolocation.hasLocationPermissions(Ti.Geolocation.AUTHORIZATION_ALWAYS);\r\n\tlog.args('Ti.Geolocation.hasLocationPermissions', hasLocationPermissions);\r\n\r\n\tif (hasLocationPermissions) {\r\n\t\t//return alert('You already have permission.');\r\n\t}\r\n\r\n\tif (OS_IOS) {\r\n\t\tvar map = {};\r\n\t\tmap[Ti.Geolocation.AUTHORIZATION_ALWAYS] = 'AUTHORIZATION_ALWAYS';\r\n\t\tmap[Ti.Geolocation.AUTHORIZATION_AUTHORIZED] = 'AUTHORIZATION_AUTHORIZED';\r\n\t\tmap[Ti.Geolocation.AUTHORIZATION_DENIED] = 'AUTHORIZATION_DENIED';\r\n\t\tmap[Ti.Geolocation.AUTHORIZATION_RESTRICTED] = 'AUTHORIZATION_RESTRICTED';\r\n\t\tmap[Ti.Geolocation.AUTHORIZATION_UNKNOWN] = 'AUTHORIZATION_UNKNOWN';\r\n\t\tmap[Ti.Geolocation.AUTHORIZATION_WHEN_IN_USE] = 'AUTHORIZATION_WHEN_IN_USE';\r\n\r\n\t\tvar locationServicesAuthorization = Ti.Geolocation.locationServicesAuthorization;\r\n\t\tconsole.log('Ti.Geolocation.locationServicesAuthorization', 'Ti.Geolocation.' + map[locationServicesAuthorization]);\r\n\r\n\t\tif (locationServicesAuthorization === Ti.Geolocation.AUTHORIZATION_RESTRICTED) {\r\n\t\t\treturn alert('Because permission are restricted by some policy which you as user cannot change, we don\\'t request as that might also cause issues.');\r\n\r\n\t\t} else if (locationServicesAuthorization === Ti.Calendar.AUTHORIZATION_DENIED) {\r\n\t\t\treturn dialogs.confirm({\r\n\t\t\t\ttitle : 'You denied permission before',\r\n\t\t\t\tmessage : 'We don\\'t request again as that won\\'t show the dialog anyway. Instead, press Yes to open the Settings App to grant permission there.',\r\n\t\t\t\tcallback : editPermissions\r\n\t\t\t});\r\n\t\t}\r\n\t}\r\n\r\n\tTi.Geolocation.requestLocationPermissions(Ti.Geolocation.AUTHORIZATION_ALWAYS, function(e) {\r\n\t\tconsole.log('Ti.Geolocation.requestLocationPermissions', e);\r\n\r\n\t\tif (e.success) {\r\n\t\t\tconsole.log('provider:'+Ti.Geolocation.PROVIDER_GPS)\r\n\t\t\tTi.Geolocation.purpose = 'Get Current Location';\r\n\t\t\tTi.Geolocation.accuracy = Ti.Geolocation.ACCURACY_BEST;\r\n\t\t\tTi.Geolocation.distanceFilter = 1;\r\n\t\t\tTi.Geolocation.preferredProvider = Ti.Geolocation.PROVIDER_GPS;//PROVIDER_NETWORK;\r\n\t\t\t//alert('You granted permission.');\r\n\r\n\t\t} else if (OS_ANDROID) {\r\n\t\t\tconsole.log('provider:'+Ti.Geolocation.PROVIDER_GPS)\r\n\t\t\talert('You denied permission for now');\r\n\r\n\t\t} else {\r\n\t\t\tTi.UI.createAlertDialog({\r\n\t\t\t\ttitle : 'You denied permission.',\r\n\t\t\t\tmessage : e.error\r\n\t\t\t}).show();\r\n\t\t}\r\n\t});\r\n};\r\n}}\r\n\r\n\r\n*in my index:*\r\n\r\n{{Alloy.Globals.geoLocation();\r\n\r\nsetInterval(function(){\r\nTi.Geolocation.getCurrentPosition(function(e) {\r\n\t\t\t\tconsole.log(\"longitude: \" + e.coords.longitude + \", Latitude: \" + e.coords.latitude);\r\n});\r\n},400);}}\r\n\r\nThis code works fine in Android phones, but in Android tablets appears this message:\r\n\r\n{color:red}[ERROR] : TiExceptionHandler: (main) [6,270577] ----- Titanium Javascript Runtime Error -----\r\n[ERROR] : TiExceptionHandler: (main) [0,270577] - In alloy/controllers/index.js:1,69\r\n[ERROR] : TiExceptionHandler: (main) [0,270577] - Message: Uncaught TypeError: Cannot read property 'longitude' of undefined\r\n[ERROR] : TiExceptionHandler: (main) [0,270577] - Source: dateNow\",new Date);console.log(e),console.log(\"longitude: \"+e.coords.longitude\r\n[ERROR] : V8Exception: Exception occurred at alloy/controllers/index.js:1: Uncaught TypeError: Cannot read property 'longitude' of undefined\r\n[ERROR] : GeolocationModule: (KrollRuntimeThread) [90023,360600] Unable to get current position, location is null{color}\r\n[INFO] : {\"error\":\"location is currently unavailable.\",\"code\":6,\"success\":false}\r\n\r\nh2. Any ideas????\r\n", "attachment": [], "flagged": false, "summary": "Android: Ti.Geolocation.getCurrentPosition", "creator": { "name": "angelustenshi", "key": "angelustenshi", "displayName": "Francisco Alejandro Cruz Castro", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "angelustenshi", "key": "angelustenshi", "displayName": "Francisco Alejandro Cruz Castro", "active": true, "timeZone": "America/Los_Angeles" }, "environment": "OSX El Capitan, Appcelerator Studio, build: 4.7.1.201609100950 ,(device, not emulated) Android phone (Any - Android +4.0), (device, not emulated) Android Tablet ( Samsung Galaxy Tab 10.1 1st gen w/GPS, Fusion5 3G Phone Calling Tablet PC w/GPS - Android +4.0)", "comment": { "comments": [ { "id": "399961", "author": { "name": "sdarda", "key": "sdarda", "displayName": "Sharif AbuDarda", "active": false, "timeZone": "Asia/Dhaka" }, "body": "Hello, Whats the tablet Android version the issue is happening? ", "updateAuthor": { "name": "sdarda", "key": "sdarda", "displayName": "Sharif AbuDarda", "active": false, "timeZone": "Asia/Dhaka" }, "created": "2016-10-27T20:50:35.000+0000", "updated": "2016-10-27T20:50:35.000+0000" }, { "id": "399998", "author": { "name": "angelustenshi", "key": "angelustenshi", "displayName": "Francisco Alejandro Cruz Castro", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Galaxy Tab 10.1 (Wi-Fi), Android 5.1", "updateAuthor": { "name": "angelustenshi", "key": "angelustenshi", "displayName": "Francisco Alejandro Cruz Castro", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2016-10-27T22:49:02.000+0000", "updated": "2016-10-27T22:49:02.000+0000" }, { "id": "400129", "author": { "name": "sdarda", "key": "sdarda", "displayName": "Sharif AbuDarda", "active": false, "timeZone": "Asia/Dhaka" }, "body": "Hello, Is the issue is only with is model? or any other tab?", "updateAuthor": { "name": "sdarda", "key": "sdarda", "displayName": "Sharif AbuDarda", "active": false, "timeZone": "Asia/Dhaka" }, "created": "2016-10-31T21:11:01.000+0000", "updated": "2016-10-31T21:11:01.000+0000" } ], "maxResults": 3, "total": 3, "startAt": 0 } } }