LoginSignup
0
0

More than 5 years have passed since last update.

Parse.com

Last updated at Posted at 2017-03-22

Parse.com

  • Cloud for apps
  • Several services: Data, Push, Analytics...
  • Push: Transaction initiated by the server (≠ Pull)
  • Push SDK for iOS, Android, Windows and Windows Phone
  • Easy integration e.g. iOS (after having added the dependencies)

    [Parse setApplicationId:@"xxxxx"
                  clientKey:@"xxxxx"];
    

in application:didFinishLaunchingWithOptions:

// Register for Push Notitications, if running iOS 8
if ([application respondsToSelector:@selector(registerUserNotificationSettings:)]) {
  UIUserNotificationType userNotificationTypes = (UIUserNotificationTypeAlert |
                                                  UIUserNotificationTypeBadge |
                                                  UIUserNotificationTypeSound);
  UIUserNotificationSettings *settings = [UIUserNotificationSettings settingsForTypes:userNotificationTypes
                                                                           categories:nil];
  [application registerUserNotificationSettings:settings];
  [application registerForRemoteNotifications];
} else {
  // Register for Push Notifications before iOS 8
  [application registerForRemoteNotificationTypes:    (UIRemoteNotificationTypeBadge |
                                                   UIRemoteNotificationTypeAlert |
                                                   UIRemoteNotificationTypeSound)];
}

in the App main delegate:

- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
  // Store the deviceToken in the current installation and save it to Parse.
  PFInstallation *currentInstallation = [PFInstallation currentInstallation];
  [currentInstallation setDeviceTokenFromData:deviceToken];
  [currentInstallation saveInBackground];
}

- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo {
  [PFPush handlePush:userInfo];
}
  • Subscribing to a channel

    PFInstallation *currentInstallation = [PFInstallation currentInstallation];
     [currentInstallation addUniqueObject:[NSString stringWithFormat:@"participant_uuid_%@", userUuid] forKey:@"channels"];
     [currentInstallation saveInBackground];
    
  • Sending a push
    Several API : JavaScript, PHP, .NET (including Unity SDK), REST API.
    example:

    curl -X POST -H "X-Parse-Application-xxxxx" -H "X-Parse-REST-API-xxxxx" -H "Content-Type:application/json" -H "Cache-Control:no-cache" -H "Postman-Token:89afd163-f1e6-ac87-1399-0c14250b1989" -d '{"where": {"channels": {...}}' https://api.parse.com/1/push
    
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0