- Improved workflow for disabling notifications
- Improved code stability
- Wrote README.md
appfarms Push Notification Service is a web based portal to send remote push notifications to your app and collect important statistical data regarding your push notifications. This library is a drop-in static library that provides a simple way to integrate Urban Airship services into your iOS applications.
Features supported:
-
Enable Push Notifications: Enable remote push notifications for your mobile app. The library automatically registers the device token with the appfarms Push Notification Service so that you easily can send remote push notifications via the appfarms Push Notification Service web frontend.
-
Analytics: Developers can then use the appfarms Analytics reports to measure:
-
The number of active users are using their applications.
-
Adoption and usage of specific features.
-
And many other useful metrics...
This document contains the following sections:
- Xcode 7 or later
- The SDK supports iOS 7.0 and later
- You do need a valid account and subscription of appfarms Push Notification Service for full support of the SDK. For more information go to "appfarms Push Notification Service"
We recommend integration of library via CocoaPods.
CocoaPods is a dependency manager for Objective-C, which automates and simplifies the process of using 3rd-party libraries like HockeySDK in your projects. To learn how to setup CocoaPods for your project, visit the official CocoaPods website.
Podfile
platform :ios, '8.0'
source 'https://github.com/CocoaPods/Specs.git'
target 'MyTarget' do
pod "AFPushNotificationServiceSDK"
end
Objective-C
- Open your
AppDelegate.m
file. - Add the following line at the top of the file below your own
import
statements:#import "AFPushManager.h"
- Add the following code to
-application:didFinishLaunchingWithOptions:
:NSString * apiKey = @"6fe...068"; // Your private apiKey from https://push.appfarms.com AFPushEnvironment env = AFPushEnvironmentLive; // or `AFPushEnvironmentDebug` or `AFPushEnvironmentStaging` [AFPushManager configureWithApiKey:apiKey environment:env enableTracking:YES autoTrackingMode:AFPushAutoTrackingModeOptIn]; [AFPushManager handleLaunchOptions:launchOptions]; // Register for remote notifications if ([application respondsToSelector:@selector(registerUserNotificationSettings:)]) { UIUserNotificationSettings * settings = nil; settings = [UIUserNotificationSettings settingsForTypes:UIUserNotificationTypeBadge|UIUserNotificationTypeSound|UIUserNotificationTypeAlert categories:nil]; [application registerUserNotificationSettings:settings]; } else { [application registerForRemoteNotifications]; }
- Add the following delegate methods to your
AppDelegate.m
:- (void) application:(UIApplication *)application didRegisterUserNotificationSettings:(UIUserNotificationSettings *)notificationSettings { if (notificationSettings.types != UIUserNotificationTypeNone) { [application registerForRemoteNotifications]; } } - (void) application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken { [AFPushManager setDeviceToken:deviceToken]; } - (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo { [AFPushManager handlePush:userInfo]; }
TODO
Our documentation can be found on appfarms Push Notification Service.
Copyright 2015 - 2016 appfarms GmbH & Co KG. All rights reserved.
If you have further questions or are running into trouble that cannot be resolved by any of the steps here, feel free to open a Github issue here or contact us at support@appfarms.com