Details

    • Type: Bug
    • Status: Resolved
    • Resolution: Needs more info
    • Affects Version/s: None
    • Component/s: Alloy, Titanium SDK & CLI
    • Labels:
      None
    • Environment:

      MacBook Pro (Retina, 13-inch, Late 2013)
      Mojave 10.14.3 (18D109)
      Titanium SDK: 8.0.0.GA

      Description

      <plist>
      <dict>
      <key>UIBackgroundModes</key>
      <array>
      <string>fetch</string>
      </array>
      </dict>
      </plist>

      var acceptAction = Ti.App.iOS.createUserNotificationAction(

      { identifier: "ACCEPT_IDENTIFIER", title: "Accept", activationMode: Ti.App.iOS.USER_NOTIFICATION_ACTIVATION_MODE_FOREGROUND, destructive: false, authenticationRequired: true }

      );

      var rejectAction = Ti.App.iOS.createUserNotificationAction(

      { identifier: "REJECT_IDENTIFIER", title: "Reject", activationMode: Ti.App.iOS.USER_NOTIFICATION_ACTIVATION_MODE_BACKGROUND, destructive: true, authenticationRequired: false }

      );

      // Create a notification category
      var downloadContent = Ti.App.iOS.createUserNotificationCategory(

      { identifier: "DOWNLOAD_CONTENT", actionsForDefaultContext: [acceptAction, rejectAction] }

      );

      // Register for user notifications and categories
      Ti.App.iOS.registerUserNotificationSettings(

      { types: [ Ti.App.iOS.USER_NOTIFICATION_TYPE_ALERT, Ti.App.iOS.USER_NOTIFICATION_TYPE_BADGE, Ti.App.iOS.USER_NOTIFICATION_TYPE_SOUND ], categories: [downloadContent] }

      );

      Ti.App.iOS.setMinimumBackgroundFetchInterval(1800);
      //app.performFetchWithCompletionHandler()

      Ti.App.iOS.addEventListener("backgroundfetch", function(e){
      var fetchID = e.handlerId;
      Ti.App.iOS.scheduleLocalNotification({
      date: new Date(new Date().getTime()),
      alertTitle: "My download",
      alertSubtitle: "Check it out!",
      alertBody: "New content available! Download now?",
      badge: 1,
      attachments: [

      { identifier: "my_attachment", url: "default_app_logo.png" }

      ,

      { identifier: "my_attachment2", url: "default_app_logo.png" }

      ],
      userInfo:

      {"url": "http://www.download.com/resource/asset.json", id:"1"}

      ,
      category: "DOWNLOAD_CONTENT"
      });

      Ti.App.iOS.endBackgroundHandler(fetchID);
      });

      The event never fires and the schedule notification never happend.

        Attachments

          Activity

            People

            • Assignee:
              shossain Shak Hossain
              Reporter:
              lau.yikonn lau.yikonn
            • Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Git Source Code