2

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')};
});
}

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?

bofanda
  • 10,386
  • 8
  • 34
  • 57
  • What have you tried? Based on a quick reading of the links you provided, it seems like the URL might not even be needed if you don't need to pass extra data to the intent. For example, if you launch the YouTube app, the URL would be the video to open...but with your intent, I'm not sure you even need to pass that extra info. – MBillau Jun 06 '13 at 13:12
  • @MBillau I tried to run the app with `url: https://play.google.com/store/apps/details?id=com.rovio.angrybirds`, but the game doesn't started. Any suggestions? – bofanda Jun 08 '13 at 00:19
  • What happens with an empty `url`? – MBillau Jun 10 '13 at 15:37

1 Answers1

2

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

jcesarmobile
  • 51,328
  • 11
  • 132
  • 176