diff --git a/app/build.gradle b/app/build.gradle index fcb1709..f8e20ef 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -15,10 +15,29 @@ android { versionName "1.0" 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 { + debug { + signingConfig signingConfigs.debug + } release { + signingConfig signingConfigs.debug minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' } @@ -31,7 +50,6 @@ android { jvmTarget = '1.8' } } - dependencies { implementation 'androidx.core:core-ktx:1.7.0' @@ -42,6 +60,6 @@ dependencies { androidTestImplementation 'androidx.test.ext:junit:1.1.3' 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') } \ No newline at end of file diff --git a/config.gradle b/config.gradle index 4676407..a98d5a7 100644 --- a/config.gradle +++ b/config.gradle @@ -1,6 +1,18 @@ ext { - maven = [ + mavenXuqm = [ + mavenUrl: 'http://127.0.0.1:1022/repository/maven-releases/', 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', ] } \ No newline at end of file diff --git a/keystores/wsecx.keystore b/keystores/wsecx.keystore new file mode 100644 index 0000000..732a6a8 Binary files /dev/null and b/keystores/wsecx.keystore differ diff --git a/push/build.gradle b/push/build.gradle index 5fc950f..f5c8b6c 100644 --- a/push/build.gradle +++ b/push/build.gradle @@ -7,8 +7,6 @@ plugins { def versionCode = 1 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 { namespace 'cn.org.bjca.trust.push' @@ -50,10 +48,20 @@ android { kotlinOptions { jvmTarget = '1.8' } -} +} +repositories{ + flatDir { + dirs 'libs' + } +} +repositories { + flatDir { + dirs 'libs' + } +} dependencies { - + implementation fileTree(dir: 'libs',includes: ['*.jar','*.aar']) implementation 'androidx.core:core-ktx:1.7.0' implementation 'androidx.appcompat:appcompat:1.4.1' implementation 'com.google.android.material:material:1.5.0' @@ -66,6 +74,9 @@ dependencies { kapt("androidx.room:room-compiler:2.5.0") // implementation("androidx.room:room-ktx:2.5.0") + // 小米推送 +// implementation (name: 'MiPush_SDK_Client_5_3_0-C_3rd', ext: 'aar') + } // 这个是把源码打入aar包中的任务 @@ -87,7 +98,7 @@ afterEvaluate { // 这里除了有debug 还有release from components.release // 运行任务,把源码打进去 -// artifact sourceJar + artifact sourceJar } } // 添加仓库地址 @@ -95,19 +106,19 @@ afterEvaluate { maven { allowInsecureProtocol(true) name = "xuqm" - url = mavenUrl + url = mavenXuqm.mavenUrl credentials { - username(maven.username) - password(maven.password) + username(mavenXuqm.username) + password(mavenXuqm.password) } } maven { allowInsecureProtocol(true) name = "szyx" - url = mavenUrlN + url = mavenSzyx.mavenUrl credentials { - username("deployment") - password("deployment123") + username(mavenSzyx.username) + password(mavenSzyx.password) } } } diff --git a/push/libs/MiPush_SDK_Client_5_3_0-C_3rd.aar b/push/libs/MiPush_SDK_Client_5_3_0-C_3rd.aar new file mode 100644 index 0000000..b700d22 Binary files /dev/null and b/push/libs/MiPush_SDK_Client_5_3_0-C_3rd.aar differ diff --git a/push/src/main/AndroidManifest.xml b/push/src/main/AndroidManifest.xml index 35555e6..a51977d 100644 --- a/push/src/main/AndroidManifest.xml +++ b/push/src/main/AndroidManifest.xml @@ -6,5 +6,7 @@ android:name=".provider.PushProvider" android:authorities="${applicationId}.szyx.push" android:exported="false" /> + + \ No newline at end of file diff --git a/push/src/main/java/cn/org/bjca/trust/push/provider/PushProvider.kt b/push/src/main/java/cn/org/bjca/trust/push/provider/PushProvider.kt index c42c39a..59b5676 100644 --- a/push/src/main/java/cn/org/bjca/trust/push/provider/PushProvider.kt +++ b/push/src/main/java/cn/org/bjca/trust/push/provider/PushProvider.kt @@ -3,6 +3,7 @@ package cn.org.bjca.trust.push.provider import android.content.ContentProvider import android.content.ContentValues import android.content.UriMatcher +import android.content.pm.PackageManager import android.database.Cursor import android.net.Uri 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.db.DbHelper import cn.org.bjca.trust.push.db.device.Device +import com.xiaomi.push.it + class PushProvider : ContentProvider() { @@ -31,6 +34,17 @@ class PushProvider : ContentProvider() { CrashHandler.init() // 初始化唯一码 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 } diff --git a/settings.gradle b/settings.gradle index 9e9e45c..31dfacf 100644 --- a/settings.gradle +++ b/settings.gradle @@ -11,7 +11,7 @@ pluginManagement { } } dependencyResolutionManagement { - repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) + repositoriesMode.set(RepositoriesMode.PREFER_SETTINGS) repositories { maven { url 'http://127.0.0.1:1022/repository/maven-public/'