コード例 #1
0
        public void DidReceiveRemoteNotification(UIApplication application, NSDictionary userInfo, Action <UIBackgroundFetchResult> completionHandler)
        {
            switch (application.ApplicationState)
            {
            case UIApplicationState.Active:
            case UIApplicationState.Inactive:
                // KARTE経由のプッシュ通知であるか判定
                var notification = new KRTNotification(userInfo);
                if (notification != null)
                {
                    // KARTE経由のプッシュ通知
                    notification.HandleNotification();
                }
                else
                {
                    // KARTE以外のシステムから送信されたプッシュ通知
                }
                break;

            case UIApplicationState.Background:
                break;
            }

            completionHandler(UIBackgroundFetchResult.NewData);
        }
コード例 #2
0
 public void DidReceiveRegistrationToken(Messaging messaging, string fcmToken)
 {
     // Monitor token generation: To be notified whenever the token is updated.
     System.Diagnostics.Debug.WriteLine($"Received token: {fcmToken}");
     KRTNotification.RegisterFCMToken(fcmToken);
     // Note: This callback is fired at each app startup and whenever a new token is generated.
 }
コード例 #3
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            //For iam delegate testing
            iamDelegate = new SampleInAppMessagingDelegate();
            KRTInAppMessaging.Shared.Delegate = iamDelegate;

            //For idfa testing
            idfaDelegate = new SampleIDFADelegate();
            var configuration = new KRTConfiguration();

            configuration.IdfaDelegate = this.idfaDelegate;
            configuration.IsDryRun     = false;

            KRTApp.SetLogLevel(KRTLogLevel.Verbose);
            KRTApp.SetupWithAppKey("APP_KEY", configuration);
            KRTInAppMessaging.Configure();
            KRTNotification.Configure();
            KRTVariables.Configure();
            KRTTracker.View("chat", "chat");


            System.Diagnostics.Debug.WriteLine("AdvertisingIdentifierString: " + idfaDelegate.AdvertisingIdentifierString);
            System.Diagnostics.Debug.WriteLine("VisitorId: " + KRTApp.VisitorId);
            System.Diagnostics.Debug.WriteLine("IsOptOut: " + KRTApp.IsOptOut);

            string[] btnTitles = new string[]
            {
                "Identify",
                "View",
                "Track",
                "ViewForScene",
                "Push",
                "UserSync",
                "OptOut",
                "OptIn",
                "RenewVisitorId",
                "IsPresenting",
                "Dismiss",
                "Suppress",
                "Unsuppress",
                "Fetch Variables"
            };
            AddButtons(btnTitles);
        }
コード例 #4
0
        public void DidReceiveNotificationResponse(UNUserNotificationCenter center, UNNotificationResponse response, Action completionHandler)
        {
            var userInfo     = response.Notification.Request.Content.UserInfo;
            var notification = new KRTNotification(userInfo);

            // KARTE経由のプッシュ通知であるか判定
            if (notification != null)
            {
                System.Diagnostics.Debug.WriteLine($"notification.url: {notification.Url}");

                // KARTE経由のプッシュ通知
                notification.HandleNotification();
            }
            else
            {
                // KARTE以外のシステムから送信されたプッシュ通知
            }
            completionHandler();
        }