0

I am trying to develop an app for my web site using phonegap. So I need to ask 'Would you like to open this link from app?' When someone opens my web's url in app installed device like facebook urls. How can I do that?

1 Answers1

0

I only had to google this: open cordova app from url

Took me 30 seconds at most.

You can add this onto your config.xml:

<preference name="AndroidLaunchMode" value="singleTask" />

<intent-filter>
    <action android:name="android.intent.action.VIEW" />
    <category android:name="android.intent.category.DEFAULT" />
    <category android:name="android.intent.category.BROWSABLE" />
    <data android:host="example.com" android:scheme="http" />
</intent-filter>

As well as this onto your index.html:

function deviceReady() {
    window.plugins.webintent.getUri(function(url) {
        console.log("INTENT URL: " + url);
        //...
    }); 
}

window.plugins.webintent.onNewIntent(function(url) {
    console.log("INTENT onNewIntent: " + url);
});

Note: This is not my code. Found it at how can cordova open app from http or https url?

Bastien Bastien
  • 176
  • 1
  • 9