How to add deeplink support in your application?

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 to com.appybuilder.abcd.DeepLink.DeepLink$DeepActivity

Step V:
Compile the extension and drag and drop that extension.
Then in your blocks add this:
blocks (1)
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 add https in the scheme and website host in host input.
For Example:
image

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:
blocks (2)

Thank you.

References:

  1. Vknow360 aka Sunny Gupta’s open-source - See Here
  2. How to create deeplink extension by @AppHelper_Studio - See Here
  3. How to add deeplink support in Kodular using vknow360 website - See Here
  4. How to create deep link in app contents by Android Developers - See Here
  5. Overview of deep view by Android Developers - See Here:

If you got any problems then feel free to ask by replying in the post.

24 Likes

Nice guide @theanonymous :heart_eyes:

first of all nice guide :100: :100: :100: :100:

1 question: site link not working

2 question: I am creating a random 6-digit system created from my application and I will define all of these random links here.

so
For example, the link will be like this
https://app.123456 It will be something like, for example, will I define them one by one?

@theanonymous

thank you

FIKIR_KUMESI

1 Like

Site link is not working :thinking: :thinking:
Its working for me,

What you can do is create link something like this : appwebsite.com/1 , appwebsite.com/2 , appwebsite.com/3 something like this … but you can try anything then your app will be in default app for these link. and when app is open , the values will be saved in start value.
Then you can compare the start value such like this:
If startvalue = appwebsite.com/1 then do something
elseif startvalue=…

You can mess up with this. :sweat_smile:
@FIKIR_KUMESI


And also the source code of extension is available , you can mess up with java code and you can add some more custom functions for your extension too if you have java knowledge.

1 Like

I did not create a site except for a few simple sites
other than video calling :sweat_smile: :sweat_smile: :sweat_smile:
the site does not work, it says there is no such site, I would do it somehow using VPN, but I’ll use the 1st method

How does it point to the app site even though app 1 is to that site ???

thank you

FIKIR_KUMESI

And is this site yours? How did you get so many domains?

thank you

1 Like

This is not my site. and you can use any url . or if you wanted a site for your app , there are available of many domains for free you can use that too. This is not right way to talk about this here. PM me if you have any problem. I will reply you thereby.

1 Like

deeplink from

use start value to get URL inside Kodular application, in fact start value in kodular just only occurs when the screen is first opened

When the application is paused and you reopen it using a deeplink, no new URL will be obtained

Deeplink from @Deep_Host is using special block to get URL, you can get new URL anytime the screen is resume or first opened, but he doesn’t support his extension anymore

For anyone who can make a deeplink extension like the one deephost made please let me know, i am willing to pay for it

Yes, I could not solve it yet, there is a need for such an extension. Now, when you create a link for our application and someone clicks on this link, it will only be opened in our application, it should come.
Create this link as many times as we want or random. should be added in such blocks.

thank you

@theanonymous you have 3 accounts, namely this one, @Amlin and @oseamiya

Only 1 is allowed. So which should i remove. You are not as anonymous as it looks.

3 Likes

Not working Deep Link aix now only in kodular

It is already there.
Just pay a visit to GitHub repo.

1 Like

can you give a link?

i try your website, but it is the same as 3 months ago
https://deep-link.000webhostapp.com/

Deeplink from @Deep_Host is using special block to get URL, you can get new URL anytime the screen is resume or first opened

Your deeplink extension only open URL when screen initiaize, can not any time

Code is there but I forgot to update the website.

I will wait for updates on your website, because some of my friends also want to use your aix, thank you very much for your hard work creating aix deeplink, it is very usefull

Done :+1:
deep-link.000webhostapp.com

1 Like

thanks for updating your website @vknow360

but unfortunately, the app crash when open a deeplink, I just download aix from your web with this settings
image

and kodular with this simple block

image

the app keep crashing, can you help me to solve this problem? or there is a bug ?

Can you post the apk here?

I think you actually can build this simple app in kodular in just 3 minutes @vknow360 , but here is the apk, test123.apk (5.2 MB)

There is something strange.
Apk package name:

Logcat:

E/AndroidRuntime(12646): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.sunny/com.sunny.Screen1}: java.lang.ClassNotFoundException: Didn't find class "com.sunny.Screen1" on path: DexPathList[[zip file "/data/app/com.sunny-1/base.apk"],nativeLibraryDirectories=[/vendor/lib, /system/lib]]

E/AndroidRuntime(12646): 	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2236)

E/AndroidRuntime(12646): 	at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387)

E/AndroidRuntime(12646): 	at android.app.ActivityThread.access$800(ActivityThread.java:151)

E/AndroidRuntime(12646): 	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303)

E/AndroidRuntime(12646): 	at android.os.Handler.dispatchMessage(Handler.java:102)

E/AndroidRuntime(12646): 	at android.os.Looper.loop(Looper.java:135)

E/AndroidRuntime(12646): 	at android.app.ActivityThread.main(ActivityThread.java:5254)

E/AndroidRuntime(12646): 	at java.lang.reflect.Method.invoke(Native Method)

E/AndroidRuntime(12646): 	at java.lang.reflect.Method.invoke(Method.java:372)

E/AndroidRuntime(12646): 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)

E/AndroidRuntime(12646): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)

E/AndroidRuntime(12646): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.sunny.Screen1" on path: DexPathList[[zip file "/data/app/com.sunny-1/base.apk"],nativeLibraryDirectories=[/vendor/lib, /system/lib]]

E/AndroidRuntime(12646): 	at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)

E/AndroidRuntime(12646): 	at java.lang.ClassLoader.loadClass(ClassLoader.java:511)

E/AndroidRuntime(12646): 	at java.lang.ClassLoader.loadClass(ClassLoader.java:469)

E/AndroidRuntime(12646): 	at android.app.Instrumentation.newActivity(Instrumentation.java:1066)

E/AndroidRuntime(12646): 	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2226)

E/AndroidRuntime(12646): 	... 10 more

E/AndroidRuntime(12646): 	Suppressed: java.lang.ClassNotFoundException: com.sunny.Screen1

E/AndroidRuntime(12646): 		at java.lang.Class.classForName(Native Method)

E/AndroidRuntime(12646): 		at java.lang.BootClassLoader.findClass(ClassLoader.java:781)

E/AndroidRuntime(12646): 		at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)

E/AndroidRuntime(12646): 		at java.lang.ClassLoader.loadClass(ClassLoader.java:504)

E/AndroidRuntime(12646): 		... 13 more

E/AndroidRuntime(12646): 	Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available

W/ActivityManager(  516):   Force finishing activity 1 com.sunny/.Screen1

Activity attributes declared in extension:

{"contentProviders":[],"metadata":[],"broadcastReceivers":[],"broadcastReceiver":[],"libraries":[],"services":[],"type":"com.sunny.DeepLink.DeepLink","androidMinSdk":["7"],"activityMetadata":[],"assets":[],"native":[],"permissions":[],"activities":["<activity android:name=\"com.sunny.Screen1\" android:launchMode=\"singleTask\">\n      <intent-filter >\n        <action android:name=\"android.intent.action.VIEW\"/>\n        <category android:name=\"android.intent.category.DEFAULT\"/>\n        <category android:name=\"android.intent.category.BROWSABLE\"/>\n        <data android:scheme=\"http\" android:host=\"www.example.com\"/>\n    <\/intent-filter>\n    <\/activity>\n"]}

Activities declared in app:

I am able to launch app with second activity but not with first.

P.S. same aix is working in ai2.