极光推送
来源:互联网 发布:淘宝app我的分享在哪里 编辑:程序博客网 时间:2024/04/30 05:00
//APP启动,通知处理
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
//清除所有的通知
[APServiceclearAllLocalNotifications];
//JPush
#if __IPHONE_OS_VERSION_MAX_ALLOWED > __IPHONE_7_1
if ([[UIDevicecurrentDevice].systemVersionfloatValue] >= 8.0) {
//可以添加自定义categories
[APServiceregisterForRemoteNotificationTypes:(UIUserNotificationTypeBadge |
UIUserNotificationTypeSound |
UIUserNotificationTypeAlert)
categories:nil];
} else {
//categories 必须为nil
[APServiceregisterForRemoteNotificationTypes:(UIRemoteNotificationTypeBadge |
UIRemoteNotificationTypeSound |
UIRemoteNotificationTypeAlert)
categories:nil];
}
#else
//categories 必须为nil
[APService registerForRemoteNotificationTypes:(UIRemoteNotificationTypeBadge |
UIRemoteNotificationTypeSound |
UIRemoteNotificationTypeAlert)
categories:nil];
#endif
// Required
[APServicesetupWithOption:launchOptions];
}
- (void)applicationDidEnterBackground:(UIApplication *)application {
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
[[UIApplicationsharedApplication] setApplicationIconBadgeNumber:0];
[APServiceresetBadge];
}
- (void)applicationDidBecomeActive:(UIApplication *)application {
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
[application setApplicationIconBadgeNumber:0];
[APServiceresetBadge];
}
//JPush
- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
// Required
[APServiceregisterDeviceToken:deviceToken];
NSLog(@"deviceToken : %@",deviceToken);
}
- (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error {
NSLog(@"did Fail To Register For Remote Notifications With Error: %@", error);
}
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo {
// Required
[APServicehandleRemoteNotification:userInfo];
NSLog(@"收到通知",);
}
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler {
//NSLog(@"application.applicationState =%d",application.applicationState);
if (userInfo) {
[APServicehandleRemoteNotification:userInfo];
}
completionHandler(UIBackgroundFetchResultNewData);
}
- 极光推送
- 极光推送
- 极光推送
- 极光推送
- 极光推送
- 极光推送
- 极光推送
- 极光推送
- 极光推送
- 极光推送
- 极光推送
- 极光推送
- 极光推送
- 极光推送
- 推送 、极光
- 极光推送
- 极光推送
- 极光推送
- 用户接口指南
- JAVA线程-示例代码
- [线性代数] 矩阵#1
- OC 对象和方法的关系
- 栈和队列基础知识
- 极光推送
- jrtplib 3.9.1 交叉编译 linux arm
- PyQt基础第2篇——信号槽机制实现和简析
- System V 消息队列
- MediaStore 与Media.EXTERNAL_CONTENT_URI
- 爬楼梯
- C#Winform判断文件和路径是否存在
- 基于JWT的Socket.io用户认证
- wdk中使用自旋锁SpinLock的规则及原因分析