PhoneGap的 - 调用其他应用程序(AngryBirds) [英] PhoneGap - Call another application (AngryBirds)

查看:317
本文介绍了PhoneGap的 - 调用其他应用程序(AngryBirds)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我实施的PhoneGap的应用程序的Andr​​oid和想打电话给愤怒的小鸟游戏从PhoneGap的应用程序中。经过我快速研究 在这里 此处 我有以下几点:

I'm implementing phonegap based application for android and want to call angry birds game from inside the phonegap app. After my quick research here and here I have following:

/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 我应该为写网址:。任何帮助吗?或者有另一种方式来呼吁从PhoneGap的其它应用?

I'm stuck here and have_no_idea what should be written for url:. Any help? Or there is another way to call for other application from phonegap?

推荐答案

这个Java code应该

This java code should work

Intent LaunchIntent = this.cordova.getActivity().getPackageManager().getLaunchIntentForPackage("com.rovio.angrybirds");
this.cordova.getActivity().startActivity(LaunchIntent);

或尝试打开任何应用程序这两个插件

or try any of this 2 plugins for opening apps

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

https://github.com/dmedvinsky/cordova-startapp <​​/A>

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

这篇关于PhoneGap的 - 调用其他应用程序(AngryBirds)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆