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

标签 android cordova native phonegap-plugins webintents

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

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

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/

相关文章:

node.js - 错误! Windows_NT 6.3.9600,windows8无法安装cordova

android - 在 native 代码中捕获信号 (SIGSEGV) 后从 JNI 回调到 Java Android 应用程序代码

Android - 线性布局中的海拔

android - 绕过android usb主机权限确认对话框

android - 解锁屏幕的声音在哪里

javascript - Google Play Store Apache Cordova 漏洞(Cordova 版本应高于 4.1)

android - `cordova run android` 将启动应用程序,但不会安装最新版本

android - 从代号一访问 Android 路径?

winapi - 找不到用于链接的 Ocamlrun.lib

Java Realm 结果在 Java 7 中排序?