Search code examples
androidcordovaurlintentfiltercrosswalk-runtime

Mail link open my app on specific URL


I'm actually using Crosswalk.
I have some hard restrictions about speaking about my project so i'll try to be as clear as possible.


When I open my app manually, Webview load the home index.html of the website.
But this website is used for WebRTC so, it send an invitation via an e-mail with specific URL.

  • Is that possible to open my own application with URL that I just clicked ?

I checked for some <intent-filter> but I have no clue how to deal with the URL opening.

Hope someone have some solutions or clues.

EDIT:

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

With that I can open my application when I click on a link, but I still need to get the link url and set it as url loaded in my XWalkView.

Example:

https://xxx.xxx.com/join?xertfgf=1
When I click on that, my app open good, but know i want my XWalkView to load this.

Help :c


Solution

  • Problem solved:

    After setting <intent-filter> correclty, if you use Crosswalk ( it will work with classic or Cordova Webview ) just :

    Intent intent = getIntent();
    String link = intent.getDataString();
    xWalkWebView.clearCache(true);
    if(link!=null){
        xWalkWebView.load(link, null);
    } else {
        xWalkWebView.load("file:///android_asset/index.html", null);
    }