Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

App Indexing with Ampersand in Deep Link not working

We are trying to implement Google's App Indexing feature. We've added the deep links to our website with the rel-alternate tag in the following format:

android-app://id.of.the.app/scheme/?screen=Product&product=123456

Now we get content mismatch crawling errors. If I use the QR code for testing from here everything works fine. But if I open a crawling error, click on "Open App Page" and use the adb command for testing I can see that everything starting from the ampersand doesn't get passed to the app and therefore my product data cannot be loaded. I suspect that's how the crawler checks the content of the app and that's why we get Content Mismatch Errors.

Also if I use the "Fetch as Google" from the Search Console it looks like everything from the ampersand gets cut off.

I checked on eBay as it is working with their app and that's the link they are using:

android-app://com.ebay.mobile/ebay/link/?nav=item.view&id=221559043026&referrer=http%3A%2F%2Frover.ebay.com%2Froverns%2F1%2F711-13271-9788-0%3Fmpcl%3Dhttp%253A%252F%252Fwww.ebay.com%252Fitm%252FRoxy-Fairness-Backpack-Womens-Red-RPM6-%252F221559043026%253Fpt%253DLH_DefaultDomain_0

They have encoded the ampersand with & but if I do that and test it with the "Fetch as Google" function it doesn't work either.

These users seem to have the same issue, but they didn't share a solution (if they found one):

https://productforums.google.com/forum/#!msg/webmasters/5r7KdetlECY/enYknTVkYU4J https://productforums.google.com/forum/#!topic/webmasters/lswyXKlS-Ik

I'm thankful for any ideas.

Update 1

That's how I'm interpreting the deep link inside the Android app:

Uri data = getIntent().getData();
String scheme = data.getScheme();
if (scheme.equals("scheme")) {
    String screen = data.getQueryParameter("screen");
    if (screen.equals("Product")) {
        String product = data.getQueryParameter("product");
        // Open Product and give it product number as intent data
    }
}

Update 2

Here's the relevant part of our Manifest.xml:

<activity
    android:name="id.of.the.app.StartActivity"
    android:configChanges="orientation|screenSize"
    android:label="@string/app_title"
    android:windowSoftInputMode="adjustPan|stateHidden">

        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>

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

</activity>
like image 579
Michael Schmidt Avatar asked Jul 20 '15 09:07

Michael Schmidt


People also ask

Can you deep link into an app?

Android support on the Google Play store: Google gives app developers the option of passing the original deep link through the Google Play App Store using the Intent: "The deep link should take users directly to the content, without any prompts, interstitial pages, or logins.

How do I configure deeplink?

Adjust Deeplink Generator To use the tool, log in to your Adjust dashboard and open the Menu, where you'll see the 'Deeplink Generator' as an option. Click to open, and you'll find a page to input the information required to create your deep link. Then simply copy and paste into whichever campaign you've set up.

What is the difference between deep links and app links?

When a user click an URL, it might open a dialog which asks the user to select one of multiple apps handling the given URL. On the other hand, An Android App Link is a deep link based on your website URL that has been verified to belong to your website. When user clicks that URL, it opens your app.


1 Answers

Update 3
I'm still trying to understand if it's is possible to avoid a change to the manifest and resubmit the app. With the AndroidManifest you have published, have you tried to change just the rel-alternate tag to include a host (event if it's not included inside the manifest)? For example have you tried with android-app://id.of.the.app/scheme/fakehost/?screen=Product&product=123456 where fakehost is a string? I guess that the syntax of the tag must be android-app://{package_name}/{scheme}/{host_path}so it's neccessary to have an host in the web site (but probably not on the app).


Update 2
After you published the Manifest, I guess you're missing the mandatory 'host' in the data tag of your Intent-Filter.

Get this as reference:

<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="myapp" android:host="link"/>
    <data android:scheme="myapp" android:host="link/"/>
</intent-filter>

and the meta in html should be (android-app://package-name/scheme/host)

<html>
<head>   
<link rel="alternate"
      href="android-app://it.test.testdeeplink/myapp/link/?p1=1&p2=2" />
...
</head>

You probably need to update your app, since your Manifest will have to be fixed.


First, thanks for all clarifications. I guess there is some confusion about deep link (the feature you're implementing) and Chrome Intent (the link that you provided as comment). So, I decided to implement a small project that you can download by my dropbox folder. The project is very simple and has a single activity that prints a line for every parameter received by Intent data (of course if you launch the app by the app launcher you won't see anything). The Activity supports two intent-filter schemas (my-android-app and http), and at the end of MainActivity.java you can find (as comment)

  1. A line to test deep linking against adb and the first schema
  2. A line to test deep linking against adb and the second schema
  3. A simple html page to test the deep link using a browser - the last two href are Intent properly managed by Chrome.

Since I don't have access to your code, and I cannot see if there is any issue, I guess this is the best way to help you and to get my answer accepted :)

like image 79
Mimmo Grottoli Avatar answered Oct 12 '22 12:10

Mimmo Grottoli