gpt4 book ai didi

android - PhoneGap - 调用另一个应用程序 (AngryBirds)

转载 作者:行者123 更新时间:2023-11-29 00:29:17 25 4
gpt4 key购买 nike

我正在为 Android 实现基于 phonegap 的应用程序,并希望从 phonegap 应用程序内部调用愤怒的小鸟游戏。经过我的快速研究herehere我有以下内容:

/src/com.borismus.webintent.WebIntent.java

/www/webintent.js

安卓 list :

<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>

ma​​in.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 个插件中的任何一个来打开应用程序

https://github.com/lampaa/org.apache.cordova.startapp

https://github.com/dmedvinsky/cordova-startapp

关于android - PhoneGap - 调用另一个应用程序 (AngryBirds),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16936031/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com