Created
February 11, 2017 12:56
-
-
Save pfulop/bde9a6600bca3e8743bea1b95977b2e5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class NetworkChangeReceiver extends BroadcastReceiver { | |
@Override | |
public void onReceive(final Context context, final Intent intent) { | |
if(!isAppOnForeground((context))){ | |
if(isInternet(context)) | |
{ | |
Intent serviceIntent = new Intent(context, MyTaskService.class); | |
context.startService(serviceIntent); | |
} | |
HeadlessJsTaskService.acquireWakeLockNow(context); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment