onSuccess: function(){ Ti.API.info("Tracking Profile: " + geoloqi.tracker.getProfile()); Ti.API.info("Access Token: " + geoloqi.session.getAccessToken()); Ti.API.info("User ID: " + geoloqi.session.getUserId()); Ti.API.info("Username: "******"Anonymous User?: " + geoloqi.session.isAnonymous()); Ti.API.info("Fire"); Ti.App.fireEvent("geoloqi:ready"); if (Ti.Platform.osname !== "android") { Ti.Network.registerForPushNotifications({ types:[ Titanium.Network.NOTIFICATION_TYPE_ALERT ], callback: function(data){ Ti.App.fireEvent("openURL",{url:data.data.geoloqi.link}); Ti.App.fireEvent("refreshDeals"); geoloqi.iOS.handlePush(data); }, success:function(data){ // TODO: Change to "live" when building your release version of the app geoloqi.iOS.registerDeviceToken(data.deviceToken, "dev"); }, error: function(data){ Ti.API.error("Could Not Register For Push" + data.error + data.type); } }); } },
btnGet.addEventListener('click',function(){ geoloqi.session.getRequest("location/last",{}, { onSuccess:function(e) { alert(e); }, onFailure:function(e) { alert(e); } }); });
btnPost.addEventListener('click',function(){ geoloqi.session.postRequest("link/create",{description:"this is test link"}, { onSuccess:function(e) { alert(e); }, onFailure:function(e) { alert(e); } }); });
btnAPIRequest.addEventListener('click',function(){ geoloqi.session.apiRequest("GET","account/profile",{}, { onSuccess:function(e) { alert(e); }, onFailure:function(e) { alert(e); } }); });
btnIsAnonymous.addEventListener('click',function(){ var isAnonymous = geoloqi.session.isAnonymous(); alert("isAnonymous:"+ isAnonymous); });
btnGetUserName.addEventListener('click',function(){ var userName = geoloqi.session.getUsername(); alert("UserName:"+ userName); });
btnGetUserId.addEventListener('click',function(){ var userID = geoloqi.session.getUserId(); alert("user id "+ userID); });