package com.device.comm.mylibrary;

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

public class BcReceiver extends BroadcastReceiver {
	
	private static final String TAG = "GLUC:BcReceiver";
	
	public BcReceiver() {
	}

	@Override
	public void onReceive(Context context, Intent intent) {
		String act=intent.getAction();
		
//		if (act.equals("kphone.intent.action.MCU_WORK_INT")){
			if (act.startsWith("kphone.intent.action")){

				String extAct=intent.getStringExtra("action");
			Log.e(TAG, extAct);

			boolean isSecure = intent.getBooleanExtra("secure", false);
			if (extAct.equals("insertStrip")){
				Log.e(TAG, "insert strip!");
				Intent i = new Intent(Intent.ACTION_MAIN);
				if(isSecure){
				    //i.setClassName( "com.kfree.glucometer", "com.kfree.glucometer.SecureActTestBlood" );
				} else {
				    i.setClassName( "com.example.exemplary", "com.example.exemplary.MainActivity" );
				}
				i.putExtra("step", 2); //进入滴血步骤
				i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
				
				String testTemp=intent.getStringExtra("temp");
				if(testTemp.equals("test")){
//					context.startActivity(i);
				}else{
					return;
				}
//				context.startActivity(i);
			}else{
				Log.e(TAG, "remove strip or sleep!");
			}
		}
	}
}
