Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-native-aliyun-push

Package Overview
Dependencies
Maintainers
1
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-aliyun-push - npm Package Compare versions

Comparing version 1.0.13 to 1.0.14

2

package.json
{
"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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc