An open API service indexing awesome lists of open source software.

https://github.com/inket/mbawssnsmanager

Receive Push notifications from Amazon Web Services
https://github.com/inket/mbawssnsmanager

Last synced: 3 months ago
JSON representation

Receive Push notifications from Amazon Web Services

Awesome Lists containing this project

README

          

## MBAWSSNSManager

Is a small class that makes it easy to do the basic AWS SNS-related tasks:

- Register for notifications:
1. Request device token from Apple
- Create platform endpoint with SNS
- Subscribe to SNS Topic
- Delete platform endpoint

This allows you to receive broadcast Push notifications from Amazon Web Services' Simple Notification Service (AWS SNS).

## Usage

Add `pod AWSiOSSDKv2` to your Podfile then run `pod install`

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[self registerForNotifications];
}

- (void)registerForNotifications {
MBAWSSNSManager* manager = [MBAWSSNSManager sharedManager];
manager.acceptsNotificationTypeAlert = YES;
manager.acceptsNotificationTypeBadge = YES;
manager.acceptsNotificationTypeSound = YES;
manager.awsAccessKey = @"";
manager.awsSecretKey = @"";
manager.awsRegion = ;
manager.awsApplicationArn = @"";
[manager registerForNotifications];
}

- (void)application:(UIApplication*)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData*)deviceToken {
MBAWSSNSManager* manager = [MBAWSSNSManager sharedManager];
manager.deviceToken = deviceToken;
[manager subscribeToTopics:@[
@""
]];
}

- (void)application:(UIApplication*)application didFailToRegisterForRemoteNotificationsWithError:(NSError*)error{
NSLog(@"Failed to register with error : %@", error);
}

For more details see the blog post @ [Interfirm's blog](http://blog.interfirm.co.jp/entry/2014/11/07/184629)