I am trying to build simple app using Titanium studio which will load google.com but I am not getting proper results.
1) I used WebView to load url but nothing display except white screen.
2) I used httpClient but i always got error which i defined in onerror function.
Both methods are pasted below. Do i have to make changes in tiApp.xml i.e interent permission?
Kindly help me, how can i do this better?
Note: I am using proxy internet. Problem comes on both emulator and device.
I am loading following js file from app.js
var win = Ti.UI.currentWindow;
Ti.App.fireEvent('show_indicator'); //display loading spinner until webview gets loaded
var fbUrl = "http://www.facebook.com";
var extwebview = Titanium.UI.createWebView({
url:fbUrl,
backgroundColor:'#ccc'
});
win.add(extwebview); //adding webview in current window
extwebview.addEventListener('load', function() {
Ti.App.fireEvent('hide_indicator'); //Hide the Loading indicatr
});
---------------Method 2-----------------
var url ="http://www.google.com.pk";
var xhr = Ti.Network.createHTTPClient({
onload: function() {
// I don't know what to write here.
},
onerror: function(e) {
Ti.API.debug("STATUS: " + this.status);
Ti.API.debug("TEXT: " + this.responseText);
Ti.API.debug("ERROR: " + e.error);
alert('There was an error retrieving the remote data. Try again.');
},
timeout:50000
});
xhr.open("GET", url);
xhr.send();