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.
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.
i've attach the index.js and the tiapp.
[~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.
Hello [~lau.yikonn], Can you get back here? did you follow the above guide? let us know how things going.
Hello, Did you find our last reply helpful for your progress? Let us know the updates from your end.