Mail link open my app on specific URL - android

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

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

Related

Why Deeplink not working when I am using my custom Host and schema?

I am trying open my app by clicking a link from browser. Its working fine and got the pathPrefix as well when I am using below host and schema which i tried from test sites. The same thing I just changed my host to my application it was not working and its loading in the browser itself.
This one I tried from some site.
android:host="dolap.com"
android:scheme="https"
android:pathPrefix="/id"/>
and the html tag is here
Visit our HTML tutorial
My server host i used is
android:host="ledhis.in"
android:scheme="https"
android:pathPrefix="/id"/>
and the html tag is here
Visit our HTML tutorial
Your code is not enough. So can't say where exactly you have a problem.
Read and follow this instructions: https://medium.com/#muratcanbur/intro-to-deep-linking-on-android-1b9fe9e38abd
I followed these steps and everything worked fine.
If you will have some problems - just let me know
Update
Add this code to your manifest file to that activity which will receive the deep link call:
<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:scheme="http"
android:host="www.example.com"
android:pathPrefix="/gizmos" />
</intent-filter>
Then add intent check:
Intent intent = getIntent();
Uri data = intent.getData();
Add a button to your view that will share your link so you can test it.
Even how you will test it. I didn't find any test logic inside your code.
Also check this 2 links:
Part 1: https://android.jlelse.eu/deep-linking-in-androd-9c853573fdf4
Part 2: https://android.jlelse.eu/deep-linking-in-android-part-2-23e942293032

How can I get URL from banner ad after clicked by user

I am creating an app in which I want that when the
user clicks on Banner ad,(Normally it opens the default browser to handle the redirect process)
Instead of this,
It will not open any browser and only copy the link which is sent to default browser and open it inside my web view.
I want to get the URL from the banner ad.
I had searched on google for it but unfortunately, I did not find anything useful.
Thank you all of you for my help in advance...:-)
This is against the terms of service of your adMob i guess. You can't access the url and open it yourself in webview. But i can suggest you to create your own activity and make it default browser in manifest. I think that will work for you.
Here is example how to do it.
add these filters inside <activity></activity> of your webview activity
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
</intent-filter>
Hope this will help you.

Handling external links in android webview

I want to open my app and load the URL when specific links are clicked.
This is my Manifest for handling external links.
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="http" android:host="www.android.com" />
<data android:scheme="https" android:host="www.android.com" />
</intent-filter>
And for handling incoming links this is the code
intentData = getIntent().getData();
if(intentData !=null){
loadUrl = intentData.toString();
}else {
loadUrl = "https://www.android.com";
}
webView.loadUrl(loadUrl);
Now when I clicked https://www.android.com from external app like whatsapp its loaded in webview but the webview is attached to whatsapp. Check screenshots below.
And if anyone can give me any hints or guide me on how to open my app when I open the URL(https://www.android.com) from Google Chrome(in my phone) will be a great help
For second part of your question:
And if anyone can give me any hints or guide me on how to open my app
when I open the URL(https://www.android.com) from Google Chrome(in my
phone) will be a great help
take a look at this answer:
"Essentially, the Chrome team feels that if a user actually types something into the address bar, no redirect should ever happen. As you've discovered, this is counter to behavior in all other browsers."
Use this line in Manifest file of your Activity which is Handling that intent to avoid such problem.
android:launchMode="singleTask"
You can find detail implementation here, https://developer.android.com/guide/webapps/webview.html
You have to override methods, and handle clicks.

cordova webintent plugin isnt working

I actually want to capture the weblink which can trigger my app to launch.
I am using the code as given below. [written in AndroidManifest.xml].
<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="mysite.com"
android:pathPrefix="/_mobile/"
android:scheme="http"
/>
</intent-filter>
Launching of an app is a success when I try to visit "mysite.com/_mobile". Basically, the aforementioned link is actually a link to the mobile version of my main website. Now, if a user has the app installed, it should open the app rather than the mobile web page. So far, it works great. Now the problem is when I want to navigate to a specific page in an app. for example, "mysite.com/_mobile?productId=103" - this would open a page for productId=103 in mobile web view. But, incase the user has my app installed, how can I redirect him to this productId page in an app.
I did some googling on this topic and stumbled upon a cordova plugin. I added this plugin, so called "Initsogar/cordova-webintent" here. Now, I am using this code,
window.plugins.webintent.getUri(function(url) {
if(url !== "") {
alert("URL was "+url);
}
});
All I want is to get the uri which launched the app. I do not get the desired outcome. I tried to alert some value to check if this code is working or not, it seems its NOT.
see the code that i used for testing:
window.plugins.webintent.getUri(function(url) {
alert(2);
if(url !== "") {
alert("URL was "+url);
}
});
Here, 2 is not alerted. I dont know whats wrong with this plugin. other than this, I have no clue where to start from. any help would be great. :)

invoking an intent using html link

I am trying to implement a new feature for my android application.
scenario :
when some event occurs, the camera sends an email to my (Gmail) account.
on opening the mail, it will have a link (html).
when user clicks on that link, it should launch my application Home activity.
I need to understand :
how to create that html link.
how can i make the link to launch my application Home activity.
kindly help me to understand what all things i need to do in my application.
I used "Blackbelt's" user comment and i was able to get the intent html link working.
But my problem is : i want to use a custom scheme "mobile" instead of "http"
I am using Gmail to use the link. But when i send using custom scheme. Gmail doesnt recogonise as hyperlink. So i cannot click on the link.
Please help me how to use a custom scheme. with gmail
you need to register an intent-filter for your Activity on the AndroidManifest.xml file, defining a custom url. . E.g.
<activity android:name="path.to.YourActivity" >
<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:scheme="https"
android:host="it.is.my.app" />
</intent-filter>
</activity>
So if you press on a link like https://it.is.my.app, you should be prompted with the android intent chooser, with your app

Categories

Resources