package org.wordpress.android.push;
import android.app.Service;
import android.content.BroadcastReceiver;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.IBinder;
import android.support.annotation.Nullable;
import org.wordpress.android.ui.notifications.ScreenLockUnlockBroadcastReceiver;
import org.wordpress.android.util.AppLog;
public class NotificationsScreenLockWatchService extends Service {
BroadcastReceiver mReceiver;
@Override
public void onCreate() {
super.onCreate();
AppLog.i(AppLog.T.NOTIFS, "notifications screen lock watch service > created");
mReceiver = new ScreenLockUnlockBroadcastReceiver();
registerReceiver(mReceiver, new IntentFilter(Intent.ACTION_SCREEN_OFF));
}
@Override
public void onDestroy() {
AppLog.i(AppLog.T.NOTIFS, "notifications screen lock watch service > destroyed");
unregisterReceiver(mReceiver);
super.onDestroy();
}
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
//no op
// We want this service to continue running until it is explicitly stopped, so return sticky.
return START_STICKY;
}
@Nullable
@Override
public IBinder onBind(Intent intent) {
return null;
}
}