public class NetworkChangeReceiver extends BroadcastReceiver {
private static final String LOG_TAG = "NetworkChangeReceiver";
private boolean isConnected = false;
@Override
public void onReceive(final Context context, Intent intent) {
if (MyApplication.getInstance().isConnectedToNetwork(context)) {
Log.v(LOG_TAG, "Now you are connected to Internet!");
if (!MyApplication.getInstance().getBooleanFromSharedPreference(IS_SYNC_WORKING)) {
MyApplication.getInstance().addBooleanToSharedPreference(IS_SYNC_WORKING, true);
//execution(context);
context.startService(new Intent(context, AutoSyncPendingWorkReport.class));
context.startService(new Intent(context, AutoSyncImages.class));
}
} else {
MyApplication.getInstance().addBooleanToSharedPreference(IS_SYNC_WORKING, false);
Toast.makeText(context, "Context not in online", Toast.LENGTH_SHORT).show();
}
}
Я пытаюсь решить Autosyn c в android последней версии нуги и выше.