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

@aks-dev/upush

v1.0.69

Published

友盟推送SDK v6.5.4

Downloads

68

Readme

安装

$ npm install @aks-dev/upush --save

or

$ yarn add @aks-dev/upush

配置

android


  • MainApplication.onCreate()
UMCommonHelper.getInstance().preInit(
        this,
        "6285xxxxxd55d",
        "27b961axxxxxx54cf976");

UMPushHelper.getInstance().preSet(
        this,
        null
);

离线推送配置

  • buildscript.repositories
maven { url 'https://developer.huawei.com/repo/' }
  • buildscript.dependencies
classpath 'com.huawei.agconnect:agcp:1.6.0.300'
  • allprojects.repositories
maven { url 'https://developer.huawei.com/repo/' }
maven { url 'https://repo1.maven.org/maven2/' }
  • agconnect-services.json
  • AndroidManifest.xml
<meta-data
    android:name="com.huawei.hms.client.appid"
    android:value="appid=xxxx" />
<meta-data
    android:name="com.vivo.push.api_key"
    android:value="xxxx" />
<meta-data
    android:name="com.vivo.push.app_id"
    android:value="xxxx" />

ios


#import "UMPushHelper.h"
#import "UMCommonHelper.h"

eg:

  • AppDelegate.application...didFinishLaunchingWithOptions()
[[UMCommonHelper share] setAppKey:@"xxx"];
[[UMPushHelper share] registerForRemoteNotificationsWithLaunchOptions:launchOptions];

other functions ...

//==================push============================================

//iOS10以下使用这两个方法接收通知
-(void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler
{
  [[UMPushHelper share] application:application didReceiveRemoteNotification:userInfo fetchCompletionHandler:completionHandler];

}

//iOS10新增:处理前台收到通知的代理方法
-(void)userNotificationCenter:(UNUserNotificationCenter *)center willPresentNotification:(UNNotification *)notification withCompletionHandler:(void (^)(UNNotificationPresentationOptions))completionHandler{
    [[UMPushHelper share] userNotificationCenter:center willPresentNotification:notification withCompletionHandler:completionHandler];
}

//iOS10新增:处理后台点击通知的代理方法
-(void)userNotificationCenter:(UNUserNotificationCenter *)center didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(void (^)(void))completionHandler{
    [[UMPushHelper share] userNotificationCenter:center didReceiveNotificationResponse:response withCompletionHandler:completionHandler];
}

/**
 * 获取deviceToken
 */
- (void)application:(UIApplication *)application
didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken
{
  [[UMPushHelper share] application:application didRegisterForRemoteNotificationsWithDeviceToken:deviceToken];
}

//==================push============================================

js


  • import * as upush from '@aks-dev/upush'

|函数|作用| |:----|:----| |init|sdk冷启动,返回deviceToken| |addListener|监听通知事件| |setBadgeCount|设置角标|

eg:

React.useEffect(() => {
    let subscription = upush.addEventListener((event) => {
        //todo:
    })

    return ()=>{
        subscription.remove()
    }
}, [])