Get Url from other sources/apps. like when you click share button on YouTube you see a bunch of apps.
How can I implement this ability in my app .
Example - open url with x app .
I have searched on internet but found nothing .
CodePudding user response:
use an intent filter in your manifest file
I just added documentation of deep link by google
https://developer.android.com/training/app-links/deep-linking
CodePudding user response:
Try this, In you manifest, put this in the first activity that will be open when your app launch like your SplashActivity
<intent-filter android:label="testing">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="https" android:host="www.youtube.com" />
</intent-filter>
And retrieve the data from the your by putting the below in the onCreateView() of the Activity
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.splash_activity)
//this is what you need here
val action: String? = intent?.action
val data: Uri? = intent?.data
}
For more clarification. check deep-linking