Android java Broadcast广播例子,

BroadcastReceiver例子,java广播例子源码
Android广播例子,Android Boradcast demo源码

最近太忙太忙了,实在是多事情,做技术的苦逼。
随便洗个文章吧,看看如何使用android的brodcast:

package com.example.backlightservice;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Log;

public class BootReceiver extends BroadcastReceiver {
    
    
	static final String ACTION = "android.intent.action.BOOT_COMPLETED";  

	public BootReceiver() {
    
    
	}

	@Override
	public void onReceive(Context context, Intent intent) {
    
    
		// TODO: This method is called when the BroadcastReceiver is receiving
		// an Intent broadcast.
		 if (intent.getAction().equals(ACTION)){
    
      
			 Log.e("LinDbg","Sevice");;
			 //Intent i = new Intent(context,BackLightService.class);
			 //context.startService(i);
		
	}
	}

}

猜你喜欢

转载自blog.csdn.net/mynameislinduan/article/details/108273836