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
Related
I have searched SO and the web for a similar issue, and while others appear to have encountered this problem, their solutions are not working for me.
DFL parameter in Firebase Dynamic Links Builder
Starting with Android, I'm attempting to implement the Dynamic Links for my app. The app requires additional parameters on the dynamic link, so I'm manually constructing the link based on the information here: https://firebase.google.com/docs/dynamic-links/create-manually.
I have created my link in the following manner (code abbreviated for purposes of this post)
Uri.Builder builder = new Uri.Builder()
.scheme("https")
.authority(AppPrivate.Invitation.APP_CODE + ".app.goo.gl")
.path("/")
.appendQueryParameter("link", link)
.appendQueryParameter("apn", AppPrivate.PACKAGE)
.appendQueryParameter("dfl", desktopLink);
For my use case the link and desktopLink parameters are the same - they are actual working URLs on my website. Regardless of what device the user hits with the dynamic link, it should perform the desired action. Again, for purposes of simply getting this working, I've linked to our primary website (https://www.mytravelerapp.com).
When I send the invitation from my Android device, I generate an intent based on the code sample here: https://github.com/firebase/quickstart-android/blob/master/invites/app/src/main/java/com/google/firebase/quickstart/invites/MainActivity.java
return new AppInviteInvitation.IntentBuilder(context.getString(R.string.content_trip_invitation_title))
.setMessage(message)
.setDeepLink(uri)
.setCustomImage(Uri.parse(AppPrivate.Invitation.TRIP_INVITE_DEEP_LINK_IMAGE))
.setCallToActionText(context.getString(R.string.content_trip_invitation_cta))
.build();
However, when I receive the invitation via email on my desktop, it always goes to the Play Store listing, no matter what I've added to the initial deep link (DFL, AFL). Here's a sample of the link from the "call to action" button from the email:
https://a3d4u.app.goo.gl/i/225742434763-3bd2c2fa-45f0-4ed8-aca3-37760d27d971
I've not yet implemented the receivers in the android app to listen for incoming links, so I cannot confirm whether or not the deep link behaves appropriately on that platform.
Any recommendations or suggestions on what I'm missing with the desktop link are greatly appreciated.
Thanks!
You're actually wrapping a dynamic link in another dynamic link. Invites itself generates a dynamic link, which doesn't have your DFL parameter, so it is redirecting to the store.
You could try shortening the dynamic link you generate, and sharing via the regular share dialog rather than using Invites.
I am new to Android and am confused on what to put for the URL fields when registering a new client with the Instagram API using their web form.
I'm specifically confused as to what to put for these fields:
Website URL
Valid Redirect URIs
I am making an Android app and it doesn't have a website, so what am I supposed to be putting here?
In my search for an answer that made sense to me, I found this: http://oferei.com/2013/06/serverless-instagram-authentication/
In short, this is what one would need to know about how to fill these fields if they are registering an app that does not have its own website:
Website URL: it doesn't matter what value goes here, I used localhost
Redirect URIs: The article above specifies a custom URI scheme, but this is not supported w/ the Instagram API anymore. However, I did see that also using localhost would work here as well in this article: http://jelled.com/instagram/access-token
Not sure if that is the best practice, but it is a way to get the client ID for an Android app.
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" />
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.
I want to enable users to share a URL+ text with a WhatsApp group. I want this to work both from iPhones and Androids. However my app is in a browser (it's a website). I'm currently looking into 2 options, but both have issues:
1) The first potential solution - sharing directly from the browser.
I checked out WhatsApp's URL schema and used the following URL to share through my app:
"whatsapp://send?text=Hello%2C%20World!"
However there were several problems with this approach:
It seems to work only with iPhones and not with Androids. Is there a comparable solution somewhere for Androids?
It enables to choose who to send to only after you are redirected to WhatsApp, unless you know the address book ID (=abid) of the user. First, I do not know how to access the abid of users? Second, I am trying to send to a group, in which case there is no abid (right?), and therefore it seems impossible to do this. Is that true?
Also, what happens for Android apps? What is the comparable to the abid, for a group, and how do I get it?
2) The second potential solution - creating a native app which is identical with the browser-based app, but this specific part (where we do the "sharing") is native.
However, it seems to me that in this case I have very similar problems to the ones described above:
I can see how to do this for iOS on WhatsApp's website (see the link above). However, does the WhatsApp URL schema work with Android native apps as well?
Again, the address book ID issue is the same. How do I get it? It may be easier to get the abid on iOS given that we are now a native app, but does it exist for a group? And how about the Android app? Would this share to WhatsApp group work there?
Sharing directly from the browser works both in iPhone and Android if you use WhatsApp version 2.11 or higher. As you said it DIDN'T USED TO work in Android.
U can use the same URL
"whatsapp://send?text=Hello%2C%20World!"
Knowing abid is not possible as far as I know.
Hope this was helpful.
Thank You.
in Android you can invite friends from an app using Intent, see the following Code
final ComponentName name = new ComponentName("com.whatsapp", "com.whatsapp.ContactPicker");
Intent oShareIntent = new Intent();
oShareIntent.setComponent(name);
oShareIntent.setType("text/plain");
oShareIntent.putExtra(android.content.Intent.EXTRA_TEXT, "Your Message");
startActivity(oShareIntent);
I hope this solves your problem