Updated 1 May 2023
In this featured blog, I am gonna show you how to open your application from the web. Generally, you have watched on this feature on Amazon, e-bay or many tv applications.
So let’s start,
Follow the below steps for implementing this feature on your app,
Step 1: Add the intent filter in your manifest file,
1 2 3 4 5 6 |
<intent-filter> <action android:name="com.appopenfromweb.mobikul" /> <category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.BROWSABLE" /> </intent-filter> |
manifest.xml,
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.webkul.openappfromweb" android:versionCode="1" android:versionName="1.0"> <uses-sdk android:minSdkVersion="14" android:targetSdkVersion="21" /> <application android:allowBackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme"> <activity android:name=".MainActivity" android:label="@string/app_name"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> <intent-filter> <action android:name="com.appopenfromweb.mobikul" /> <category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.BROWSABLE" /> </intent-filter> </activity> </application> </manifest> |
Step 2: You have to Create Uri,
for creating uri, add action, categories and extras if you want to send something from browser to app,
1 2 3 4 5 6 |
Intent intent = new Intent("com.appopenfromweb.mobikul"); intent.addCategory(Intent.CATEGORY_DEFAULT); intent.addCategory(Intent.CATEGORY_BROWSABLE); Bundle bundle = new Bundle(); bundle.putString("msg_from_browser", "Launched from Browser"); intent.putExtras(bundle); |
and for converting the above intent in URI, use intent.toUri(Intent.URI_INTENT_SCHEME) method.
1 |
Log.d("mobikul-->", intent1.toUri(Intent.URI_INTENT_SCHEME)); |
Step 3: Add this to the browser side,
After logging you will get below uri,
intent:#Intent;action=com.appopenfromweb.mobikul;category=android.intent.category.DEFAULT;category=android.intent.category.BROWSABLE;S.msg_from_browser=Launched%20from%20Browser;end
Add this uri to your website,
1 |
<a href="intent:#Intent;action=com.appopenfromweb.mobikul;category=android.intent.category.DEFAULT;category=android.intent.category.BROWSABLE;S.msg_from_browser=Launched%20from%20Browser;end">Click this link to launch you app from web</a> |
So you have successfully add this functionality in your app.
Thanks for go through this blog. Stay cool and stay updated.
If you have more details or questions, you can reply to the received confirmation email.
Back to Home
3 comments