react-native-aliyun-push
Advanced tools
Comparing version 1.0.13 to 1.0.14
{ | ||
"name": "react-native-aliyun-push", | ||
"version": "1.0.13", | ||
"version": "1.0.14", | ||
"description": "A react native wrapper for aliyun push SDK", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -8,2 +8,10 @@ # react-native-aliyun-push | ||
### 修改履历 | ||
v1.0.14 | ||
1. 修正ios未启动app点击通知提示不在主线程执行 | ||
2. 升级ShortcutBadger v1.1.22 | ||
3. 升级阿里云移动推送sdk android v3.1.4 | ||
4. 支持android8.0推送通道设置(MainApplication中加入代码有更新,注意查看readme.MD历史确认代码变更点),[阿里云文档](https://help.aliyun.com/knowledge_detail/67398.html) | ||
v1.0.13 | ||
@@ -134,2 +142,9 @@ 1. 更新android build tool到v26.0.3 | ||
// 下面是被添加的代码 | ||
import android.app.NotificationChannel; | ||
import android.app.NotificationManager; | ||
import android.content.Context; | ||
import android.graphics.Color; | ||
import android.os.Build; | ||
import org.wonday.aliyun.push.AliyunPushPackage; | ||
@@ -142,2 +157,3 @@ | ||
import com.alibaba.sdk.android.push.register.MiPushRegister; | ||
import com.alibaba.sdk.android.push.register.GcmRegister; | ||
// 添加结束 | ||
@@ -159,3 +175,2 @@ ... | ||
super.onCreate(); | ||
SoLoader.init(this, /* native exopackage */ false); | ||
@@ -173,2 +188,5 @@ //下面是添加的代码 | ||
private void initCloudChannel() { | ||
// 创建notificaiton channel | ||
this.createNotificationChannel(); | ||
PushServiceFactory.init(this.getApplicationContext()); | ||
@@ -192,3 +210,30 @@ CloudPushService pushService = PushServiceFactory.getCloudPushService(); | ||
HuaWeiRegister.register(this.getApplicationContext()); | ||
// 接入FCM/GCM初始化推送 | ||
GcmRegister.register(applicationContext, "send_id", "application_id"); | ||
} | ||
private void createNotificationChannel() { | ||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { | ||
NotificationManager mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); | ||
// 通知渠道的id | ||
String id = "1"; | ||
// 用户可以看到的通知渠道的名字. | ||
CharSequence name = "notification channel"; | ||
// 用户可以看到的通知渠道的描述 | ||
String description = "notification description"; | ||
int importance = NotificationManager.IMPORTANCE_HIGH; | ||
NotificationChannel mChannel = new NotificationChannel(id, name, importance); | ||
// 配置通知渠道的属性 | ||
mChannel.setDescription(description); | ||
// 设置通知出现时的闪灯(如果 android 设备支持的话) | ||
mChannel.enableLights(true); | ||
mChannel.setLightColor(Color.RED); | ||
// 设置通知出现时的震动(如果 android 设备支持的话) | ||
mChannel.enableVibration(true); | ||
mChannel.setVibrationPattern(new long[]{100, 200, 300, 400, 500, 400, 300, 200, 400}); | ||
//最后在notificationmanager中创建该通知渠道 | ||
mNotificationManager.createNotificationChannel(mChannel); | ||
} | ||
} | ||
// 添加结束 | ||
@@ -195,0 +240,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
40079199
539