Deep Link
Deep links are URLs that take users directly to specific content in your app. As a developer, you can set up Android App Links to take users to a link’s specific content directly in your app, bypassing the app-selection dialog, also known as the disambiguation dialog.
To create a link to your app content, you have to add an intent filter that contains three elements action
, data
, and category
in the manifest, which is only possible by creating a specific extension for your application. Learn More About DeepLink
Create a deep link extension for your application
Method 1:
To create an extension from the method 1, we are using AppyBuilder Extension Editor. Follow these steps :
Step I
Go to your browser and open https://editor.appybuilder.com/. Create an account if you haven’t created it yet and add a new project for aix extension. The name of the project will be DeepLink.
Step II
As a default, we have a code of TinyDB, clear that code, and then copy and paste this code I have mentioned below:
import android.app.Activity;
import android.net.Uri;
import android.os.Bundle;
import android.content.Intent;
import android.content.pm.PackageManager;
import com.google.appinventor.components.annotations.DesignerComponent;
import com.google.appinventor.components.annotations.SimpleObject;
import com.google.appinventor.components.common.ComponentCategory;
import com.google.appinventor.components.runtime.AndroidNonvisibleComponent;
import com.google.appinventor.components.runtime.Component;
import com.google.appinventor.components.runtime.ComponentContainer;
import com.google.appinventor.components.annotations.androidmanifest.*;
import com.google.appinventor.components.annotations.UsesActivities;
@DesignerComponent(
version=1,
description="Add deeplink in your application",
category=ComponentCategory.EXTENSION,
nonVisible = true,
iconName=""
)
@UsesActivities(
activities = {@ActivityElement(intentFilters = {@IntentFilterElement(actionElements = {@ActionElement(name = "android.intent.action.VIEW")} ,
categoryElements = {@CategoryElement(name = "android.intent.category.DEFAULT") ,
@CategoryElement(name = "android.intent.category.BROWSABLE")},
dataElements = {@DataElement(scheme = "appinventor",host="DeepLink"),
@DataElement(scheme = "https", host="www.example.com")})} ,
name="com.appybuilder.yourGmailName.DeepLink.DeepLink$DeepActivity")}
)
@SimpleObject(external=true)
public final class DeepLink extends AndroidNonvisibleComponent{
public DeepLink(ComponentContainer container) {
super(container.$form());
}
public static class DeepActivity extends Activity{
@Override
protected void onCreate(Bundle saved){
super.onCreate(saved);
if (getIntent() != null){
Uri uri = getIntent().getData();
if (uri != null){
PackageManager packageManager = getPackageManager();
Intent intent = packageManager.getLaunchIntentForPackage(getPackageName());
intent.putExtra("APP_INVENTOR_START",'"'+ uri.toString() +'"');
startActivity(intent);
finish();
}
}
}
}
}
Step III:
In @dataelements, you have to change the host URL to your desired URL. By default, there is www.example.com, change it to the desired URL.
Step IV:
Since we can’t give the custom package name in appybuilder. The default package name is com.appybuilder.yourGmailName.projectName . So change the name in @UsesActivity 's @dataelements in the name section. For example, if your mail address is [email protected] then you should change it tocom.appybuilder.abcd.DeepLink.DeepLink$DeepActivity
Step V:
Compile the extension and drag and drop that extension.
Then in your blocks add this:
There are no functions in the extension. Just drag and drop that extension. This will add deep link functionality in the manifest of the application.
Method 2: Using Sunny Gupta’s Website
There is a website hosted and developed by vknow360 aka Sunny Gupta. Click here to head over to the website
Go to the website and follow these steps:
Step I
After heading over to the website you will find something like this where you can put two inputs,Scheme and Host. While adding your website for deeplinks, see whether it is connected over http or https. If it is https then addhttps
in the scheme and website host in host input.
For Example:
Step II:
If you are willing to add more links then click on the + button and add as many links as possible. Then verify the captcha and download the extension.
Step III :
The value will be saved in the screen start value. Thus you can modify it according to the need. If you are adding more links then you can use if then , for example:
Thank you.
References:
- Vknow360 aka Sunny Gupta’s open-source - See Here
- How to create deeplink extension by @AppHelper_Studio - See Here
- How to add deeplink support in Kodular using vknow360 website - See Here
- How to create deep link in app contents by Android Developers - See Here
- Overview of deep view by Android Developers - See Here:
If you got any problems then feel free to ask by replying in the post.