完成极光推送-小米通道
This commit is contained in:
parent
32e6b7101c
commit
2eb79288c0
@ -1,49 +0,0 @@
|
||||
{
|
||||
"config": {
|
||||
"emas.appKey":"334068743",
|
||||
"emas.appSecret":"64de537f14984159a66ada10e54c6b63",
|
||||
"emas.packageName":"com.skychip.lock",
|
||||
"hotfix.idSecret":"334068743-1",
|
||||
"hotfix.rsaSecret":"MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCrcYP7FeYbeYakUMBa2Z5PtVh7LsuS+CfAM6GUjNUDByktVz2lFmZatFvMHn7xuxg6rgsRMrZ9IFziLC4xGltwHhSsCkr6cNoVZODAIXpowq+/Uwg3Gdbw/SOOT5dV70h5Dt3ztORVlobghCb5D74jgn6pqQVmhpSbrS+7zZTzcyKhsvRbQEx3tLa98uCDdIOjym4Jk0+dANCpVOTCPYbQtxewUKZv4ZcpIF0vwqVmAmNjjK04Bp6rhpM1pSxfIo3k6jwng9E+9iwmQkjk7NsexqyzXGmBywUBpSqFBo4bLLrGByqN/kAMAXpchRCBpx9Q311RHJb1T98n0wRimT5HAgMBAAECggEAClNE2ptgB2mTRVQjsZUHps9KK+kOk6RkaHvzkEnHDm6g+T0W1ll6Ap54JNv1U0OsWuRegEOon/KSBYEZqxVmSmNVZWMdTuX7DGzN6GRbxfFruj8a8I6a1lq4iHqcp61IlRnjHilX0xvEtcLfwgJDtknGrRsj2x/h1Vph1JK2FM9RqupT7O7Jy0ehkpVeyGWYLHcFKFThECRPFLHqAwBIY3aU6wp1G8NxkDRxj+C2cF4/cIEHFa7ZsEmVpNOI01qjntlFylNumuR+Ehz6DBKKT72eeVz+gMpnHs+ILGe0ov54soMobBTisw2dFdP9StHnnjoRwOH/KZx3iySerCqK6QKBgQD8cYrCvGlNl0x/fen1Er0Lfks5yVoYQ1ilMag82W8odNjBlcRFwZ+tCjowh55sA2tlQ+cYJxIhQXa7ukk/ILCz9DIHgmwJy4xDRrXonuUKRIkG7859H2/cA2hFAIgNIl6GxJXhGucnWarwbtgX5I7fdLgWAQrAAPjYgET9E4fJfQKBgQCt29cQp63keXKaV2NPVr+axwyOpF0wBQ5frdUVEsBE0hvtkymWThmdnAMuhFJA9+qb4LPxYUFS/MGPl01KhNoU/t2nJdMIWqGPt5eFf+lvzfyk/Jmr7YzpvcpKgfj0orrlIz5gZO5QajGwjlPYtxcu7FLdh7w46uT+P4J+28ySEwKBgQCn9JcAt0BMalRwIoMNFdmHExDTsp5ptCz/Q4mOao/lV9B7A7zhOFCXXU2XyjNh4+iJKGNRk3UhgR+RCQEAqixGnjrG+kQNREre2+XdjhIPAcg1QEmev9K5i97MwezC6FIB0jtx2Gdgq+zqKKVHSD6yd0KfCTRwyHTH/pdn1Z2rNQKBgHeF/nmdvUeoUqhW0ZhWvAztMO3Tg5kisLoIaMg/Bt2JUNfoZxvE/4lCG1HceCvgBHM7bJnSUbV6vJs52lITuVXbzYg+0bEZlZ6XCd0mjdZmV30Zh5ASFOEQsES+y+drBG/I5fYhDVFNYHHPt0bywEZrA6D20uiSW/GKuez6sM3vAoGATm3cLmUCauphKbaVjUB8bh6w9fvgFJnU5c12wytCy9D6TyxtHO6vL1r/KN51ejp5Ht6MuqOBTJztDcXjLbQMBvmw/SRSqQfeiBzAnUDt9MTy2c8GH135jlhBxgSF6JpeQ56uIXc4/rdM5XH5M5qmM7HJtKcLjlC7GCDIhWEvZM0=",
|
||||
"httpdns.accountId":"100674",
|
||||
"httpdns.secretKey":"6cd4984095d53f6f311424cc9299257b",
|
||||
"appmonitor.tlog.rsaSecret":"MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCW084k+HG1OOaSY2B2N6aj4AOz8RhInqlaFr7BbQrqmPwzHC2Co0N/jmbBbxGP7oPsy7yF9zn/hJiuvzlQfjtK85IXAYUKj7IcLashQUT5lrGYlObCznH2qOPkw8OP+cboP51uWIeXFMYatwXRR05vtWVLEeUhaFE1onzQtcG0YwIDAQAB",
|
||||
"appmonitor.rsaSecret":"MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCW084k+HG1OOaSY2B2N6aj4AOz8RhInqlaFr7BbQrqmPwzHC2Co0N/jmbBbxGP7oPsy7yF9zn/hJiuvzlQfjtK85IXAYUKj7IcLashQUT5lrGYlObCznH2qOPkw8OP+cboP51uWIeXFMYatwXRR05vtWVLEeUhaFE1onzQtcG0YwIDAQAB"
|
||||
},
|
||||
"services": {
|
||||
"hotfix_service":{
|
||||
"status":1,
|
||||
"version":"3.4.0"
|
||||
},
|
||||
"ha-adapter_service":{
|
||||
"status":1,
|
||||
"version":"1.2.3.0-open"
|
||||
},
|
||||
"feedback_service":{
|
||||
"status":1,
|
||||
"version":"3.4.2"
|
||||
},
|
||||
"tlog_service":{
|
||||
"status":1,
|
||||
"version":"1.1.7.0-open"
|
||||
},
|
||||
"httpdns_service":{
|
||||
"status":1,
|
||||
"version":"2.3.5"
|
||||
},
|
||||
"apm_service":{
|
||||
"status":1,
|
||||
"version":"1.1.3.0-open"
|
||||
},
|
||||
"man_service":{
|
||||
"status":1,
|
||||
"version":"1.2.7"
|
||||
},
|
||||
"cps_service":{
|
||||
"status":1,
|
||||
"version":"3.8.8.1"
|
||||
}
|
||||
},
|
||||
"use_maven":true,
|
||||
"proguard_keeplist":"\n#httpdns\n-keep class com.taobao.** {*;}\n-keep class com.alibaba.** {*;}\n-keep class com.ta.**{*;}\n-keep class com.ut.**{*;}\n-dontwarn com.taobao.**\n-dontwarn com.alibaba.**\n-dontwarn com.ta.**\n-dontwarn com.ut.**\n\n#cps\n-keep class com.taobao.** {*;}\n-keep class com.alibaba.** {*;}\n-keep class com.ta.**{*;}\n-keep class com.ut.**{*;}\n-dontwarn com.taobao.**\n-dontwarn com.alibaba.**\n-dontwarn com.ta.**\n-dontwarn com.ut.**\n-keepclasseswithmembernames class ** {\nnative <methods>;\n}\n-keepattributes Signature\n-keep class sun.misc.Unsafe { *; }\n-keep class com.alipay.** {*;}\n-dontwarn com.alipay.**\n-keep class anet.**{*;}\n-keep class org.android.spdy.**{*;}\n-keep class org.android.agoo.**{*;}\n-dontwarn anet.**\n-dontwarn org.android.spdy.**\n-dontwarn org.android.agoo.**\n\n#hotfix\n#基线包使用,生成mapping.txt\n-printmapping mapping.txt\n#生成的mapping.txt在app/buidl/outputs/mapping/release路径下,移动到/app路径下\n#修复后的项目使用,保证混淆结果一致\n#-applymapping mapping.txt\n#hotfix\n-keep class com.taobao.sophix.**{*;}\n-keep class com.ta.utdid2.device.**{*;}\n#防止inline\n-dontoptimize\n\n#man\n-keep class com.taobao.** {*;}\n-keep class com.alibaba.** {*;}\n-keep class com.ta.**{*;}\n-keep class com.ut.**{*;}\n-dontwarn com.taobao.**\n-dontwarn com.alibaba.**\n-dontwarn com.ta.**\n-dontwarn com.ut.**\n\n#feedback\n-keep class com.taobao.** {*;}\n-keep class com.alibaba.** {*;}\n-keep class com.ta.**{*;}\n-keep class com.ut.**{*;}\n-dontwarn com.taobao.**\n-dontwarn com.alibaba.**\n-dontwarn com.ta.**\n-dontwarn com.ut.**\n"
|
||||
}
|
||||
@ -23,7 +23,6 @@ if (flutterVersionName == null) {
|
||||
}
|
||||
|
||||
apply plugin: 'com.android.application'
|
||||
// apply plugin: 'com.aliyun.ams.emas-services' // 引用emas-services插件
|
||||
apply plugin: 'kotlin-android'
|
||||
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
|
||||
|
||||
@ -176,10 +175,9 @@ dependencies {
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
|
||||
implementation('com.amap.api:location:5.6.0')
|
||||
implementation('com.amap.api:3dmap:8.1.0')
|
||||
// implementation 'com.aliyun.ams:alicloud-android-push:3.8.7'
|
||||
// //小米依赖
|
||||
// implementation 'com.aliyun.ams:alicloud-android-third-push-xiaomi:3.8.7'
|
||||
// implementation 'cn.jiguang.sdk:jpush:4.0.9'
|
||||
// implementation 'cn.jiguang.sdk:jcore:2.8.2'
|
||||
// implementation 'cn.jiguang.sdk.plugin:xiaomi:4.0.9'//版本号和对应的JPush版本号相同
|
||||
|
||||
implementation 'cn.jiguang.sdk:jpush:5.2.3'
|
||||
implementation 'com.huawei.hms:push:6.12.0.300'
|
||||
|
||||
implementation 'cn.jiguang.sdk.plugin:xiaomi:5.2.3'
|
||||
}
|
||||
|
||||
@ -48,64 +48,7 @@
|
||||
<category android:name="android.intent.category.LAUNCHER"/>
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<receiver android:name="com.skychip.lock.MyMessageReceiver" android:exported="false">
|
||||
<!-- 为保证receiver安全,建议设置不可导出,如需对其他应用开放可通过android:permission进行限制 -->
|
||||
<intent-filter>
|
||||
<action android:name="com.alibaba.sdk.android.push.intent.MESSAGE"/>
|
||||
</intent-filter>
|
||||
<intent-filter>
|
||||
<action android:name="com.alibaba.push2.action.NOTIFICATION_OPENED"/>
|
||||
</intent-filter>
|
||||
<intent-filter>
|
||||
<action android:name="com.alibaba.push2.action.NOTIFICATION_REMOVED"/>
|
||||
</intent-filter>
|
||||
<intent-filter>
|
||||
<action android:name="com.alibaba.sdk.android.push.RECEIVE"/>
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
|
||||
<service
|
||||
android:name="com.xiaomi.push.service.XMPushService"
|
||||
android:process=":pushservice"
|
||||
tools:replace="android:process">
|
||||
</service>
|
||||
|
||||
<service
|
||||
android:name="com.xiaomi.push.service.XMJobService"
|
||||
android:process=":pushservice"
|
||||
tools:replace="android:process">
|
||||
</service>
|
||||
|
||||
<receiver
|
||||
android:name="com.xiaomi.push.service.receivers.PingReceiver"
|
||||
android:process=":pushservice"
|
||||
tools:replace="android:process">
|
||||
</receiver>
|
||||
<!-- Don't delete the meta-data below.
|
||||
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
|
||||
|
||||
|
||||
|
||||
<!-- <receiver android:name="com.skychip.lock.JPushEventReceiver"-->
|
||||
<!-- android:exported="true">-->
|
||||
<!-- <intent-filter>-->
|
||||
<!-- <action android:name="cn.jpush.android.intent.RECEIVE_MESSAGE" />-->
|
||||
<!-- <category android:name="${applicationId}" />-->
|
||||
<!-- </intent-filter>-->
|
||||
<!-- </receiver>-->
|
||||
<!-- <!– Since JCore2.0.0 Required SDK核心功能–>-->
|
||||
<!-- <!– 可配置android:process参数将Service放在其他进程中;android:enabled属性不能是false –>-->
|
||||
<!-- <!– 这个是自定义Service,要继承极光JCommonService,可以在更多手机平台上使得推送通道保持的更稳定 –>-->
|
||||
<!-- <service android:name=".JPushCustomService"-->
|
||||
<!-- android:enabled="true"-->
|
||||
<!-- android:exported="false"-->
|
||||
<!-- android:process=":pushcore">-->
|
||||
<!-- <intent-filter>-->
|
||||
<!-- <action android:name="cn.jiguang.user.service.action" />-->
|
||||
<!-- </intent-filter>-->
|
||||
<!-- </service>-->
|
||||
</application>
|
||||
|
||||
|
||||
</manifest>
|
||||
</manifest>
|
||||
|
||||
@ -4,20 +4,15 @@ import android.content.Intent
|
||||
import android.net.Uri
|
||||
import android.os.Bundle
|
||||
import android.util.Log
|
||||
import com.alibaba.sdk.android.push.noonesdk.PushServiceFactory
|
||||
import com.aliyun.ams.emas.push.CommonCallback
|
||||
import io.flutter.embedding.android.FlutterActivity
|
||||
import io.flutter.plugin.common.MethodChannel
|
||||
import io.flutter.embedding.engine.FlutterEngine;
|
||||
import io.flutter.plugins.GeneratedPluginRegistrant
|
||||
import android.bluetooth.BluetoothAdapter;
|
||||
import com.alibaba.sdk.android.push.register.MiPushRegister
|
||||
|
||||
class MainActivity: FlutterActivity() {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
// initJPushService()
|
||||
|
||||
GeneratedPluginRegistrant.registerWith(flutterEngine!!)
|
||||
MethodChannel(flutterEngine?.dartExecutor!!.binaryMessenger, "starLockFlutterSend").setMethodCallHandler { call, result ->
|
||||
if (call.method == "loadNativeShare") {
|
||||
|
||||
@ -1,72 +0,0 @@
|
||||
package com.skychip.lock
|
||||
|
||||
import android.content.Context
|
||||
import android.util.Log
|
||||
import com.alibaba.sdk.android.push.MessageReceiver
|
||||
import com.alibaba.sdk.android.push.notification.CPushMessage
|
||||
|
||||
|
||||
class MyMessageReceiver : MessageReceiver() {
|
||||
override fun onNotification(
|
||||
context: Context?,
|
||||
title: String,
|
||||
summary: String,
|
||||
extraMap: Map<String?, String?>
|
||||
) {
|
||||
// TODO处理推送通知
|
||||
Log.e(
|
||||
"MyMessageReceiver",
|
||||
"Receive notification, title: $title, summary: $summary, extraMap: $extraMap"
|
||||
)
|
||||
}
|
||||
|
||||
override fun onMessage(context: Context?, cPushMessage: CPushMessage) {
|
||||
Log.e(
|
||||
"MyMessageReceiver",
|
||||
"onMessage, messageId: " + cPushMessage.getMessageId() + ", title: " + cPushMessage.getTitle() + ", content:" + cPushMessage.getContent()
|
||||
)
|
||||
}
|
||||
|
||||
override fun onNotificationOpened(context: Context?, title: String, summary: String, extraMap: String) {
|
||||
Log.e(
|
||||
"MyMessageReceiver",
|
||||
"onNotificationOpened, title: $title, summary: $summary, extraMap:$extraMap"
|
||||
)
|
||||
}
|
||||
|
||||
protected override fun onNotificationClickedWithNoAction(
|
||||
context: Context?,
|
||||
title: String,
|
||||
summary: String,
|
||||
extraMap: String
|
||||
) {
|
||||
Log.e(
|
||||
"MyMessageReceiver",
|
||||
"onNotificationClickedWithNoAction, title: $title, summary: $summary, extraMap:$extraMap"
|
||||
)
|
||||
}
|
||||
|
||||
protected override fun onNotificationReceivedInApp(
|
||||
context: Context?,
|
||||
title: String,
|
||||
summary: String,
|
||||
extraMap: Map<String?, String?>,
|
||||
openType: Int,
|
||||
openActivity: String,
|
||||
openUrl: String
|
||||
) {
|
||||
Log.e(
|
||||
"MyMessageReceiver",
|
||||
"onNotificationReceivedInApp, title: $title, summary: $summary, extraMap:$extraMap, openType:$openType, openActivity:$openActivity, openUrl:$openUrl"
|
||||
)
|
||||
}
|
||||
|
||||
protected override fun onNotificationRemoved(context: Context?, messageId: String?) {
|
||||
Log.e("MyMessageReceiver", "onNotificationRemoved")
|
||||
}
|
||||
|
||||
companion object {
|
||||
// 消息接收部分的LOG_TAG
|
||||
const val REC_TAG = "receiver"
|
||||
}
|
||||
}
|
||||
@ -1,25 +0,0 @@
|
||||
import android.os.Bundle
|
||||
import android.util.Log
|
||||
import com.alibaba.sdk.android.push.AndroidPopupActivity
|
||||
|
||||
class PopupPushActivity : AndroidPopupActivity() {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
}
|
||||
|
||||
/**
|
||||
* 实现通知打开回调方法,获取通知相关信息
|
||||
* @param title 标题
|
||||
* @param summary 内容
|
||||
* @param extMap 额外参数
|
||||
*/
|
||||
override fun onSysNoticeOpened(title: String, summary: String, extMap: Map<String, String>) {
|
||||
Log.e(
|
||||
"PopupPushActivity",
|
||||
"OnMiPushSysNoticeOpened, title: $title, content: $summary, extMap: $extMap"
|
||||
) }
|
||||
|
||||
companion object {
|
||||
const val TAG = "PopupPushActivity"
|
||||
}
|
||||
}
|
||||
@ -4,17 +4,19 @@ buildscript {
|
||||
google()
|
||||
mavenCentral()
|
||||
mavenLocal()
|
||||
// maven { // 添加Maven仓库地址
|
||||
// url 'https://maven.aliyun.com/nexus/content/repositories/releases/'
|
||||
// }
|
||||
// hms, 若不集成华为厂商通道,可直接跳过
|
||||
maven { url 'https://developer.huawei.com/repo/'}
|
||||
// fcm, 若不集成 FCM 通道,可直接跳过
|
||||
maven { url "https://maven.google.com" }
|
||||
}
|
||||
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:7.1.2'
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||
// 添加emas-services插件
|
||||
// classpath 'com.aliyun.ams:emas-services:1.0.4'
|
||||
// classpath "cn.jiguang.sdk:jpush:4.0.9"
|
||||
// fcm,若不集成 FCM 通道,可直接跳过
|
||||
classpath 'com.google.gms:google-services:4.3.8'
|
||||
// hms,若不集成华为厂商通道,可直接跳过
|
||||
classpath 'com.huawei.agconnect:agcp:1.6.0.300'
|
||||
}
|
||||
|
||||
}
|
||||
@ -24,9 +26,9 @@ allprojects {
|
||||
google()
|
||||
mavenCentral()
|
||||
jcenter()
|
||||
// maven { // 添加Maven仓库地址
|
||||
// url 'https://maven.aliyun.com/nexus/content/repositories/releases/'
|
||||
// }
|
||||
// 配置HMS Core SDK的Maven仓地址。
|
||||
maven {url 'https://developer.huawei.com/repo/'}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -114,6 +114,20 @@ class _MyAppState extends State<MyApp> with WidgetsBindingObserver, BaseWidget {
|
||||
}
|
||||
|
||||
Future<void> initJPushService() async {
|
||||
jpush.addEventHandler(
|
||||
// 接收通知回调方法。
|
||||
onReceiveNotification: (Map<String, dynamic> message) async {
|
||||
print("flutter onReceiveNotification: $message");
|
||||
},
|
||||
// 点击通知回调方法。
|
||||
onOpenNotification: (Map<String, dynamic> message) async {
|
||||
print("flutter onOpenNotification: $message");
|
||||
},
|
||||
// 接收自定义消息回调方法。
|
||||
onReceiveMessage: (Map<String, dynamic> message) async {
|
||||
print("flutter onReceiveMessage: $message");
|
||||
},
|
||||
);
|
||||
jpush.setup(
|
||||
appKey: "7ff37d174c1a568a89e98dad",
|
||||
channel: "flutter_channel",
|
||||
|
||||
@ -1,33 +0,0 @@
|
||||
import 'package:jpush_flutter/jpush_flutter.dart';
|
||||
|
||||
class JPushProvider {
|
||||
final JPush jpush = JPush();
|
||||
|
||||
Future<void> initJPush() async {
|
||||
jpush.setup(
|
||||
appKey: "7ff37d174c1a568a89e98dad",
|
||||
channel: "flutter_channel",
|
||||
production: false,
|
||||
debug: true,
|
||||
);
|
||||
|
||||
jpush.applyPushAuthority(const NotificationSettingsIOS(
|
||||
sound: true,
|
||||
alert: true,
|
||||
badge: true,
|
||||
));
|
||||
|
||||
// // Add event handler
|
||||
// jpush.addEventHandler(
|
||||
// onReceiveNotification: (Map<String, dynamic> message) {
|
||||
// print("Receive notification: $message");
|
||||
// },
|
||||
// onOpenNotification: (Map<String, dynamic> message) {
|
||||
// print("Open notification: $message");
|
||||
// },
|
||||
// onReceiveMessage: (Map<String, dynamic> message) {
|
||||
// print("Receive message: $message");
|
||||
// },
|
||||
// );
|
||||
}
|
||||
}
|
||||
@ -113,7 +113,6 @@ dependencies:
|
||||
#网络图片缓存
|
||||
cached_network_image: ^3.2.0
|
||||
webview_flutter: ^4.2.3
|
||||
aliyun_push: ^0.1.6
|
||||
jpush_flutter: ^2.5.1
|
||||
|
||||
#视频播放器
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user