So I have created a web-app and now I'm using PhoneGap to create the android application of my web-app. I followed all the steps in the phonegap tutorial. Also I'm using oauth token security. Currently I'm using the phoneGap desktop application and weinre debugger to see the log. Now I'm facing the following problem -
Part of my tracker.service.js code is as follows -
function connect () {
var loc = $window.location;
var url = '//' + loc.host + loc.pathname + 'websocket/tracker';
var authToken = angular.fromJson($localStorage.authenticationToken).access_token;
// the above code is to add a token as a security measure
url += '?access_token=' + authToken;
// ... rest of code ...
}
Now the above url is used to login the appllication. When I run this in the web-app everything is working fine as $window.location
returns the ip-address of the current machine. But when I test it in my android phone, I am not able to login into the application.
When I checked in the debugger, I found out that $window.location
was giving back the file path of the application in the system, as below
///data/user/0/com.adobe.phonegap.app/files/phonegapdevapp/www/index.htmlwebsocket/tracker?access_token=25a11f0a-1417-4454-b22b-456d0698798b
I don't know if while using in mobile $window.location
returns the file path. If yes, than is there any way that I get the ip-address and not the file path?
Thanks.