Android _onBackgroundFetch failed to trigger continuously after every 15 minutes
Your Environment
- Plugin version: background_fetch: ^1.0.3
- Platform: Android
- OS version: Oreo
- Device manufacturer / model: Moto G5 plus
- Flutter info : (2.5.3)
I have added new entry to event log table when onBackground fetch trigger with dateTime. Smoothly it worked for some hour. but failed to continuously trigger after every 15 minutes. please review the screenshot ( it triggered from 18:43:33 to 20:15:11 )
Future
print('[BackgroundFetch] configure success: $status');
doStoreEventLog( "Init Platform", "check background fetch configured or not " + DateTime.fromMillisecondsSinceEpoch( DateTime.now().millisecondsSinceEpoch) .toString());
int timestamp = DateTime.now().millisecondsSinceEpoch;
if (status == BackgroundFetch.STATUS_AVAILABLE) { doStoreEventLog( "Init Platform", DateTime.fromMillisecondsSinceEpoch(timestamp).toString() + " - " + "Background fetch configured successfully");
write( NEXT_BG_FETCH_DATE_TIME_KEY, (DateTime.now().millisecondsSinceEpoch + (1000 * 60 * 15)) .toString());
write(IS_BG_FETCH_STARTED_KEY, "1");
} else {
doStoreEventLog( "Init Platform", DateTime.fromMillisecondsSinceEpoch(timestamp).toString() + " - " + "Background fetch configuration failed " + " - " + "Status code" + status.toString()); }
} else { print('[BackgroundFetch] already configured '); int timestamp = DateTime.now().millisecondsSinceEpoch; doStoreEventLog( "Init Platform", DateTime.fromMillisecondsSinceEpoch(timestamp).toString() + " - " + "[BackgroundFetch] already configured"); } } on Exception catch (e) { print("[BackgroundFetch] configure ERROR: $e"); int timestamp = DateTime.now().millisecondsSinceEpoch; doStoreEventLog( "Init Platform", DateTime.fromMillisecondsSinceEpoch(timestamp).toString() + "|" + "[BackgroundFetch] configure ERROR: $e"); }
}
Future
EventLog eventLog = EventLog(title: title, body: body, dateTime: dateTime, isDelete: false);
await box.add(eventLog); }
void write(String key, dynamic value) { GetStorage().write(key, value); }
Future<String> read(String key) async{
return await GetStorage().read(key);
}

How to restart the background fetch if not working after long period of time? can i get any log history of Background fetch callback
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. You may also mark this issue as a "discussion" and I will leave this open.
This issue was closed because it has been inactive for 14 days since being marked as stale.