How to launch Android app from link in an e-mail (GMail) - android

I want to be able to launch the android StubHub application from a link in an email. You can find an example of this link if you google "Giants Tickets" using a mobile device. Here is the anchoring code on google's search page that will launch StubHub's app and show a list of SF Giants events.
<a class="_Mek" data-packageid="com.stubhub" data-url="intent://stubhub.com/?performer_id=197&GCID=AppLinks:Performer#Intent;scheme=stubhub;package=com.stubhub;S.browser_fallback_url=https%3A%2F%2Fwww.stubhub.com%2Fsan-francisco-giants-tickets%2Fperformer%2F197%2F;S.android.intent.extra.REFERRER_NAME=https%3A%2F%2Fwww.google.com;launchFlags=0x8080000;end" data-weburl="https://www.stubhub.com/san-francisco-giants-tickets/performer/197/" href="https://www.stubhub.com/san-francisco-giants-tickets/performer/197/" jsaction="bct.cbc" data-ved="0ahUKEwjgid2GmcjVAhVRzWMKHTlaDoQQjjgIXzAA">San Francisco Giants tickets - SF Giants tickets on StubHub!</a>
I'm assuming google has additional code on the search page that interacts with the html above.
How would I include a similar link in an e-mail that, when clicked, would launch the android app and take me to the Giants tickets page?

You can try Deep Links to App Content, Check here

Muthukrishnan is right, it looks like Google is using a Stubhub deeplink here. Therefore, Stubhub presumably already has built in support for deeplinks and it just a matter of reverse engineering that Google link. Trying starting by creating a link to something like this:
intent://stubhub.com/?performer_id=197
I would bet that Stubhub's app already has a manifest line of something like:
<intent-filter>
<data android:scheme="intent" android:host="stubhub.com" />
</intent-filter>
And performer_id 197 is probably the ID for the Giants.

Related

Android deep link using intent not opening app

I am trying to open an app that I made from mobile chrome browser.
https://developer.chrome.com/multidevice/android/intents
From this link, I figured that I must use the "intent:" syntax to do the job.
However, my app doesn't open. Instead, it opens the Google Play Store, but the store just shows the "item not found" page.
I would love to know if I'm doing anything wrong.
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="myscheme" android:host="myhost" android:path="/"/>
</intent-filter>
This is the intent filter that I wrote.
var androidIntentUrl = 'intent://myhost/#Intent;scheme=myscheme;package=my.test.app.package;end';
if(!isIOS && isChromeAndBiggerThanVer25()) {
location.href = androidIntentUrl;
}
And this is what I wrote on the web.
Must the app be released on Play Store to make this happen?
I don't quite understand the whole stuff yet.
I want to know what's wrong.
PS) The names "myscheme" and "myhost" are just names that I made up for writing this question. The actual names in my code match those written in my project settings and all, including the package name.
As Alexey commented on my post,
<a href="myscheme://myhost/some/other/parameters">
worked just okay for me.
I double checked the official document (the link on my post) and my chrome version (which is 71), so I have no idea why the intent:// syntax did not work.
I guess there were changes on mobile Chrome after version 25 that I missed or couldn't find.
I just encountered the same problem where linking with Intents did not work but the direct scheme linking did. However, I didn't want to use the direct version to have a fallback redirect to the PlayStore.
The solution was that the package parameter in the intent link did not have to match the package given in the AndroidManifest.xml. I was working with a Unity project and had to use the bundle name given in the project setting.
tl;dr: this is still working in Chrome (v78), but the package parameter is not necessarily the package given in the manifest.
The package parameter should match your application id (found in build.gradle or your AndroidManifest.xml)
The sample code above shows package as my.test.app.package, if this is not your app package name or if the app is not installed, the intent will default to the Google Play Store to search for it. Similarly, it would be best change the host and scheme parameters to something custom to your app if you haven't already.
My answer is to open android application from web app using deep linking:
Flipkart - Open Flipkart!
WhatsApp - Open WhatsApp!
Clash Royale - Open Clash Royale!
FaceBook - Open FaceBook!
If the listed application is installed in your mobile then only it will open or you have to handle the case separately.

APP URI for app Indexing an android app

I have an android application. I want to implement App Indexing for my App.
I have followed the Google developer links
https://developers.google.com/app-indexing/android/publish
https://developers.google.com/app-indexing/reference/deeplinks
https://developer.android.com/training/app-indexing/deep-linking.html
https://support.google.com/googleplay/android-developer/answer/6041489
I got to know few things from the links
I need to verify my website
Use app indexing API in my Activity
The things that I did not understand
What is the website should I verify?
what should I give for APP_URI & WEB_URL?
static final Uri APP_URI = Uri.parse("android-app://com.example.android.recipes/http/recipe-app.com/recipes");
static final Uri WEB_URL = Uri.parse("http://recipe-app.com/recipes/");
What is the Schema to host my links?
android-app://{package_name}/{scheme}/{host_path}
What is the 'data' should I give in Manifest file.
Think I'm very New to to android development. Any examples are most helpful. Thanks in Advance.
So you already started well using Google's provided example to better understand how App-Indexing works. With that covered, I'd recommend you to follow also the best pratices present here:
https://developer.android.com/training/app-indexing/index.html .
Now, answering to your points:
1- As you saw with Google's example, it is required that your App has corresponding content on the web that has also been indexed by Google. In this case, the website is:
http://recipe-app.com
It would be best if you verify both the app & the website. Information on how to associate your website to your App is present in https://developers.google.com/app-indexing/android/publish
Currently App-Indexing only supports Apps that have correspondent websites. However, if you don't have a website you can still show your interest in support App-Indexing in your App by submitting this form https://developers.google.com/app-indexing/app-only .
2- Google advises to use the App-Indexing API and the HTTP intent scheme as best practices, so in this case you will only need the APP_URI. Also with this kind of implementation, you would not need to make any change on the website markup or sitemap. So in each of your App page you should indicate the APP_URI with the URI of the correspondent content in your website.
3- Assuming you're using the HTTP scheme, your deep link would be similar to this:
android-app://my.app.apk/http/mywebsite.com/sub-domain/content1.html
4- The data parameter on your app's manifest file is where you define the deep link intents that your app supports, so using the example of deep link I provided on 3), it should be similar to this:
<data android:scheme="http"
android:host="mywebsite.com"
android:pathPrefix="/sub-domain" />
This intent will support any web URL that start by:
http://mywebsite.com/sub-domain/
Hope this helps.
I think it would be better as follow:
android-app://my.app.apk/http/sub-domain.mywebsite.com/content1.html

Deep linking via Google Search - how it works, and what to put in the manifest?

Background
I need to investigate how to integrate with the new (?) Google search deep linking feature.
The problem
This seems like a relatively new feature that's still not so popular, so I can't find a lot of resources about how it works and how to configure it correctly.
What I've tried
I've read some websites of Google and watched some of its videos:
https://www.youtube.com/watch?v=kYLrK-gD2Yg
https://www.youtube.com/watch?v=UjLJoMWSXts
https://developers.google.com/app-indexing/webmasters/app
https://support.google.com/googleplay/android-developer/answer/6041489
https://developers.google.com/app-indexing/webmasters/appindexingapi
https://developers.google.com/app-indexing/
https://plus.google.com/+AppIndexing/posts
http://googlewebmastercentral.blogspot.co.il/2014/06/android-app-indexing-is-now-open-for.html
from what I understand, I need to register the app, change the data (intent handling) in the manifest for an activity, and change the code of the activity too, but I'm not sure I understand how it all works and what's the best way to configure it.
The questions
Even after that much reading, I would still like to ask some questions about deep linking using Google Search:
First, the basic question, to verify that I know what it's all about: It lets apps to be indexed via the "Google Search" app, but those apps must be installed too. Once the user clicks an item within "Google Search" app, it goes to your app and you get the query. Is this correct? Is there anything more than that?
They wrote that minSdkVersion should be 17 or below (here). How come it's "or below" instead of "or above" ?
For some reason, the query of the examples (like here) are of just simple texts, but the app is shown there. Why is it shown? What in the manifest tells Google-Search that the app can handle this query? The code examples show URLs ...
Is it possible to test the deep linking via Google Search without registering it (here) ? All I've found is how to test it via adb, but I don't understand where in the example (here) is the query that the user enters.
Do the deep linking require an actual website that users can visit via the web browser ? I ask this because there is a step called "Verify website" when registering to the service (here) .
Suppose I want to allow the user to search for a phone number via the app. Should I put "tel:" in the "scheme" (as shown here) part inside the manifest? Or is it something else(or more than that)? Would Google-Search know exactly when to show the app (for example, when the phone number is valid)?
Is it possible to use this feature in case the app isn't installed, so that it would encourage people to download the app, and/or search via a real website?
Even when trying to test it, I've failed. Manifest:
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<!--should match to : https://somehost/search/?number=-->
<data android:scheme="https"
android:host="somehost"
android:pathPrefix="/search/?" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
</intent-filter>
code:
Intent intent = getIntent();
String action = intent.getAction();
Uri data = intent.getData();
Log.d("AppLog", "action:"+action+" data:"+data);
adb command (from here) :
adb shell am start -W
-a android.intent.action.VIEW -d "somehost/search/?050" com.example.user.myappli
cation
Starting: Intent { act=android.intent.action.VIEW dat=somehost/search/?050 pkg=c
om.example.user.myapplication }
Error: Activity not started, unable to resolve Intent { act=android.intent.actio
n.VIEW dat=somehost/search/?050 flg=0x10000000 pkg=com.example.user.myapplicatio
n }
I've even tried the exact sample, but with a different package name, and it still didn't work.
What's wrong here?
Google Search app and google.com in Chrome as well. User needs to be signed-in. If app is installed, clicks will deep link to your app.
If the app is not installed, participating in App Indexing can help drive installs:
http://googlewebmastercentral.blogspot.com/2015/04/drive-app-installs-through-app-indexing.html
Also, an indexed app is considered "mobile-friendly" which is a ranking signal. Look for "finding more mobile friendly search" on the same blog.
If your minSdkVersion is 15, 16, 17 that's okay. If it's 18, then that's not okay.
If your app is indexed by Google, deep links to your app can appear in Google Search results for users that have your app installed. Google learns about your app's supported deep links when you tell Google about these links via website markup, your sitemap, or by connecting your website. Look for "Provide Deep Links" in the app indexing documentation.
In order to see what queries your content could show up for, go to the new Search Console (g.co/searchconsole) and sign in. Then, you need to look at what sort of traffic your website is getting from Google and what impressions and clicks your content is getting for what queries. If your app supports the same links and you've provided these app deep links to Google, then these are the same queries your app deep links should show up for.
For App Indexing, website is required -- need to tell Google mapping from a web URL to an app deep link, either through sitemap, website markup, or by verifying your website. But if you do either a sitemap or markup, you don't need to verify your website. If you're just talking about your app supporting deep linking, a website is not required for that.
You can use whatever scheme you want for your deep links, so I would guess that tel: should work (though haven't tried it myself). However, Google won't automatically know when to show this phone number until you've provided a mapping to your web content. See #3.
Yes. As of April 2015 this is now possible. See link in answer to #1.
Some suggestions:
In the manifest file, make path prefix "/search".
For adb command, try specifying your link as
"https://somehost/search"
If that doesn't work, it's possible you need to enter a website for your host, i.e. you need a domain. If that's not what you want to do, just create a custom scheme for testing purposes, e.g.
<data android:scheme="example"
android:host="gizmos" />

Android Play Store market:// link is no longer working?

I've been redirecting my users for the past year from my domain:
http://example.com/get
to: market://details?id=com.example.myapp
Today I've check this on Nexus 5/LG G3/OnePlus One from the chrome browser app and it stopped working!
Now, when my users try to download the app they are redirected to a broken link.
Anyone know anything about this change in the Chrome app in Android?
from reading the chrome's version 40 release, there are some insight i d like to share
http://blog.chromium.org/2014/12/chrome-40-beta-powerful-offline-and.html
they updated to Content Security Policy Level 2, which has a stronger control over redirects.
https://w3c.github.io/webappsec/specs/content-security-policy/#changes-from-level-1
The path component of a source expression is now ignored if the resource being loaded is the result of a redirect, as described in §4.2.2.3 Paths and Redirects.
Redirects are blocked by default, and explicitly allowed with a new unsafe-redirect expression.
So I did some testing. if your initial action started from redirect (no matter window.location or http 302) it will show an error. but once i created a hyperlink to market:// and explicitly clicked it, it worked fine.
for now i ended up creating a webpage in between, where i ask the user to click the link to proceed.
I was testing this url on different devices with different OS/Play Store/ Play Services/ Browsers. looks like it's related to browser but not OS or Play Services.
Initially I updated Play Services and Google Play Store and my old Chrome (v18) was opening market://details?id= url fine.
Afterward I had updated my Chrome (v18) to version 40. And it's not working any more.
Meanwhile, FireFox and default "Browsers" still opens this url and redirects to Google Play Store app.
P.S. I have registered issue in Chromium bug tracker. Let's see if there will be any response:
https://code.google.com/p/chromium/issues/detail?can=2&q=market&colspec=ID%20Pri%20M%20Week%20ReleaseBlock%20Cr%20Status%20Owner%20Summary%20OS%20Modified&id=454396&thanks=454396&ts=1422888121
UPDATE [6.05.15] : Unfortunately, they decided not to fix this issue, saying, that it's planned behaviour. As they said, user should click the link by himself. Only then re-direct to the app on devices is allowed.
So, there is only one "work-around", that I see for now: create a page, that contains text like "Click link below to go to the app", followed by link like:
Load Example App
or
<a href="intent://foo.bar#Intent;scheme=blabla;package=com.example.myapp;end" > Load App/ Activate your Profile </a>
Try the link below, replacing your.app.id with your own identifier:
https://play.app.goo.gl/?link=https://play.google.com/store/apps/details?id=your.app.id&ddl=1&pcampaignid=web_ddl_1

Sharing link on WhatsApp from mobile website (not application) for Android

I have developed a website which is mainly used in mobile phones.
I want to allow users to share information directly from the web page into WhatsApp.
Using UserAgent detection I can distinguish between Android and iOS.
I was able to discover that in order to implement the above in iOS I can use the URL:
href="whatsapp://send?text=http://www.example.com"
I'm still looking for the solution to be used when the OS is Android (as the above doesn't work).
I guess it is somehow related to using "intent" in Android, but I couldn't figure out how to do it as parameter for href.
Just saw it on a website and seems to work on latest Android with latest chrome and whatsapp now too! Give the link a new shot!
Share via Whatsapp
Rechecked it today (17th April 2015):
Works for me on iOS 8 (iPhone 6, latest versions) Android 5 (Nexus 5, latest versions).
It also works on Windows Phone.
The above answers are bit outdated. Although those method work, but by using below method, you can share any text to a predefined number. The below method works for android, WhatsApp web, IOS etc.
You just need to use this format:
UPDATE-- Use this from now(Nov-2018)
Use: https://wa.me/15551234567
Don't use: https://wa.me/+001-(555)1234567
To create your own link with a pre-filled message that will
automatically appear in the text field of a chat, use
https://wa.me/whatsappphonenumber/?text=urlencodedtext where
whatsappphonenumber is a full phone number in international format and
URL-encodedtext is the URL-encoded pre-filled message.
Example:https://wa.me/15551234567?text=I'm%20interested%20in%20your%20car%20for%20sale
To create a link with just a pre-filled message, use
https://wa.me/?text=urlencodedtext
Example:https://wa.me/?text=I'm%20inquiring%20about%20the%20apartment%20listing
After clicking on the link, you will be shown a list of contacts you
can send your message to.
For more information, see https://www.whatsapp.com/faq/en/general/26000030
Currently, it's very easy to achieve this. You only need to add the following code to your pages:
Share via Whatsapp
And that's it. No Javascript needed, nothing else needed. Of course you can style it as you want and include a nice Whatsapp icon.
I tested this in my Android device with Google Chrome. The versions:
Android 4.1.2 (Jelly Bean)
Chrome Mobile 37.0.2062.117. Also tested on Firefox Mobile 31.0.
Whatsapp V 2.11.399
It also works on iOS. I've made a quick test on an iPhone 5 with Safari and it works as well.
Hope this helps someone. :-)
According to the new documentation, the link is now:
Share this
If it doesn't work, try this one :
Share this
The official docs say to use: wa.me. Don't use wa.me. I apologize for the length of these results, but it's been a rapidly-evolving issue....
April, 2020 Results
Share Link
This link is incorrect. Close this window and try a different link.
May, 2020 Results
Share Link GitHub Ticket: WhatsApp short link without phone number not working anymore
We couldn't find the page you were looking for
Looks like you're looking for a page that doesn't exist. Or a page we might have just deleted. Either way, go back or be sure to check the url, your spelling and try again.
August, 2020 Results
Share Link
Works as expected!
LATEST - October, 2020 Results
Share Link
(Broken again!) og:image tag previews are disabled when using wa.me.
Based on some of the comments I'm seeing, it seems like this still be an intermittent problem, so, going forward, I recommend you stick to the api.whatsapp.com URL!
If you want to share, you must absolutely use one of the two following URL formats:
https://api.whatsapp.com/send?text=YourShareTextHere
https://api.whatsapp.com/send?text=YourShareTextHere&phone=123
If you are interested in watching a project that keeps track of these URLs, then check us out!: https://github.com/bradvin/social-share-urls#whatsapp
Recently WhatsApp updated on its official website that we need to use
this HTML tag in order to make it shareable to mobile sites:
Hello, world!
You can replace text= to have your link or any text content
LATEST UPDATE
Now you can use the latest API from whatsapp https://wa.me/ without worrying about the user agent, the API will do the user agent handling.
Share pre-filled text with contact selection option in respective whatsapp client (Android / iOS / Webapp):
https://wa.me/?text=urlencodedtext
Open Chat Dialog for a particular whatsapp user in respective whatsapp client (Android / iOS / Webapp):
https://wa.me/whatsappphonenumber
Share pre-filled text with a particular user (Combine above two):
https://wa.me/whatsappphonenumber/?text=urlencodedtext
Note : whatsappphonenumber should be full phone number in international format. Omit any zeroes, brackets or dashes when adding the phone number in international format.
For official documentation visit https://faq.whatsapp.com/en/general/26000030
I'm afraid that WhatsApp for Android does not currently support to be called from a web browser.
I had the same requirement for my current project, and since I couldn't find any proper information I ended up downloading the APK file.
In Android, if an application wants to be called from a web browser, it needs to define an Activity with the category android.intent.category.BROWSABLE.
You can find more information about this here: https://developers.google.com/chrome/mobile/docs/intents
If you take a look to the WhatsApp AndroidManifest.xml file, the only Activiy with category BROWSABLE is this one:
<activity android:name="com.whatsapp.Conversation" android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" android:windowSoftInputMode="stateUnchanged">
<intent-filter>
<action android:name="android.intent.action.SENDTO" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="sms" />
<data android:scheme="smsto" />
</intent-filter>
</activity>
I've been playing with it for a while, and I couldn't make it to work. The most I got was to open the WhatsApp application from Chrome, but I couldn't figure out a way to set the message content and recipient.
Since it is not documented by the WhatsApp team, I think this is still work in progress. It looks like in the future WhatsApp will handle SMS too.
The only way to get more information is by reaching the WhatsApp dev team, what I tried, but I'm still waiting for a response.
Regards!
In general it makes sense only to display the Whatsapp Link on iOS or Android Devices only, using java script:
if (navigator.userAgent.match(/iPhone|Android/i)) {
document.write('Share on WhatApp');
}
Just tested the whatsapp:// scheme on my super old Android 2.3.3 with Whats App 2.11.301, works like a charm. It seems to be just the Whats App version. Since Whats App is forcing everyone to update, it should be safe to use it.
The Whats App documentation also mention that scheme: http://www.whatsapp.com/faq/en/android/28000012
I'm using this on a production site now and will update here, if I get any user complaints.
Edit (Nov 14): No user complaints after a couple of weeks.
Switch the whatsapp share links according to the platform whether desktop or mobile.
This works with or without providing the phone number in the link.
For Mobile
vm.LinkTextToShare = 'https://api.whatsapp.com/send?text=' + encodeURIComponent(window.location.href) ;
window.open(vm.LinkTextToShare,"_blank");
For Desktop
vm.LinkTextToShare = 'https://web.whatsapp.com/send?l=en&text=' + encodeURIComponent(window.location.href) ;
window.open(vm.LinkTextToShare,"_blank");
This code worked for me.
After clicking on the link, it will ask you to choose the contact to share a message.
Click here to share on Whatsapp
You can add target="_blank" attribute to open it in a new window or tab.
I don't think the phone number is needed when someone wants to share a particular message or article.
use it like "whatsapp://send?text=" + encodeURIComponent(your text goes here), it will definitely work.
This is correct if you want to open whatsapp in browser:
<a href=`https://web.whatsapp.com/send?text=${yout URL or TEXT}` ><Whatsapp</a>
Try to make it this way:
Link
Even you can send messages without enter the phone number in the link:
Say hello
After clicking on the link, you will be shown a list of contacts you can send your message to.
More info in https://faq.whatsapp.com/en/general/26000030.
Good luck!
Use: https://wa.me/1XXXXXXXXXX
Don't use: https://wa.me/+001-(XXX)XXXXXXX
The pre-filled message will automatically appear in the text field of a chat. Use https://wa.me/whatsappphonenumber?text=urlencodedtext where whatsappphonenumber is a full phone number in international format and urlencodedtext is the URL-encoded pre-filled message.
Example:
https://wa.me/1XXXXXXXXXX?text=I'm%20interested%20in%20your%20car%20for%20sale
To create a link with just a pre-filled message, use https://wa.me/?text=urlencodedtext
Example:
https://wa.me/?text=I'm%20inquiring%20about%20the%20apartment%20listing`
After clicking on the link, you’ll be shown a list of contacts you can send your message to.

Categories

Resources