SkillAgentSearch skills...

PushNotificationManager

Convenient and comprehensive api for push notification,provide 6 stems and 20 branchs' function,offer examples written by Objective-C and Swift respectively

Install / Use

/learn @apdevzhang/PushNotificationManager
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

PushNotificationManager

License  Platform  Support  Cocoapods  Language  Language 

  Convenient and comprehensive api for push notification ,provide 6 stems and 20 branchs' function,offer examples written by Objective-C and Swift respectively<br/>

Index

Catalog

<a name="API"></a>

API

<pre> PushNotificationManager.h PushNotificationManager.m </pre>

<a name="Brief"></a>

Brief

  1. push notification style of normal
    • normal with default alert sound
    • provide a customized alert sound
  2. push notification style of graphics
    • normal with default alert sound
    • provide a customized alert sound
    • provide a graphics download from internet
    • provide a graphics download from internet and a customized alert sound
  3. push notification style of video
    • normal with default alert sound
    • provide a customized alert sound
    • provide a video download from internet
    • provide a video download from internet and a customized alert sound
  4. push notification style of timing(Chinses Time)
    • normal with default alert sound(weekday、hour、minute、second)
    • provide a customized alert sound(weekday、hour、minute、second)
    • push notification style of timing like 2017-10-1(year、month、day、hour、minute、second)
    • push notification style of timing like 2017-10-1(year、month、day、hour、minute、second) and a customized alert sound
    • push notification style of timing,the fire date is included in a dictionary
    • push notification style of timing,the fire date is included in a dictionary,provide a customized alert sound
  5. push notification style of interactive(the max action is four)
    • normal with default alert sound
    • provide a customized alert sound
  6. push notification style of location
    • normal with default alert sound
    • provide a customized alert sound

<a name="Preview"></a>

Preview

mainpage screenshot1 | mainpage screenshot2 | mainpage screenshot3 | mainpage screenshot4 -----|-----|-----|----- screenshot/screenshot1.png | screenshot/screenshot2.png | screenshot/screenshot3.png | screenshot/screenshot4.png

push notification style of normal | push notification style of graphics | push notification style of video -----|-----|----- screenshot/screenshot6.png | screenshot/screenshot7.png | screenshot/screenshot9.png

interactive setp1 | interactive setp2 | interactive setp3 -----|-----|----- screenshot/screenshot11.png | screenshot/screenshot12.png | screenshot/screenshot13.png

interactive gif | video gif -----|----- screenshot/gif1.gif | screenshot/gif2.gif

<a name="License"></a>

License

PushNotificationManageruse [MIT license][1]

<a name="Installation"></a>

Installation with cocoapods

<pre> pod 'PushNotificationManager' </pre>

screenshot/cocoapods.png

<a name="Examples"></a>

Examples

  make sure you install thePushNotificationManagerwith cocoapods or import the files ofPushNotificationManagerbefore use

Apply the push notification permission

  • Objective-C
    if (@available(iOS 10.0, *)) {
        UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter];
        center.delegate = self;
        UNAuthorizationOptions types=UNAuthorizationOptionBadge|UNAuthorizationOptionAlert|UNAuthorizationOptionSound;
        [center requestAuthorizationWithOptions:types completionHandler:^(BOOL granted, NSError * _Nullable error) {
            if (granted) {
                [center getNotificationSettingsWithCompletionHandler:^(UNNotificationSettings * _Nonnull settings) {
                    //
                }];
            } else {
                [[UIApplication sharedApplication]openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString] options:@{UIApplicationOpenURLOptionUniversalLinksOnly:@""} completionHandler:^(BOOL success) { }];
            }
        }];
    } else {
#pragma clang diagnostic push
#pragma clang diagnostic ignored"-Wdeprecated-declarations"
        [application registerUserNotificationSettings:[UIUserNotificationSettings settingsForTypes:UIUserNotificationTypeAlert | UIUserNotificationTypeSound | UIUserNotificationTypeBadge categories:nil]];
    }
  #pragma clang diagnostic pop
  • Swift
        if #available(iOS 10.0, *) {
            let notificationCenter = UNUserNotificationCenter.current()
            notificationCenter.delegate = self
            let types = UNAuthorizationOptions([.alert,.badge,.sound])
            notificationCenter.requestAuthorization(options: types, completionHandler: { (flag, error) in
                if flag {
                    print("注册成功")
                } else {
                    print("注册失败:\(error.debugDescription)")
                }
            })
        } else {
            let setting = UIUserNotificationSettings.init(types: [.alert, .badge, .sound], categories: nil)
            application.registerUserNotificationSettings(setting)
        }
        UIApplication.shared.registerForRemoteNotifications()

push notification style of normal

  • function
-(void)normalPushNotificationWithTitle:(NSString *)title 
                              subTitle:(NSString *)subTitle  
                                  body:(NSString *)body 
                            identifier:(NSString *)identifier 
                          timeInterval:(NSInteger)timeInterval 
                                repeat:(BOOL)repeat;
  • Objective-C usage
 [[PushNotificationManager sharedInstance]normalPushNotificationWithTitle:@"John Winston Lennon" subTitle:@"《Imagine》" body:@"You may say that I'm a dreamer, but I'm not the only one" identifier:@"1-1" timeInterval:3 repeat:NO];   //`repeat` if you pick the repeat property 'YES',you require to set the timeInterval value >= 60second ->是否重复,若要重复->时间间隔应>=60s
  • Swift usage
PushNotificationManager().normalPushNotification(withTitle: "John Winston Lennon", subTitle: "《Imagine》", body: "You may say that I'm a dreamer, but I'm not the only one", identifier: "1-1", timeInterval: 3, repeat: false)

push notification style of normal,provide a customized alert sound,e.g. @"intro.mp3"

  • function
-(void)normalPushNotificationWithTitle:(NSString *)title 
                              subTitle:(NSString *)subTitle 
                                  body:(NSString *)body 
                            identifier:(NSString *)identifier 
                             soundName:(NSString *)soundName 
                          timeInterval:(NSInteger)timeInterval 
                                repeat:(BOOL)repeat;
  • Objective-C usage
[[PushNotificationManager sharedInstance]normalPushNotificationWithTitle:@"John Winston Lennon" subTitle:@"《Imagine》" body:@"You may say that I'm a dreamer, but I'm not the only one" identifier:@"1-2" soundName:@"tmp.mp3" timeInterval:3 repeat:NO];
  • Swift usage
PushNotificationManager().normalPushNotification(withTitle: "John Winston Lennon", subTitle: "《Imagine》", body: "You may say that I'm a dreamer, but I'm not the only one", identifier: "1-2", soundName: "tmp.mp3", timeInterval: 3, repeat: false)

push notification style of graphics,include the format of png、jpg、gif and other graphics formats

  • function
-(void)graphicsPushNotificationWithTitle:(NSString *)title
                                subTitle:(NSString *)subTitle 
                                    body:(NSString *)body 
                              identifier:(NSString *)identifier 
                                fileName:(NSString *)fileName 
                            timeInterval:(NSInteger)timeInterval 
                                  repeat:(BOOL)repeat;
  • Objective-C usage
[[PushNotificationManager sharedInstance]graphicsPushNotificationWithTitle:@"John Winston Lennon" subTitle:@"《Imagine》" body:@"You may say that I'm a dreamer, but I'm not the only one" identifier:@"2-1" fileName:@"Graphics.jpg" timeInterval:3 repeat:NO];
  • Swift usage
PushNotificationManager().graphicsPushNotification(withTitle: "John Winston Lennon", subTitle: "《Imagine》", body: "You may say that I'm a dreamer, but I'm not the only one", identifier: "2-1", fileName: "Graphics.jpg", timeInterval: 3, repeat: false)

push notification style of graphics,provide a customized alert sound,e.g. @"intro.mp3"

  • function
-(void)graphicsPushNotificationWithTitle:(NSString *)title 
                                subT
View on GitHub
GitHub Stars342
CategoryProduct
Updated7mo ago
Forks72

Languages

Objective-C

Security Score

92/100

Audited on Aug 7, 2025

No findings