【发布时间】:2013-06-05 09:17:13
【问题描述】:
我正在为 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 调用其他应用程序?
【问题讨论】:
-
你试过什么?根据对您提供的链接的快速阅读,如果您不需要将额外数据传递给意图,似乎甚至可能不需要 URL。例如,如果您启动 YouTube 应用,则 URL 将是要打开的视频……但根据您的意图,我不确定您是否需要传递这些额外信息。
-
@MBillau 我尝试使用
url: https://play.google.com/store/apps/details?id=com.rovio.angrybirds运行应用程序,但游戏没有启动。有什么建议吗? -
空的
url会发生什么?
标签: android cordova native phonegap-plugins webintents