赞
踩
看过源码,其实就是一个HashMap的对象,我们在build.gradle中写入,然后映射到AndroidMainfest.xml中,HashMap对象放置在activityInfo.metaData中,我们可以通过activityInfo.metaData.keyset()查看所有设置的值
第一种:
defaultConfig {
applicationId "xxx.xxxxxx.xxxxxx"
minSdkVersion 20
targetSdkVersion 18
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
manifestPlaceholders = [
"WEATCH_APPID": "--------------",
]
}
buildTypes {
debug {
signingConfig signingConfigs.debug
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-project.txt'
manifestPlaceholders = [
"WEATCH_APPID": "--------------",
]
}
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
第二种:
compileSdkVersion 18
buildToolsVersion '27.0.2'
defaultConfig {
applicationId "xxx.xxxxx.xxxxx"
minSdkVersion 20
targetSdkVersion 18
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
manifestPlaceholders = [
"WEATCH_APPID": "dddddddd",
]
}
第三种:
compileSdkVersion 18
buildToolsVersion '27.0.2'
defaultConfig {
applicationId "xxx.xxxxxx.xxxxxxx"
minSdkVersion 20
targetSdkVersion 18
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
productFlavors {
google {
manifestPlaceholders.put("UMENG_CHANNEL","google")
}
baidu {
manifestPlaceholders.put("UMENG_CHANNEL","baidu")
}
}
}
第一种:直接使用
比如极光receiver
<receiver
android:name=".jpush.MyReceiver"
android:enabled="true">
<intent-filter>
<!--Required 用户注册SDK的intent-->
<action android:name="cn.jpush.android.intent.REGISTRATION" />
<!--Required 用户接收SDK消息的intent-->
<action android:name="cn.jpush.android.intent.MESSAGE_RECEIVED" />
<!--Required 用户接收SDK通知栏信息的intent-->
<action android:name="cn.jpush.android.intent.NOTIFICATION_RECEIVED" />
<!--Required 用户打开自定义通知栏的intent-->
<action android:name
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。