3

他のアプリケーションから共有された情報を受け取りたいです。

このために、プラグイン WebIntent を使用しようとしています: https://github.com/phonegap/phonegap-plugins/tree/master/Android/WebIntent

Phonegap 2.5.0 を使用

AndroidManifest.xml 内 (共有するセクションにアプリケーションを表示するため)

<intent-filter> 
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="text/plain" />
</intent-filter>

index.html 内

document.addEventListener('deviceready', onDeviceready, true);

function onDeviceready() {  
    window.plugins.webintent.getUri(function(url) {
      if(url !== "") {
        // url is the url the intent was launched with
         alert (url);
      }
    });
}

var url、返される値は null です。

プラグイン src/com/borismus/webintent/WebIntent.java

res/xml/config.xml 内

</plugins>
....
....
    <plugin name="WebIntent" value="com.borismus.webintent.WebIntent" />    
</plugins>

ありがとう!!!

4

1 に答える 1

3

ウリが取れるようになりました!私は使用しています:

window.plugins.webintent.getExtra(window.plugins.webintent.EXTRA_TEXT, function (url) {
              alert(url);
        }, function() { //Fail
              alert ("error");          
});
于 2013-04-29T15:18:37.660 に答える