Titanium JIRA Archive
Appcelerator Community (AC)

[AC-6178] iOS background fetch is not working.

GitHub Issuen/a
TypeBug
Priorityn/a
StatusResolved
ResolutionNeeds more info
Resolution Date2019-05-11T00:23:20.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsAlloy, Titanium SDK & CLI
Labelsn/a
Reporterlau.yikonn
AssigneeShak Hossain
Created2019-03-23T03:54:16.000+0000
Updated2019-05-11T00:23:20.000+0000

Description

UIBackgroundModes fetch 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

FileDateSize
index.js2019-03-23T08:06:22.000+0000880
tiapp.xml2019-03-23T08:07:01.000+00004019

Comments

  1. Rakhi Mitro 2019-03-23

    Thanks for reaching out! Are you experiencing this on iPhone device? It would be better if you can provide complete simple test case, your full environment details and detail console logs to reproduce the issue on our end.
  2. lau.yikonn 2019-03-23

    i've attach the index.js and the tiapp.
  3. Rakhi Mitro 2019-04-07

    [~lau.yikonn], Can you please try the sample code from [Background fetch](https://wiki.appcelerator.org/display/guides2/iOS+Background+Services#iOSBackgroundServices-Backgroundfetch) section and let us know how it goes.
  4. Sharif AbuDarda 2019-04-09

    Hello [~lau.yikonn], Can you get back here? did you follow the above guide? let us know how things going.
  5. Rakhi Mitro 2019-04-24

    Hello, Did you find our last reply helpful for your progress? Let us know the updates from your end.

JSON Source