{ "id": "172782", "key": "TIMOB-26675", "fields": { "issuetype": { "id": "2", "description": "A new feature of the product, which has yet to be developed.", "name": "New Feature", "subtask": false }, "project": { "id": "10153", "key": "TIMOB", "name": "Titanium SDK/CLI", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [ { "id": "21249", "name": "Release 10.2.0", "archived": false, "released": false } ], "resolution": null, "resolutiondate": null, "created": "2018-12-20T18:28:38.000+0000", "priority": null, "labels": [ "android", "geolocation" ], "versions": [], "issuelinks": [], "assignee": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2021-10-19T20:44:53.000+0000", "status": { "description": "The issue is open and ready for the assignee to start work on it.", "name": "Open", "id": "1", "statusCategory": { "id": 2, "key": "new", "colorName": "blue-gray", "name": "To Do" } }, "components": [], "description": "The current implementation of the {{FuseLocationProvider}} is not using the {{getLastLocation()}} method:\r\nhttps://github.com/appcelerator/titanium_mobile/blob/master/android/modules/geolocation/src/java/ti/modules/titanium/geolocation/android/FusedLocationProvider.java\r\n\r\nAccording to https://developer.android.com/training/location/retrieve-current#java you can use {{getLastLocation()}} on the provider.\r\n\r\n\r\nAdding this to the Java file mentioned above:\r\n{code}\r\nfusedLocationClient.getLastLocation().addOnSuccessListener(new OnSuccessListener() {\r\n @Override\r\n public void onSuccess(Location location)\r\n {\r\n // Got last known location. In some rare situations this can be null.\r\n if (location != null) {\r\n Log.i(\"Fused\", \"Location: \" + location);\r\n }\r\n }\r\n});\r\n{code}\r\n\r\nworks fine, it just needs to transfer those values to the JS {{location}} event .", "attachment": [], "flagged": false, "summary": "Android: Add getLastLocation to FusedLocationProvider", "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": "444797", "author": { "name": "sdarda", "key": "sdarda", "displayName": "Sharif AbuDarda", "active": false, "timeZone": "Asia/Dhaka" }, "body": "Thanks for the feature ticket. Our engineers will look into it. Thanks.", "updateAuthor": { "name": "sdarda", "key": "sdarda", "displayName": "Sharif AbuDarda", "active": false, "timeZone": "Asia/Dhaka" }, "created": "2018-12-20T21:52:24.000+0000", "updated": "2018-12-20T21:52:24.000+0000" }, { "id": "459117", "author": { "name": "michael", "key": "michael", "displayName": "Michael Gangolf", "active": true, "timeZone": "Europe/Berlin" }, "body": "PR: https://github.com/appcelerator/titanium_mobile/pull/13133\r\n\r\nhad this in my queue for a longer time :)", "updateAuthor": { "name": "michael", "key": "michael", "displayName": "Michael Gangolf", "active": true, "timeZone": "Europe/Berlin" }, "created": "2021-10-19T14:02:34.000+0000", "updated": "2021-10-19T14:02:34.000+0000" }, { "id": "459118", "author": { "name": "ahmed.mohamed20320", "key": "ahmed.mohamed20320", "displayName": "Ahmed Mohamed", "active": true, "timeZone": "Africa/Cairo" }, "body": "{{getLastLocation}} will get the last cached location in the device and that's sometimes far from the current location. let us say an app request location data on day 1 so this location will be the last location requested on the device then after 30 days if no other app make a new location request then {{getLastLocation}} will get that same old location that was requested since 30 days ago\r\n\r\nSo I don't think {{getLastLocation}} should fire {{location}}\r\n\r\nIf you want to try it please use my ti.locationservices module\r\nhttps://github.com/AhmedMSayed/ti.locationservices", "updateAuthor": { "name": "ahmed.mohamed20320", "key": "ahmed.mohamed20320", "displayName": "Ahmed Mohamed", "active": true, "timeZone": "Africa/Cairo" }, "created": "2021-10-19T17:25:50.000+0000", "updated": "2021-10-19T17:25:50.000+0000" }, { "id": "459119", "author": { "name": "michael", "key": "michael", "displayName": "Michael Gangolf", "active": true, "timeZone": "Europe/Berlin" }, "body": "Thanks for the feedback [~ahmed.mohamed20320]! I have to check it again but shouldn't that be covered by the included timestamp? But you are right, if you don't check that it can be very wrong. I'll have a look again.\r\n\r\n\r\nBTW: I'm using the userLocation event of ti.map since that is using internal map stuff by Google and returned a proper fix quicker than geoolaction in my tests.\r\n", "updateAuthor": { "name": "michael", "key": "michael", "displayName": "Michael Gangolf", "active": true, "timeZone": "Europe/Berlin" }, "created": "2021-10-19T18:46:23.000+0000", "updated": "2021-10-19T18:46:23.000+0000" } ], "maxResults": 4, "total": 4, "startAt": 0 } } }