intent-filterの追加
AndroidManifest.xmlにintent-filterを追加します
<activity
android:name=".MainActivity"
android:screenOrientaion="portrait">
<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="mailto"/>
<data android:scheme="tel"/>
</intent-filter>
</activity>
<activity
android:name=".SecondActivity"
android:screenOrientaion="portrait">
<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="com.example.hoge"/>
<data android:scheme="http" android:host="www.example.com"/>
</intent-filter>
</activity>
あとはActivityでdataとactionを取得します
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.main)
val action: String? = intent?.action
val data: Uri? = intent?.data
}