Created
February 3, 2016 12:07
-
-
Save rakhimoni/6855b5b169c0cd5a8f28 to your computer and use it in GitHub Desktop.
Geolocation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var win = Ti.UI.createWindow({ | |
backgroundColor : '#fff' | |
}); | |
win.addEventListener('click',function(e){ | |
if (Ti.Geolocation.locationServicesEnabled) { | |
Titanium.Geolocation.purpose = 'Get Current Location'; | |
Titanium.Geolocation.getCurrentPosition(function(e) { | |
if (e.error) { | |
Ti.API.error('Error: ' + e.error); | |
} else { | |
Ti.API.info(" geolocation result"+ JSON.stringify(e.coords)); | |
} | |
}); | |
} else { | |
alert('Please enable location services'); | |
} | |
}); | |
win.open(); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Test Environment: | |
Appcelerator Command-Line Interface, version 5.1.0 | |
Titanium SDK Version 5.1.2.GA | |
Appcelerator Studio, build: 4.4.0.201511241829 | |
Mac OS X,Version = 10.10.11. | |
Console: | |
[INFO] : geolocation result{"timestamp":1454501065718,"speed":0,"altitude":0,"longitude":90.376397,"latitude":23.7991712,"accuracy":784,"heading":0,"altitudeAccuracy":null} | |
[INFO] : InputMethodManager: handleMessage: MSG_SET_ACTIVE false, was true | |
[TRACE] : InputMethodManager: START INPUT: com.android.internal.policy.impl.PhoneWindow$DecorView{413ed4b8 V.E..... R....... 0,0-480,800} ic=null tba=android.view.inputmethod.EditorInfo@413f7620 controlFlags=#100 | |
[TRACE] : InputMethodManager: Starting input: Bind result=InputBindResult{com.android.internal.view.IInputMethodSession$Stub$Proxy@41339070 net.hasnath.android.keyboard/.LatinIME #1192} | |
[INFO] : APSAnalyticsService: Analytics Service Started | |
[WARN] : APSAnalyticsService: Network unavailable, can't send analytics | |
[INFO] : APSAnalyticsService: Stopping Analytics Service |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment