Android Activity Intent Filter: 选择打开方式/默认使用该应用打开
gradle.build(:app)
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 30
buildToolsVersion "31.0.0"
defaultConfig {
applicationId "com.***.myapp"
minSdkVersion 21
targetSdkVersion 30
versionCode 1
versionName "1.21.8472"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.core:core-ktx:1.0.2'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.google.android.material:material:1.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
}
AndroidManifest.xml
application
<application>
<activity>
</activity>
</application>
activity
<activity android:name=".MyActivity">
<intent-filter>
</intent-filter>
</activity>
intent-filter
<intent-filter>
<action />
<category />
<data />
</intent-filter>
action
<action android:name="android.intent.action.MAIN" />
<action android:name="android.intent.action.VIEW" />
category
<category