npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@edger/cordova-plugin-log2c-aliyun-push

v1.2.3

Published

Cordova Push Plugin,use Aliyun SDK

Downloads

2

Readme

cordova-plugin-aliyunpush

基于 https://github.com/442623641/cordova-plugin-aliyunpush 修改而来

Cordova 阿里云移动推送插件,现只包含MiPushHuawei两个厂商辅助通道,FCMOPPO等后续再补充

依赖说明

  • Android:
    dependencies {
        implementation 'com.aliyun.ams:alicloud-android-push:3.1.6'
        // 三方辅助通道
        implementation 'com.aliyun.ams:alicloud-android-third-push:3.0.10@aar'
        // 华为
        implementation 'com.aliyun.ams:huawei-push:2.6.3.305'
        implementation 'com.aliyun.ams:huawei-push-base:2.6.3.305'
    }
    
  • iOS: 截止日期2020/03/05为止最新的依赖

安装

  • 安装插件

      cordova plugin add cordova-plugin-log2c-aliyun-push \
      --variable ANDROID_APP_KEY="***" \
      --variable ANDROID_APP_SECRET="***" \
      --variable IOS_APP_KEY="***" \
      --variable IOS_APP_SECRET="***" \
      --variable HUAWEI_APPID="***" \
      --variable MIPUSH_APPID="***" \
      --variable MIPUSH_APPKEY="***" \
      --variable CHANNEL_ID="0"
    • 注意
      • *号替换成你自己申请的密钥信息,如无则不填写或保持*号(不影响正常运行)
      • CHANNEL_ID对应Android 8.0的通知通道,根据实际情况填写(Android开发者都懂什么意思)
  • Android端配置(必要)

    1. (推荐)在你项目的config.xml中添加

          <platform name="android">
              <!-- ↓↓↓↓↓↓↓ 以下内容 ↓↓↓↓↓↓↓ -->
              <edit-config file="app/src/mainAndroidManifest.xml" mode="merge" target="manifest/application"
                      xmlns:android="http://schemas.androidcom/apk/res/android">
                      <application android:name="com.alipush.PushApplication" />
              </edit-config>
              <!-- ↑↑↑↑↑↑↑ 以上内容 ↑↑↑↑↑↑↑ -->
          </platform>
    2. 若你已经自定义了Application,则只要在你的Application中调用

          import static com.alipush.PushUtils.initPushService;
          //start
          @Override
              public void onCreate() {
                  super.onCreate();
                  try {
                      initPushService(this);
                  } catch (PackageManager.NameNotFoundException e) {
                      e.printStackTrace();
                  }
              }
          //end

使用

ionic中使用(可选)

typescript大法好添加了ts声明,需要的可以根据下列步骤操作

  1. 根据上面步骤添加plugin
  2. 请切换到**@ionic-native**分支,根据README.md操作使用

API

    /**
     * 获取设备唯一标识deviceId,deviceId为阿里云移动推送过程中对设备的唯一标识(并不是设备UUID/UDID)
     * @param  {Function} successCallback 成功回调
     * @param  {Function} errorCallback   失败回调
     * @return {void}
     */
    getRegisterId: function(successCallback, errorCallback)

    /**
     * 阿里云推送绑定账号名
     * @param  {string} account         账号
     * @param  {Function} successCallback 成功回调
     * @param  {Function} errorCallback   失败回调
     * @return {void}
     */
    bindAccount: function(account, successCallback, errorCallback)

    /**
     * 阿里云推送解除账号名,退出或切换账号时调用
     * @param  {Function} successCallback 成功回调
     * @param  {Function} errorCallback   失败回调
     * @return {void}
     */
    unbindAccount: function(successCallback, errorCallback)

    /**
     * 阿里云推送绑定标签
     * @param  {string[]} tags            标签列表
     * @param  {Function} successCallback 成功回调
     * @param  {Function} errorCallback   失败回调
     * @return {void}
     */
    bindTags: function(tags, successCallback, errorCallback)

    /**
     * 阿里云推送解除绑定标签
     * @param  {string[]} tags            标签列表
     * @param  {Function} successCallback 成功回调
     * @param  {Function} errorCallback   失败回调
     * @return {void}
     */
    unbindTags: function(tags, successCallback, errorCallback)

    /**
     * 阿里云推送解除绑定标签
     * @param  {Function} successCallback 成功回调
     * @param  {Function} errorCallback   失败回调
     * @return {void}
     */
    listTags: function(successCallback, errorCallback)

    /**
     * 添加别名
     * @param  {Function} successCallback 成功回调
     * @param  {Function} errorCallback   失败回调
     * @return {void}
     */
    addAlias: function (alias, successCallback, errorCallback)

    /**
     * 解绑别名
     * @param  {Function} successCallback 成功回调
     * @param  {Function} errorCallback   失败回调
     * @return {void}
     */
    removeAlias: function (alias, successCallback, errorCallback)

    /**
     * 删除别名
     * @param  {Function} successCallback 成功回调
     * @param  {Function} errorCallback   失败回调
     * @return {void}
     */
    listAliases: function (successCallback, errorCallback)

    /**
      * 没有权限时,请求开通通知权限,其他路过
      * @param  string msg  请求权限的描述信息
      * @param {} successCallback
      * @param {*} errorCallback
      */
    requireNotifyPermission:function(msg,successCallback, errorCallback)

    /**
    * 阿里云推送消息透传回调
    * @param  {Function} successCallback 成功回调
    */
    onMessage:function(sucessCallback) ;

    # sucessCallback:调用成功回调方法,注意没有失败的回调,返回值结构如下:
    #json: {
      type:string 消息类型,
      title:string '阿里云推送',
      content:string '推送的内容',
      extra:string | Object<k,v> 外健,
      url:路由(后台发送推送时,在ExtParameters参数里写入url如{url:'demoapp://...'})
    }

    #消息类型
    {
      message:透传消息,
      notification:通知接收,
      notificationOpened:通知点击,
      notificationReceived:通知到达,
      notificationRemoved:通知移除,
      notificationClickedWithNoAction:通知到达,
      notificationReceivedInApp:通知到达打开 app
    }

常见问题

  1. Android 8.0以上无法获取到Token 检查是否配置了network_security_config.xml信息,具体百度了解

  2. iOS无法获取到Token Xcode中确认开启以下两项