How to open ios map(native map application) with current location, I have tried this below one, but its is opening in safari
Ti.Platform.openURL('http://maps.google.com/maps');I am using Titanium 1.7.5
Thanks in advance
4 Answers
Accepted Answer
This should do the trick:
in your app.js:
Ti.Geolocation.purpose = "Receive user location"; Ti.Geolocation.accuracy = Ti.Geolocation.ACCURACY_BEST; Ti.Geolocation.preferredProvider = "gps"; Ti.Geolocation.distanceFilter = 10; var userpos={}; Titanium.Geolocation.getCurrentPosition(function(e) { if(!e.success) { alert('Could not retrieve location'); }else{ userpos.longitude = e.coords.longitude; userpos.latitude = e.coords.latitude; } });and then anywhere you want to call the maps apps:
button.addEventListener('click',function(){ Ti.Platform.openURL('http://maps.google.com/maps?ll='+userpos.latitude+','+userpos.longitude); });you may have to add some controls to check if you really have the user location (maybe the user didn't accept to be located... )
yes you can do that with
Ti.Platform.openURL('Maps://');
hi Karthi,
i think you talk about this
Try using parameters, this should open the Maps App (on a device, does not work on simulator):
Ti.Platform.openURL('http://maps.google.com/maps?daddr=San+Francisco,+CA&saddr=cupertino');
Your Answer
Think you can help? Login to answer this question!