增加极光推送
This commit is contained in:
@@ -51,8 +51,37 @@ android {
|
|||||||
enabled true
|
enabled true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sourceSets {
|
||||||
|
main {
|
||||||
|
jniLibs.srcDir(['libs'])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
flatDir {
|
||||||
|
dirs 'libs'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
buildConfigField "String", "QweatherId", "\"${qweatherConfigs.credential.id}\""
|
buildConfigField "String", "QweatherId", "\"${qweatherConfigs.credential.id}\""
|
||||||
buildConfigField "String", "QweatherKey", "\"${qweatherConfigs.credential.key}\""
|
buildConfigField "String", "QweatherKey", "\"${qweatherConfigs.credential.key}\""
|
||||||
|
|
||||||
|
manifestPlaceholders = [
|
||||||
|
JPUSH_PKGNAME : applicationId,
|
||||||
|
JPUSH_APPKEY : "d779178d9900d4fb5d633678", //JPush 上注册的包名对应的 Appkey.
|
||||||
|
JPUSH_CHANNEL : "developer-default", //暂时填写默认值即可.
|
||||||
|
MEIZU_APPKEY : "MZ-魅族的APPKEY",
|
||||||
|
MEIZU_APPID : "MZ-魅族的APPID",
|
||||||
|
XIAOMI_APPID : "小米的APPID",//JPush5.5.3开始,可以不添加MI-前缀.
|
||||||
|
XIAOMI_APPKEY : "小米的APPKEY",//JPush5.5.3开始,可以不添加MI-前缀.
|
||||||
|
OPPO_APPKEY : "OP-oppo的APPKEY",
|
||||||
|
OPPO_APPID : "OP-oppo的APPID",
|
||||||
|
OPPO_APPSECRET: "OP-oppo的APPSECRET",
|
||||||
|
VIVO_APPKEY : "vivo的APPKEY",
|
||||||
|
VIVO_APPID : "vivo的APPID",
|
||||||
|
HONOR_APPID : "honor的APPID",
|
||||||
|
NIO_APPID : "nio的APPID"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
signingConfigs {
|
signingConfigs {
|
||||||
@@ -69,9 +98,27 @@ android {
|
|||||||
keyAlias rootProject.ext.signingConfigs.crosshatch.keyAlias
|
keyAlias rootProject.ext.signingConfigs.crosshatch.keyAlias
|
||||||
keyPassword rootProject.ext.signingConfigs.crosshatch.keyPassword
|
keyPassword rootProject.ext.signingConfigs.crosshatch.keyPassword
|
||||||
}
|
}
|
||||||
|
|
||||||
|
zhanxun {
|
||||||
|
storeFile file(rootProject.ext.signingConfigs.zhanxun.storeFile)
|
||||||
|
storePassword rootProject.ext.signingConfigs.zhanxun.storePassword
|
||||||
|
keyAlias rootProject.ext.signingConfigs.zhanxun.keyAlias
|
||||||
|
keyPassword rootProject.ext.signingConfigs.zhanxun.keyPassword
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
buildTypes {
|
buildTypes {
|
||||||
|
zhanRuiDebug.initWith(debug)
|
||||||
|
zhanRuiDebug {
|
||||||
|
debuggable true
|
||||||
|
signingConfig signingConfigs.zhanxun
|
||||||
|
}
|
||||||
|
|
||||||
|
zhanRuiRelease.initWith(release)
|
||||||
|
zhanRuiRelease {
|
||||||
|
signingConfig signingConfigs.zhanxun
|
||||||
|
}
|
||||||
|
|
||||||
CrosshatchDebug.initWith(debug)
|
CrosshatchDebug.initWith(debug)
|
||||||
CrosshatchDebug {
|
CrosshatchDebug {
|
||||||
debuggable true
|
debuggable true
|
||||||
@@ -82,6 +129,7 @@ android {
|
|||||||
CrosshatchRelease {
|
CrosshatchRelease {
|
||||||
signingConfig signingConfigs.crosshatch
|
signingConfig signingConfigs.crosshatch
|
||||||
}
|
}
|
||||||
|
|
||||||
debug {
|
debug {
|
||||||
versionNameSuffix "_debug"
|
versionNameSuffix "_debug"
|
||||||
debuggable true
|
debuggable true
|
||||||
@@ -122,6 +170,10 @@ android {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ext {
|
||||||
|
jpush = [version: "5.7.0"]
|
||||||
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
// implementation fileTree(dir: 'libs', include: ['*.jar'])
|
// implementation fileTree(dir: 'libs', include: ['*.jar'])
|
||||||
//Android 4.4+
|
//Android 4.4+
|
||||||
@@ -192,16 +244,59 @@ dependencies {
|
|||||||
//bugly
|
//bugly
|
||||||
implementation 'com.tencent.bugly:crashreport:4.1.9.3'
|
implementation 'com.tencent.bugly:crashreport:4.1.9.3'
|
||||||
implementation 'com.iqiyi.xcrash:xcrash-android-lib:3.0.0'
|
implementation 'com.iqiyi.xcrash:xcrash-android-lib:3.0.0'
|
||||||
|
|
||||||
// 替换成最新版本, 需要注意的是api
|
// 替换成最新版本, 需要注意的是api
|
||||||
// 要与compiler匹配使用,均使用最新版可以保证兼容
|
// 要与compiler匹配使用,均使用最新版可以保证兼容
|
||||||
implementation 'com.alibaba:arouter-api:1.5.2'
|
implementation 'com.alibaba:arouter-api:1.5.2'
|
||||||
annotationProcessor 'com.alibaba:arouter-compiler:1.5.2'
|
annotationProcessor 'com.alibaba:arouter-compiler:1.5.2'
|
||||||
|
|
||||||
|
//推送
|
||||||
|
//阿里云
|
||||||
|
implementation 'com.aliyun.ams:alicloud-android-push:3.9.3'
|
||||||
|
//极光
|
||||||
|
// 此处以JPush 5.6.0 版本为例,注意:从 5.0.0 版本开始可以自动拉取 JCore 包,无需另外配置
|
||||||
|
implementation "cn.jiguang.sdk:jpush:$jpush.version"
|
||||||
|
//若不集成厂商通道,可直接跳过以下依赖
|
||||||
|
// 极光厂商插件版本与接入 JPush 版本保持一致,下同
|
||||||
|
// 接入华为厂商
|
||||||
|
implementation 'com.huawei.hms:push:6.13.0.300'
|
||||||
|
implementation "cn.jiguang.sdk.plugin:huawei:$jpush.version"
|
||||||
|
// 接入 FCM 厂商
|
||||||
|
implementation 'com.google.firebase:firebase-messaging:24.1.0'
|
||||||
|
implementation "cn.jiguang.sdk.plugin:fcm:$jpush.version"
|
||||||
|
// 接入魅族厂商
|
||||||
|
implementation "cn.jiguang.sdk.plugin:meizu:$jpush.version"
|
||||||
|
// JPush Android SDK v5.2.3 开始,需要单独引入 魅族 厂商 aar ,请下载官网 SDK 包并把 jpush-android-xxx-release/third-push/meizu/libs 下的 aar 文件单独拷贝一份到应用 module/libs 下
|
||||||
|
implementation(name: 'push-internal-5.0.5', ext: 'aar')
|
||||||
|
// 接入 VIVO 厂商
|
||||||
|
implementation "cn.jiguang.sdk.plugin:vivo:$jpush.version"
|
||||||
|
// 接入小米厂商
|
||||||
|
implementation "cn.jiguang.sdk.plugin:xiaomi:$jpush.version"
|
||||||
|
// 接入 OPPO 厂商
|
||||||
|
implementation "cn.jiguang.sdk.plugin:oppo:$jpush.version"
|
||||||
|
// JPush Android SDK v4.6.0 开始,需要单独引入 oppo 厂商 aar ,请下载官网 SDK 包并把 jpush-android-xxx-release/third-push/oppo/libs 下的 aar 文件单独拷贝一份到应用 module/libs 下
|
||||||
|
implementation(name: 'com.heytap.msp_V3.7.1', ext: 'aar')
|
||||||
|
//以下为 OPPO 3.1.0 aar需要依赖
|
||||||
|
implementation 'com.google.code.gson:gson:2.10.1'
|
||||||
|
implementation 'commons-codec:commons-codec:1.6'
|
||||||
|
implementation 'androidx.annotation:annotation:1.1.0'
|
||||||
|
// 接入荣耀厂商
|
||||||
|
implementation "cn.jiguang.sdk.plugin:honor:$jpush.version"
|
||||||
|
//需要单独引入荣耀厂商 aar ,请下载官网 SDK 包并把 jpush-android-xxx-release/third-push/honor/libs 下的 aar 文件单独拷贝一份到应用 module/libs 下
|
||||||
|
implementation(name: 'HiPushSDK-8.0.12.307', ext: 'aar')
|
||||||
|
// 接入蔚来厂商
|
||||||
|
implementation "cn.jiguang.sdk.plugin:nio:$jpush.version"
|
||||||
|
//JPush Android SDK v5.6.0 开始需要单独引入蔚来厂商 aar ,请下载官网 SDK 包并把 jpush-android-xxx-release/third-push/nio/libs 下的 aar 文件单独拷贝一份到应用 module/libs 下
|
||||||
|
implementation(name: 'niopush-sdk-v1.0', ext: 'aar')
|
||||||
|
|
||||||
|
|
||||||
//地图组件
|
//地图组件
|
||||||
implementation 'com.baidu.lbsyun:BaiduMapSDK_Map:7.6.4'
|
implementation 'com.baidu.lbsyun:BaiduMapSDK_Map:7.6.4'
|
||||||
//基础定位组件
|
//基础定位组件
|
||||||
implementation 'com.baidu.lbsyun:BaiduMapSDK_Location:9.6.4'
|
implementation 'com.baidu.lbsyun:BaiduMapSDK_Location:9.6.4'
|
||||||
//全量定位组件
|
//全量定位组件
|
||||||
// implementation 'com.baidu.lbsyun:BaiduMapSDK_Location_All:9.6.4'
|
// implementation 'com.baidu.lbsyun:BaiduMapSDK_Location_All:9.6.4'
|
||||||
|
|
||||||
//TTS组件
|
//TTS组件
|
||||||
implementation 'com.baidu.lbsyun:NaviTts:3.2.13'
|
implementation 'com.baidu.lbsyun:NaviTts:3.2.13'
|
||||||
|
|
||||||
|
|||||||
BIN
app/libs/HiPushSDK-8.0.12.307.aar
Normal file
BIN
app/libs/HiPushSDK-8.0.12.307.aar
Normal file
Binary file not shown.
BIN
app/libs/com.heytap.msp_V3.7.1.aar
Normal file
BIN
app/libs/com.heytap.msp_V3.7.1.aar
Normal file
Binary file not shown.
BIN
app/libs/niopush-sdk-v1.0.aar
Normal file
BIN
app/libs/niopush-sdk-v1.0.aar
Normal file
Binary file not shown.
BIN
app/libs/push-internal-5.0.5.aar
Normal file
BIN
app/libs/push-internal-5.0.5.aar
Normal file
Binary file not shown.
@@ -38,6 +38,7 @@
|
|||||||
android:roundIcon="@mipmap/ic_launcher_round"
|
android:roundIcon="@mipmap/ic_launcher_round"
|
||||||
android:supportsRtl="true"
|
android:supportsRtl="true"
|
||||||
android:theme="@style/AppTheme">
|
android:theme="@style/AppTheme">
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:name=".activity.main.MainActivity"
|
android:name=".activity.main.MainActivity"
|
||||||
android:exported="true"
|
android:exported="true"
|
||||||
@@ -67,6 +68,20 @@
|
|||||||
android:launchMode="singleTask"
|
android:launchMode="singleTask"
|
||||||
android:screenOrientation="portrait" />
|
android:screenOrientation="portrait" />
|
||||||
|
|
||||||
|
<service
|
||||||
|
android:name=".service.DialerAccessibilityService"
|
||||||
|
android:exported="true"
|
||||||
|
android:label="@string/accessibility_service_label"
|
||||||
|
android:permission="android.permission.BIND_ACCESSIBILITY_SERVICE">
|
||||||
|
<!-- android:priority="10000" 可提高服务在设置中的权重,排在前面 -->
|
||||||
|
<intent-filter android:priority="10000">
|
||||||
|
<action android:name="android.accessibilityservice.AccessibilityService" />
|
||||||
|
</intent-filter>
|
||||||
|
<meta-data
|
||||||
|
android:name="android.accessibilityservice"
|
||||||
|
android:resource="@xml/accessibility_service_config" />
|
||||||
|
</service>
|
||||||
|
|
||||||
<receiver
|
<receiver
|
||||||
android:name=".receiver.AppChangedReceiver"
|
android:name=".receiver.AppChangedReceiver"
|
||||||
android:enabled="true"
|
android:enabled="true"
|
||||||
@@ -94,19 +109,32 @@
|
|||||||
android:name="com.baidu.location.f"
|
android:name="com.baidu.location.f"
|
||||||
android:enabled="true"
|
android:enabled="true"
|
||||||
android:process=":remote" />
|
android:process=":remote" />
|
||||||
|
|
||||||
|
<!--(jpush|jad)_config_start,jpush和jad公用的组件-->
|
||||||
|
<!-- 可配置android:process参数将PushService放在其他进程中 -->
|
||||||
|
<!--User defined. For test only 继承自cn.jpush.android.service.JCommonService-->
|
||||||
<service
|
<service
|
||||||
android:name=".service.DialerAccessibilityService"
|
android:name=".push.jpush.JpushService"
|
||||||
android:exported="true"
|
android:enabled="true"
|
||||||
android:label="@string/accessibility_service_label"
|
android:exported="false"
|
||||||
android:permission="android.permission.BIND_ACCESSIBILITY_SERVICE">
|
android:process=":pushcore">
|
||||||
<!-- android:priority="10000" 可提高服务在设置中的权重,排在前面 -->
|
<intent-filter>
|
||||||
<intent-filter android:priority="10000">
|
<action android:name="cn.jiguang.user.service.action" />
|
||||||
<action android:name="android.accessibilityservice.AccessibilityService" />
|
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
<meta-data
|
|
||||||
android:name="android.accessibilityservice"
|
|
||||||
android:resource="@xml/accessibility_service_config" />
|
|
||||||
</service>
|
</service>
|
||||||
|
<!--(jpush|jad)_config_end-->
|
||||||
|
|
||||||
|
|
||||||
|
<!-- User defined. For test only 用户自定义接收消息器,3.0.7开始支持,目前新tag/alias接口设置结果会在该广播接收器对应的方法中回调-->
|
||||||
|
<!--since 5.2.0 接收JPush相关事件-->
|
||||||
|
<receiver
|
||||||
|
android:name=".push.jpush.PushMessageService"
|
||||||
|
android:exported="true">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="cn.jpush.android.intent.SERVICE_MESSAGE" />
|
||||||
|
<category android:name="${applicationId}" />
|
||||||
|
</intent-filter>
|
||||||
|
</receiver>
|
||||||
|
|
||||||
<meta-data
|
<meta-data
|
||||||
android:name="com.baidu.lbsapi.API_KEY"
|
android:name="com.baidu.lbsapi.API_KEY"
|
||||||
|
|||||||
@@ -19,6 +19,10 @@ import com.ttstd.dialer.manager.AppManager;
|
|||||||
import com.ttstd.dialer.utils.SystemUtils;
|
import com.ttstd.dialer.utils.SystemUtils;
|
||||||
import com.ttstd.iconloader.IconCacheManager;
|
import com.ttstd.iconloader.IconCacheManager;
|
||||||
|
|
||||||
|
import cn.jiguang.api.JCoreInterface;
|
||||||
|
import cn.jiguang.api.utils.JCollectionAuth;
|
||||||
|
import cn.jpush.android.api.JPushInterface;
|
||||||
|
|
||||||
|
|
||||||
public class BaseApplication extends Application {
|
public class BaseApplication extends Application {
|
||||||
private static final String TAG = "BaseApplication";
|
private static final String TAG = "BaseApplication";
|
||||||
@@ -54,6 +58,26 @@ public class BaseApplication extends Application {
|
|||||||
String rootDir = MMKV.initialize(this);
|
String rootDir = MMKV.initialize(this);
|
||||||
Log.e(TAG, "mmkv root: " + rootDir);
|
Log.e(TAG, "mmkv root: " + rootDir);
|
||||||
|
|
||||||
|
/*jpush start*/
|
||||||
|
JPushInterface.setDebugMode(true);
|
||||||
|
// 调整点一:调用启用推送业务功能代码前增加setAuth调用
|
||||||
|
boolean isPrivacyReady = true; // app根据是否已弹窗获取隐私授权来赋值
|
||||||
|
if (!isPrivacyReady) {
|
||||||
|
// JCore 5.0.4之前版本需要显式设置false
|
||||||
|
if (JCoreInterface.getJCoreSDKVersionInt() < 504) { // 5.0.4版本号对应504
|
||||||
|
JCollectionAuth.setAuth(context, false);
|
||||||
|
}
|
||||||
|
// 所有版本在未授权时都不应初始化SDK
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
JPushInterface.init(this);
|
||||||
|
JPushInterface.setAlias(this, );
|
||||||
|
|
||||||
|
// 调整点二:App用户同意了隐私政策授权,并且开发者确定要开启推送服务后调用
|
||||||
|
// JCore 5.0.4+会自动处理授权状态,可不需要显式设置true
|
||||||
|
JCollectionAuth.setAuth(context, true);
|
||||||
|
/*jpush end*/
|
||||||
|
|
||||||
HeConfig.init(BuildConfig.QweatherId, BuildConfig.QweatherKey);
|
HeConfig.init(BuildConfig.QweatherId, BuildConfig.QweatherKey);
|
||||||
//切换至免费订阅
|
//切换至免费订阅
|
||||||
HeConfig.switchToDevService();
|
HeConfig.switchToDevService();
|
||||||
|
|||||||
@@ -0,0 +1,7 @@
|
|||||||
|
package com.ttstd.dialer.push.jpush;
|
||||||
|
|
||||||
|
import cn.jpush.android.service.JCommonService;
|
||||||
|
|
||||||
|
public class JpushService extends JCommonService {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
package com.ttstd.dialer.push.jpush;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
|
||||||
|
import cn.jpush.android.api.CustomMessage;
|
||||||
|
import cn.jpush.android.api.JPushMessage;
|
||||||
|
import cn.jpush.android.service.JPushMessageReceiver;
|
||||||
|
|
||||||
|
public class PushMessageService extends JPushMessageReceiver {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onMessage(Context context, CustomMessage customMessage) {
|
||||||
|
super.onMessage(context, customMessage);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAliasOperatorResult(Context context, JPushMessage jPushMessage) {
|
||||||
|
super.onAliasOperatorResult(context, jPushMessage);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -8,6 +8,7 @@ buildscript {
|
|||||||
// mavenCentral()
|
// mavenCentral()
|
||||||
maven { url "https://jitpack.io" }
|
maven { url "https://jitpack.io" }
|
||||||
maven { url 'https://developer.huawei.com/repo/' }
|
maven { url 'https://developer.huawei.com/repo/' }
|
||||||
|
maven { url "https://maven.google.com" }
|
||||||
maven { url 'https://maven.aliyun.com/repository/central' }
|
maven { url 'https://maven.aliyun.com/repository/central' }
|
||||||
maven { url "https://maven.aliyun.com/repository/jcenter" }
|
maven { url "https://maven.aliyun.com/repository/jcenter" }
|
||||||
maven { url 'https://maven.aliyun.com/repository/public' }
|
maven { url 'https://maven.aliyun.com/repository/public' }
|
||||||
@@ -28,6 +29,7 @@ allprojects {
|
|||||||
// mavenCentral()
|
// mavenCentral()
|
||||||
maven { url "https://jitpack.io" }
|
maven { url "https://jitpack.io" }
|
||||||
maven { url 'https://developer.huawei.com/repo/' }
|
maven { url 'https://developer.huawei.com/repo/' }
|
||||||
|
maven { url "https://maven.google.com" }
|
||||||
maven { url 'https://maven.aliyun.com/repository/central' }
|
maven { url 'https://maven.aliyun.com/repository/central' }
|
||||||
maven { url "https://maven.aliyun.com/repository/jcenter" }
|
maven { url "https://maven.aliyun.com/repository/jcenter" }
|
||||||
maven { url 'https://maven.aliyun.com/repository/public' }
|
maven { url 'https://maven.aliyun.com/repository/public' }
|
||||||
|
|||||||
@@ -15,6 +15,8 @@ android {
|
|||||||
}
|
}
|
||||||
|
|
||||||
buildTypes {
|
buildTypes {
|
||||||
|
zhanRuiDebug {}
|
||||||
|
zhanRuiRelease {}
|
||||||
CrosshatchDebug {}
|
CrosshatchDebug {}
|
||||||
CrosshatchRelease {}
|
CrosshatchRelease {}
|
||||||
debug {}
|
debug {}
|
||||||
|
|||||||
@@ -9,6 +9,8 @@ android {
|
|||||||
}
|
}
|
||||||
|
|
||||||
buildTypes {
|
buildTypes {
|
||||||
|
zhanRuiDebug {}
|
||||||
|
zhanRuiRelease {}
|
||||||
CrosshatchDebug {}
|
CrosshatchDebug {}
|
||||||
CrosshatchRelease {}
|
CrosshatchRelease {}
|
||||||
debug {}
|
debug {}
|
||||||
|
|||||||
Reference in New Issue
Block a user