@@ -10,7 +10,7 @@ v1.0.14
10
10
1 . 修正ios未启动app点击通知提示不在主线程执行
11
11
2 . 升级ShortcutBadger v1.1.22
12
12
3 . 升级阿里云移动推送sdk android v3.1.4
13
- 4 . 支持android8.0推送通道设置(MainApplication中加入代码有更新,注意查看readme.MD历史确认代码变更点),[ 阿里云文档] ( https://help.aliyun.com/knowledge_detail/67398.html?accounttraceid=86ba30f0-d830-43ff-ae14-4a279fb43df5 )
13
+ 4 . 支持android8.0推送通道设置(MainApplication中加入代码有更新,注意查看readme.MD历史确认代码变更点),[ 阿里云文档] ( https://help.aliyun.com/knowledge_detail/67398.html )
14
14
15
15
16
16
v1.0.13
@@ -171,7 +171,7 @@ import com.alibaba.sdk.android.push.register.GcmRegister;
171
171
super.onCreate();
172
172
173
173
//下面是添加的代码
174
- this.initCloudChannel();
174
+ this.initCloudChannel(this );
175
175
//添加结束
176
176
}
177
177
@@ -180,14 +180,14 @@ import com.alibaba.sdk.android.push.register.GcmRegister;
180
180
* 初始化阿里云推送通道
181
181
* @param applicationContext
182
182
*/
183
- private void initCloudChannel() {
183
+ private void initCloudChannel(final Context applicationContext ) {
184
184
185
185
// 创建notificaiton channel
186
186
this.createNotificationChannel();
187
- PushServiceFactory.init(this.getApplicationContext() );
187
+ PushServiceFactory.init(applicationContext );
188
188
CloudPushService pushService = PushServiceFactory.getCloudPushService();
189
189
pushService.setNotificationSmallIcon(R.mipmap.ic_launcher_s);//设置通知栏小图标, 需要自行添加
190
- pushService.register(this.getApplicationContext() , "阿里云appKey", "阿里云appSecret", new CommonCallback() {
190
+ pushService.register(applicationContext , "阿里云appKey", "阿里云appSecret", new CommonCallback() {
191
191
@Override
192
192
public void onSuccess(String responnse) {
193
193
// success
@@ -199,9 +199,9 @@ import com.alibaba.sdk.android.push.register.GcmRegister;
199
199
});
200
200
201
201
// 注册方法会自动判断是否支持小米系统推送,如不支持会跳过注册。
202
- MiPushRegister.register(this.getApplicationContext() , "小米AppID", "小米AppKey");
202
+ MiPushRegister.register(applicationContext , "小米AppID", "小米AppKey");
203
203
// 注册方法会自动判断是否支持华为系统推送,如不支持会跳过注册。
204
- HuaWeiRegister.register(this.getApplicationContext() );
204
+ HuaWeiRegister.register(applicationContext );
205
205
// 接入FCM/GCM初始化推送
206
206
GcmRegister.register(applicationContext, "send_id", "application_id");
207
207
}
0 commit comments