我正在为Android实现基于phonegap的应用程序,并且想从phonegap应用程序内部调用愤怒的小鸟游戏。经过我的快速研究here和 here我有以下内容:
/src/com.borismus.webintent.WebIntent.java
/www/webintent.js
AndroidManifest:
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:configChanges="orientation">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<data android:scheme="com.rovio.angrybirds" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
</intent-filter>
</activity>
main.js
function onClickStartAngry() {
window.plugins.webintent.startActivity({
action: WebIntent.ACTION_VIEW,
url: 'have_no_idea'},
function() {};
function() {alert('Failed to open AngryBirds App')};
});
}
我被困在这里,have_no_idea
应该为url:
编写什么。有什么帮助吗?或者还有另一种方法可以从phonegap调用其他应用程序?
最佳答案
这段java代码应该可以工作
Intent LaunchIntent = this.cordova.getActivity().getPackageManager().getLaunchIntentForPackage("com.rovio.angrybirds");
this.cordova.getActivity().startActivity(LaunchIntent);
或尝试使用这 2 个插件中的任何一个来打开应用程序
关于android - PhoneGap - 调用另一个应用程序(AngryBirds),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16936031/