The dark side of Background tasks in React Native - React Alicante 2018
In this talk we are going to explore how to manage background tasks within your React Native application. Background tasks are essentially tasks that run when the app is not in the foreground (visible).
{ @Override protected HeadlessJsTaskConfig getTaskConfig(Intent intent) { return new HeadlessJsTaskConfig( "SyncShowsTask", null, // We could pass arguments 120000, // Timeout in ms false // Task is allowed in foreground ); } } <service android:name=“com.me.mypackage.SyncShowsService” /> …also on your AndroidManifest.xml
All Java code described in Android docs } @Override public void onPerformSync(...) { Intent service = new Intent( getContext(), HeadlessService.class ); getContext().startService(service); }