Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

getting iOS push notifications working

$
0
0

I'm trying to register my app for push notifications and I am using the code taken from: http://docs.xamarin.com/guides/cross-platform/application_fundamentals/notifications/ios/remote_notifications_in_ios.

That being said RegisteredForRemoteNotifications or FailedToRegisterForRemoteNotifications never get called.

using System; using System.Collections.Generic; using System.Linq; using MonoTouch.Foundation; using MonoTouch.UIKit;

namespace WireFrameiOS { [Register ("AppDelegate")] public partial class AppDelegate : UIApplicationDelegate { UIWindow window; public override bool FinishedLaunching (UIApplication app, NSDictionary options) { UIRemoteNotificationType notificationTypes = UIRemoteNotificationType.Alert | UIRemoteNotificationType.Badge; UIApplication.SharedApplication.RegisterForRemoteNotificationTypes(notificationTypes);

        window = new UIWindow (UIScreen.MainScreen.Bounds);
        var rootNaviCont = new UINavigationController ();
        Launch launchScreen = new Launch ();
        rootNaviCont.PushViewController (launchScreen, false);
        window.RootViewController = rootNaviCont;
        this.window.MakeKeyAndVisible ();
        return true;
    }


    NSData NSDDeviceToken;

    public override void RegisteredForRemoteNotifications (UIApplication application, NSData deviceToken)
    {
        this.NSDDeviceToken = deviceToken.ToString ();
        Console.WriteLine (this.NSDDeviceToken.ToString ());
    }

    public override void FailedToRegisterForRemoteNotifications (UIApplication application, NSError error)
    {
        new UIAlertView ("Error registering push notifications", error.LocalizedDescription, null, "ok", null).Show ();
        Console.WriteLine ("Failed At: Registering with APNS");
    }

}

}


Viewing all articles
Browse latest Browse all 204402

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>