开发者

Passing data from android to phonegap

开发者 https://www.devze.com 2023-03-30 00:26 出处:网络
I am developing an Android application using PhoneGap. My application is launched with a custom URI with something like myscheme://mydata.

I am developing an Android application using PhoneGap.

My application is launched with a custom URI with something like myscheme://mydata. I can get the data in my activity class as follows.

    Inten开发者_运维技巧t intent = getIntent();

    if(intent.getAction().equals(Intent.ACTION_VIEW))
    {
        Uri data = intent.getData();

        if (data != null)
        data.toString();
    }

However I couldn't find any way to pass this data onto my javascript code on phonegap side. Any help is appreciated, Regards


You might want to look at the WebIntent plugin - https://github.com/phonegap/phonegap-plugins/tree/master/Android/WebIntent in the PhoneGap Plugins repo https://github.com/phonegap/phonegap-plugins.


Have you tried checking window.Invoke_params in your javascript?

The following link seems to indicate that it should work on iOS at least http://remysharp.com/2010/09/01/custom-url-schemes-in-phonegap/


For passing a data from android to javascript using phonegap You can try to make a plugin and via exceute() method you can pass the data.

0

精彩评论

暂无评论...
验证码 换一张
取 消