Created
June 18, 2013 20:39
-
-
Save pierceboggan/5809145 to your computer and use it in GitHub Desktop.
Urban Airship setup for Xamarin.iOS.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public override bool FinishedLaunching (UIApplication app, NSDictionary options) | |
{ | |
window = new UIWindow (UIScreen.MainScreen.Bounds); | |
viewController = new UrbanAirshipTestViewController (); | |
window.RootViewController = viewController; | |
window.MakeKeyAndVisible (); | |
UAPush.Shared.RegisterForRemoteNotificationTypes(UIRemoteNotificationType.Alert | UIRemoteNotificationType.Badge | UIRemoteNotificationType.Sound); | |
var takeOffOptions = new NSMutableDictionary (); | |
options = new NSDictionary (); | |
takeOffOptions.SetValueForKey (options, new NSString ("UAirshipTakeOffOptionsLaunchOptionsKey")); | |
UAPush.Shared.ResetBadge (); | |
UAirship.TakeOff (takeOffOptions); | |
return true; | |
} | |
public override void ReceivedRemoteNotification (UIApplication application, NSDictionary userInfo) | |
{ | |
var message = (NSString) userInfo.ObjectForKey (new NSString ("aps")).ValueForKey(new NSString("alert")); | |
var alert = new UIAlertView("Notification", message, null, "Okay", null); | |
alert.Show (); | |
} | |
public override void WillTerminate (UIApplication application) | |
{ | |
UAirship.Land (); | |
} | |
public override void RegisteredForRemoteNotifications (UIApplication application, NSData deviceToken) | |
{ | |
UAPush.Shared.RegisterDeviceToken (deviceToken); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment