If wanted to call a broadcast for screen on/off you can get the code sniffet from here. Here I have used dynamic calling of Broadcast and the java source code is given below. get more details about broadcast from : Broadcast Receiver Introduction in Android BroadcastReceiver to get Battery Level in java file: public class MainActivity extends Activity { //Create broadcast object BroadcastReceiver mybroadcast = new BroadcastReceiver() { //When Event is published, onReceive method is called @Override public void onReceive(Context context, Intent intent) { // TODO Auto-generated method stub Log.i("[BroadcastReceiver]", "MyReceiver"); if(intent.getAction().equals(Intent.ACTION_SCREEN_ON)){ Log.i("[BroadcastReceiver]", "Screen ON"); } else if(intent.getAction().equals(Intent.ACTION_SCREEN_OFF)){ Log.i("[BroadcastReceiver]", "Screen ...
A blog where you can find all codes for Android, Corona, Basic tutorials, Interview questions and more...