@@ -10,7 +10,7 @@ v1.0.14
10101 . 修正ios未启动app点击通知提示不在主线程执行
11112 . 升级ShortcutBadger v1.1.22
12123 . 升级阿里云移动推送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 )
1414
1515
1616v1.0.13
@@ -171,7 +171,7 @@ import com.alibaba.sdk.android.push.register.GcmRegister;
171171 super.onCreate();
172172
173173 //下面是添加的代码
174- this.initCloudChannel();
174+ this.initCloudChannel(this );
175175 //添加结束
176176 }
177177
@@ -180,14 +180,14 @@ import com.alibaba.sdk.android.push.register.GcmRegister;
180180 * 初始化阿里云推送通道
181181 * @param applicationContext
182182 */
183- private void initCloudChannel() {
183+ private void initCloudChannel(final Context applicationContext ) {
184184
185185 // 创建notificaiton channel
186186 this.createNotificationChannel();
187- PushServiceFactory.init(this.getApplicationContext() );
187+ PushServiceFactory.init(applicationContext );
188188 CloudPushService pushService = PushServiceFactory.getCloudPushService();
189189 pushService.setNotificationSmallIcon(R.mipmap.ic_launcher_s);//设置通知栏小图标, 需要自行添加
190- pushService.register(this.getApplicationContext() , "阿里云appKey", "阿里云appSecret", new CommonCallback() {
190+ pushService.register(applicationContext , "阿里云appKey", "阿里云appSecret", new CommonCallback() {
191191 @Override
192192 public void onSuccess(String responnse) {
193193 // success
@@ -199,9 +199,9 @@ import com.alibaba.sdk.android.push.register.GcmRegister;
199199 });
200200
201201 // 注册方法会自动判断是否支持小米系统推送,如不支持会跳过注册。
202- MiPushRegister.register(this.getApplicationContext() , "小米AppID", "小米AppKey");
202+ MiPushRegister.register(applicationContext , "小米AppID", "小米AppKey");
203203 // 注册方法会自动判断是否支持华为系统推送,如不支持会跳过注册。
204- HuaWeiRegister.register(this.getApplicationContext() );
204+ HuaWeiRegister.register(applicationContext );
205205 // 接入FCM/GCM初始化推送
206206 GcmRegister.register(applicationContext, "send_id", "application_id");
207207 }
0 commit comments