Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feedback some solution for you #3

Open
bau720123 opened this issue Jan 9, 2014 · 0 comments
Open

feedback some solution for you #3

bau720123 opened this issue Jan 9, 2014 · 0 comments

Comments

@bau720123
Copy link

such kind of this

var deviceInfo = cordova.require("cordova/plugin/DeviceInformation");
deviceInfo.get(function(result) {
        console.log("result = " + result);
    }, function() {
        console.log("error");
    });

but in the Practice conditions,the "result" should be Dismantling to more useful string,but it seems hard to get,so I made a javascript solution way

in javascript

function getUrlVars(result, index)
{
var str_length = result.split(",");
var vars = str_length[index].split(",");
var vars = vars[0].split(":");
var vars = vars[1].replace(/\'/g,"");
if(index == 5) { var vars = vars.replace(/\}/g,""); }
return vars;
}

so use the method getUrlVars will get more useful string
deviceID = > getUrlVars(result,0)
phoneNo = > getUrlVars(result,1)
netCountry = > getUrlVars(result,2)
netName = > getUrlVars(result,3)
simCountry = > getUrlVars(result,4)
simName = > getUrlVars(result,5)

maybe you can Consider to change the original "result" by Dismantling,just like this
result['deviceID ']...
result['phoneNo']...
result['netCountry']...
etc...
if could,it will be more Direct

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant