@@ -15,10 +15,29 @@ android { | |||||
versionName "1.0" | versionName "1.0" | ||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" | ||||
manifestPlaceholders = [ | |||||
XIAOMI_APP_ID : "2882303761520224743", | |||||
XIAOMI_APP_KEY : "5762022470743", | |||||
] | |||||
} | |||||
signingConfigs { | |||||
debug { | |||||
storeFile file(signing.storeFile) | |||||
storePassword signing.storePassword | |||||
keyAlias signing.keyAlias | |||||
keyPassword signing.keyPassword | |||||
} | |||||
} | } | ||||
buildTypes { | buildTypes { | ||||
debug { | |||||
signingConfig signingConfigs.debug | |||||
} | |||||
release { | release { | ||||
signingConfig signingConfigs.debug | |||||
minifyEnabled false | minifyEnabled false | ||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' | ||||
} | } | ||||
@@ -31,7 +50,6 @@ android { | |||||
jvmTarget = '1.8' | jvmTarget = '1.8' | ||||
} | } | ||||
} | } | ||||
dependencies { | dependencies { | ||||
implementation 'androidx.core:core-ktx:1.7.0' | implementation 'androidx.core:core-ktx:1.7.0' | ||||
@@ -42,6 +60,6 @@ dependencies { | |||||
androidTestImplementation 'androidx.test.ext:junit:1.1.3' | androidTestImplementation 'androidx.test.ext:junit:1.1.3' | ||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' | androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' | ||||
implementation 'cn.org.bjca.trus:push:0.0.1.011' | |||||
// implementation project(path: ':push') | |||||
// implementation 'cn.org.bjca.trus:push:0.0.1.011' | |||||
implementation project(path: ':push') | |||||
} | } |
@@ -1,6 +1,18 @@ | |||||
ext { | ext { | ||||
maven = [ | |||||
mavenXuqm = [ | |||||
mavenUrl: 'http://127.0.0.1:1022/repository/maven-releases/', | |||||
username: 'admin', | username: 'admin', | ||||
password : '1234qwer', | |||||
password: '1234qwer', | |||||
] | |||||
mavenSzyx = [ | |||||
mavenUrl: 'https://nexus.51trust.net/repository/android-hosted/', | |||||
username: 'deployment', | |||||
password: 'deployment123', | |||||
] | |||||
signing = [ | |||||
storeFile: '../keystores/wsecx.keystore', | |||||
storePassword: 'bjca123456', | |||||
keyAlias: 'bjcawsecx', | |||||
keyPassword: 'bjca123456', | |||||
] | ] | ||||
} | } |
@@ -7,8 +7,6 @@ plugins { | |||||
def versionCode = 1 | def versionCode = 1 | ||||
def versionName = "0.0.1.011" | def versionName = "0.0.1.011" | ||||
def mavenUrl = "http://127.0.0.1:1022/repository/maven-releases/" | |||||
def mavenUrlN = "https://nexus.51trust.net/repository/android-hosted/" | |||||
android { | android { | ||||
namespace 'cn.org.bjca.trust.push' | namespace 'cn.org.bjca.trust.push' | ||||
@@ -50,10 +48,20 @@ android { | |||||
kotlinOptions { | kotlinOptions { | ||||
jvmTarget = '1.8' | jvmTarget = '1.8' | ||||
} | } | ||||
} | |||||
} | |||||
repositories{ | |||||
flatDir { | |||||
dirs 'libs' | |||||
} | |||||
} | |||||
repositories { | |||||
flatDir { | |||||
dirs 'libs' | |||||
} | |||||
} | |||||
dependencies { | dependencies { | ||||
implementation fileTree(dir: 'libs',includes: ['*.jar','*.aar']) | |||||
implementation 'androidx.core:core-ktx:1.7.0' | implementation 'androidx.core:core-ktx:1.7.0' | ||||
implementation 'androidx.appcompat:appcompat:1.4.1' | implementation 'androidx.appcompat:appcompat:1.4.1' | ||||
implementation 'com.google.android.material:material:1.5.0' | implementation 'com.google.android.material:material:1.5.0' | ||||
@@ -66,6 +74,9 @@ dependencies { | |||||
kapt("androidx.room:room-compiler:2.5.0") | kapt("androidx.room:room-compiler:2.5.0") | ||||
// implementation("androidx.room:room-ktx:2.5.0") | // implementation("androidx.room:room-ktx:2.5.0") | ||||
// 小米推送 | |||||
// implementation (name: 'MiPush_SDK_Client_5_3_0-C_3rd', ext: 'aar') | |||||
} | } | ||||
// 这个是把源码打入aar包中的任务 | // 这个是把源码打入aar包中的任务 | ||||
@@ -87,7 +98,7 @@ afterEvaluate { | |||||
// 这里除了有debug 还有release | // 这里除了有debug 还有release | ||||
from components.release | from components.release | ||||
// 运行任务,把源码打进去 | // 运行任务,把源码打进去 | ||||
// artifact sourceJar | |||||
artifact sourceJar | |||||
} | } | ||||
} | } | ||||
// 添加仓库地址 | // 添加仓库地址 | ||||
@@ -95,19 +106,19 @@ afterEvaluate { | |||||
maven { | maven { | ||||
allowInsecureProtocol(true) | allowInsecureProtocol(true) | ||||
name = "xuqm" | name = "xuqm" | ||||
url = mavenUrl | |||||
url = mavenXuqm.mavenUrl | |||||
credentials { | credentials { | ||||
username(maven.username) | |||||
password(maven.password) | |||||
username(mavenXuqm.username) | |||||
password(mavenXuqm.password) | |||||
} | } | ||||
} | } | ||||
maven { | maven { | ||||
allowInsecureProtocol(true) | allowInsecureProtocol(true) | ||||
name = "szyx" | name = "szyx" | ||||
url = mavenUrlN | |||||
url = mavenSzyx.mavenUrl | |||||
credentials { | credentials { | ||||
username("deployment") | |||||
password("deployment123") | |||||
username(mavenSzyx.username) | |||||
password(mavenSzyx.password) | |||||
} | } | ||||
} | } | ||||
} | } | ||||
@@ -6,5 +6,7 @@ | |||||
android:name=".provider.PushProvider" | android:name=".provider.PushProvider" | ||||
android:authorities="${applicationId}.szyx.push" | android:authorities="${applicationId}.szyx.push" | ||||
android:exported="false" /> | android:exported="false" /> | ||||
<meta-data android:name="XIAOMI_APP_ID" android:value="_${XIAOMI_APP_ID}"/> | |||||
<meta-data android:name="XIAOMI_APP_KEY" android:value="${XIAOMI_APP_KEY}"/> | |||||
</application> | </application> | ||||
</manifest> | </manifest> |
@@ -3,6 +3,7 @@ package cn.org.bjca.trust.push.provider | |||||
import android.content.ContentProvider | import android.content.ContentProvider | ||||
import android.content.ContentValues | import android.content.ContentValues | ||||
import android.content.UriMatcher | import android.content.UriMatcher | ||||
import android.content.pm.PackageManager | |||||
import android.database.Cursor | import android.database.Cursor | ||||
import android.net.Uri | import android.net.Uri | ||||
import androidx.sqlite.db.SupportSQLiteQueryBuilder | import androidx.sqlite.db.SupportSQLiteQueryBuilder | ||||
@@ -11,6 +12,8 @@ import cn.org.bjca.trust.push.common.CommonHelper | |||||
import cn.org.bjca.trust.push.common.LogHelper | import cn.org.bjca.trust.push.common.LogHelper | ||||
import cn.org.bjca.trust.push.db.DbHelper | import cn.org.bjca.trust.push.db.DbHelper | ||||
import cn.org.bjca.trust.push.db.device.Device | import cn.org.bjca.trust.push.db.device.Device | ||||
import com.xiaomi.push.it | |||||
class PushProvider : ContentProvider() { | class PushProvider : ContentProvider() { | ||||
@@ -31,6 +34,17 @@ class PushProvider : ContentProvider() { | |||||
CrashHandler.init() | CrashHandler.init() | ||||
// 初始化唯一码 | // 初始化唯一码 | ||||
initDevice() | initDevice() | ||||
val manifestField = context!!.packageManager.getApplicationInfo( | |||||
context!!.packageName, | |||||
PackageManager.GET_META_DATA | |||||
).metaData.getString("XIAOMI_APP_ID") | |||||
LogHelper.e("====>${manifestField}") | |||||
// MiPushClient.registerPush(this, APP_ID, APP_KEY); | |||||
return true | return true | ||||
} | } | ||||
@@ -11,7 +11,7 @@ pluginManagement { | |||||
} | } | ||||
} | } | ||||
dependencyResolutionManagement { | dependencyResolutionManagement { | ||||
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) | |||||
repositoriesMode.set(RepositoriesMode.PREFER_SETTINGS) | |||||
repositories { | repositories { | ||||
maven { | maven { | ||||
url 'http://127.0.0.1:1022/repository/maven-public/' | url 'http://127.0.0.1:1022/repository/maven-public/' | ||||