Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-19184

iOS9: Add behavior property to userNotificationAction

    Details

      Description

      Via the userNotificationAction new property behavior, iOS9 now allows keyboard input as an action on the lock screen.

      Reference:
      https://developer.apple.com/library/prerelease/ios/releasenotes/General/iOS90APIDiffs/frameworks/UIKit.html

      Sample code:

      var win = Ti.UI.createWindow({
          backgroundColor: "#fff"
      });
      var btn = Ti.UI.createButton({
          title: "Schedule local notification!"
      });
       
      btn.addEventListener("click", scheduleLocalNotification);
       
      function scheduleLocalNotification() {
       
          var acceptAction = Ti.App.iOS.createUserNotificationAction({
              identifier: "ACCEPT_IDENTIFIER",
              title: "Reply",
              activationMode: Ti.App.iOS.USER_NOTIFICATION_ACTIVATION_MODE_FOREGROUND,
              destructive: false,
              behavior: Ti.App.iOS.USER_NOTIFICATION_BEHAVIOR_TEXTINPUT, // Ti.App.iOS.USER_NOTIFICATION_BEHAVIOR_DEFAULT,
              authenticationRequired: true
          });
       
          var invitationCategory = Ti.App.iOS.createUserNotificationCategory({
              identifier: "TEST_CATEGORY",
              actionsForDefaultContext: [acceptAction],
              actionsForMinimalContext: [acceptAction]
          });
       
          Ti.App.iOS.registerUserNotificationSettings({
              types: [Ti.App.iOS.USER_NOTIFICATION_TYPE_ALERT, Ti.App.iOS.USER_NOTIFICATION_TYPE_BADGE],
              categories: [invitationCategory]
          });
       
          Ti.App.iOS.scheduleLocalNotification({
              date: new Date(new Date().getTime() + 3000),
              alertBody: "New message from Hans! Reply?",
              badge: 1,
              category: "TEST_CATEGORY"
          });
      };
       
      Ti.App.iOS.addEventListener('localnotificationaction', function(e) {
          Ti.API.info(JSON.stringify(e));
       
          if (e.typedText && e.typedText.length > 0) {
              alert(e.typedText);
          }
      });
       
      win.add(btn);
      win.open();
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                hknoechel Hans Knöchel
                Reporter:
                cng Chee Kiat Ng (Inactive)
                Reviewer:
                Chee Kiat Ng (Inactive)
              • Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Backbone Issue Sync

                  • Backbone Issue Sync is enabled for your project, but we do not have any synchronization info for this issue.

                    Git Integration