No description, website, or topics provided.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
android
configs
examples
ios
playground
src
.gitignore
JpushWeexPlugin.podspec
LICENSE
README.md
package.json
start
webpack.config.js

README.md

jpush-weex-plugin

Install

iOS

  • 通过 Pod 安装
$ pod install JPushWeexPlugin --save
  • ./src/index.js 文件添加到自己的工程中。

  • 在 Appdelegate.m 中添加如下代码

    // 1. 添加头文件
    #ifdef NSFoundationVersionNumber_iOS_9_x_Max
    #import <UserNotifications/UserNotifications.h>
    #endif
    #import <JPush/JPUSHService.h>
    #import <JpushWeexPluginModule.h>
    
    // 2. 应用启动的时候初始化插件,(这个地方很重要)
    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
    {
    // your code
    
        [[[JPushWeexPluginModule alloc] init] setupWithOption:launchOptions
                                                        appKey:@"a1703c14b186a68a66ef86c1"
                                                       channel:nil
                                              apsForProduction:nil];
    }
    
    // 3. 添加接收事件代码
    - (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken
    {
        [JPUSHService registerDeviceToken:deviceToken];
    }
    
    - (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo
    {
        [[NSNotificationCenter defaultCenter] postNotificationName:kJPFDidReceiveRemoteNotification object:userInfo];
    }
    
    - (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification
    {
        [[NSNotificationCenter defaultCenter] postNotificationName:kJPFDidReceiveRemoteNotification object: notification.userInfo];
    }
    
    - (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)   (UIBackgroundFetchResult))completionHandler
    {
        [[NSNotificationCenter defaultCenter] postNotificationName:kJPFDidReceiveRemoteNotification object:userInfo];
    }

Android

APIs

参考 ./src/index.js.

Usage

导入 index.js 文件。

import JPush from './src/index.js';

JPush.init()

Examples: examples