// register to receive the result
public void onReceive(Context context, Intent intent){
String command = intent.getStringExtra("COMMAND");
String commandidentifier = intent.getStringExtra("COMMAND_IDENTIFIER");
String result = intent.getStringExtra("RESULT");
Bundle bundle = new Bundle();
String resultInfo = "";
if(intent.hasExtra("RESULT_INFO")){
bundle = intent.getBundleExtra("RESULT_INFO");
Set<String> keys = bundle.keySet();
for (String key: keys) {
resultInfo += key + ": "+bundle.getString(key) + "\n";
}
}
String text = "Command: "+command+"\n" +
"Result: " +result+"\n" +
"Result Info: " +resultInfo + "\n" +
"CID:"+commandidentifier;
Toast.makeText(context, text, Toast.LENGTH_LONG).show();
};