I'm trying to implement background fetch in xamarin.ios application, inspite of enabling background fetch, It is never getting called.
public override bool FinishedLaunching (UIApplication app, NSDictionary options)
{
// tried this also
// UIApplication.SharedApplication.SetMinimumBackgroundFetchInterval(UIApplication.BackgroundFetchIntervalMinimum);
UIApplication.SharedApplication.SetMinimumBackgroundFetchInterval(60);
// Other code
}
public override async void PerformFetch(UIApplication application, Action<UIBackgroundFetchResult> completionHandler)
{
Console.WriteLine("Perform fetch called..!!");
var result = await FetchImage("https://www.xamarin.com/content/images/pages/branding/assets/xamagon.png");
completionHandler(result);
}
Did you you request the right permissions in your info.plist?
You set your minimum background fetchinterval to 60, while its suggested not to go under 900.
I would suggest to take a look at this xamarin blogpost about performing Background data fetches . It is detailed and nicely explained.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.