1

i am trying to open my cordova app from external link like http://www.myurl.com/mypage and when the app opens it throw an alert

Application error: the connection to the server was unsuccesful. (file:///android_asset/www/www.myurl.com/mypage)

i guess i need to handle the incoming url somehow, but this alert is coming right up. tried to use "webintent.onNewIntent" and "webintent.getUri" but without success.

here is my code:

config.xml:

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

android manifest file:

<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="www.myurl.com" android:scheme="http" />
</intent-filter>

index.html

 <script>
    document.addEventListener('deviceready', function () {

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

        window.plugins.webintent.onNewIntent(function (url) {
            console.log("INTENT onNewIntent: " + url);
        }, function (error) {
            console.log(error);
        });
    }, false);
</script>

what am i missing?

user4649102
  • 463
  • 6
  • 13
  • Are the console logs in the two event handlers happening at all? Can you see the logs coming out? It sorta sounds like perhaps you have a different event handler somewhere which is handling this stuff and trying to open the URL as a file, is that possible? – basicallydan Nov 02 '15 at 17:04
  • no it doesn't. the alert is popping before any of my page html or script are loaded, and even before the code in [WebIntent.java](https://github.com/Initsogar/cordova-webintent/tree/master/src/android) – user4649102 Nov 03 '15 at 17:20

1 Answers1

0

figured out the problem...

i had another plugin LaunchMyApp interfering. removing it did the trick.

Taryn
  • 242,637
  • 56
  • 362
  • 405
user4649102
  • 463
  • 6
  • 13