Giter Club home page Giter Club logo

Comments (4)

wonday avatar wonday commented on August 21, 2024

角标是server端通过调用阿里云api推送时候设置,
app接到推送后,内部会自动把设置的角标设置到app上。
如果想自己设置角标:
AliyunPush.setApplicationIconBadgeNumber(5);

获取当前角标:

AliyunPush.getApplicationIconBadgeNumber((num)=>{
    console.log("ApplicationIconBadgeNumber:" + num);
});

from react-native-aliyun-push.

Covenanter avatar Covenanter commented on August 21, 2024

@wonday ios你没有测试吧?

from react-native-aliyun-push.

wonday avatar wonday commented on August 21, 2024

目前我的实现方法和你的想法不一样。
我的方法是:

  1. 自己服务器端维护用户通知数量
  2. 给用户通知时把这个数量带过去,
  3. app端这个模块收到通知时把角标设置上去。

目前android和ios都可正常使用。

我看阿里增加了一些接口,就是你想要用的。
他的流程是:

  1. 推送时不用提供角标数量,设置自增标记。
  2. iOS端sdk收到后会设置到角标,同时要求用户把app端角标同步到阿里云服务器供下一次自增用。

阿里云的方案的好处时不用我们app服务端记录角标数, 缺点是没有android对应设置。
你的修改方案可能还不彻底,可能会和我的方案有干扰,我看看能否兼容考虑一下,下个版本修改。

from react-native-aliyun-push.

Covenanter avatar Covenanter commented on August 21, 2024

@wonday 我这边的需求是,接受到消息在icon显示角标数量,点击app进去后,清空所有的数量。在android上是没问题的,由于我使用openAPI推送ios设置自增长角标,角标是由阿里中进行维护。所以我需要置0数量,需要使用到同步的方法。

我在PR中只是在IOS中加了同步角标的方法。

from react-native-aliyun-push.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.