Skip to main content

Posts

Showing posts with the label screen off and on

Screen off and on in android

Screen off and on in android/Program that listens screen off in android/listening to screen on and off in android package com.sample; import android.app.Service; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.os.IBinder; public class ScreenAction extends Service{       @Override       public IBinder onBind(Intent intent) {             // TODO Auto-generated method stub             return null ;       }       @Override       public void onCreate() {             // TODO Auto-generated method stub             super .onCreate();       }       @Override       public int onStartCommand(Intent intent, int flags, int startId) {             // TODO Auto-generated method stub             IntentFilter filter = new IntentFilter(Intent. ACTION_SCREEN_OFF );             filter.addAction(Intent. ACTION_USER_PRESENT );             registerReceiver( mReceiver , fil