Exemple #1
0
        async static Task Main(string[] args)
        {
            IP8FileHelper p8FileHelper = new P8FileHelper(GetP8FilePath());

            Debug.WriteLine(p8FileHelper.ToString());

            //iOSPushService = new IOSPushNotificat11ionService(p8FileHelper.GetP8Key(),
            //                                                p8FileHelper.GeP8KeyID(),
            //                                                p8FileHelper.GetTeamID(),
            //                                                appBundleID);
            iOSPushService = IOSPushNotificationService.Builder()
                             .SetP8key(p8FileHelper.GetP8Key())
                             .SetP8keyID(p8FileHelper.GeP8KeyID())
                             .SetP8TeamID(p8FileHelper.GetTeamID())
                             .SetAppBundleID(appBundleID)
                             .SetAPNsServer(APNsServer.Development)
                             .Build();
            await DoSomething();
        }
        public void sendNotification(APNSNotification model, String[] devicesIds, byte[] certificate, String password)
        {
            IIOSPushNotificationService pushNotificationService = new IOSPushNotificationService();

            pushNotificationService.Configure(ApnsConfiguration.ApnsServerEnvironment.Production, certificate, password);

            pushNotificationService.OnNofificationFailed += (notification, exception) =>
            {
                //handle failing notification here
            };

            pushNotificationService.OnFeedbackReceived += (token, timestamp) =>
            {
                // token is not valid anymore
                // remove device token from your database
                // timestamp is the time the token was reported as expired
            };

            pushNotificationService.Send(devicesIds, model);
        }