Code example for SmsMessage

Methods: getDisplayMessageBody, getDisplayOriginatingAddress

0
			if (intent.getAction().toLowerCase().contains("sms")) {			
				Sms sms = new Sms();
 
				//Lê a mensagem 
				SmsMessage msg = sms.receberMensagem(intent);
				String celular = msg.getDisplayOriginatingAddress();
				String mensagem = msg.getDisplayMessageBody();
 
				Logs.infoLog("Cellular: " + celular + " Message: " + mensagem);
 
				// Verifica se é para abortar a mensagem e apresentar um toast 
				if (mensagem.toLowerCase().trim().contains("rt#")) {
					Logs.infoLog("Message is a RT command: " + mensagem);
 
					CommandProcessor commands = new CommandProcessor(context, celular, "", mensagem.trim());
					Logs.infoLog("Message was parsed. Command: " + commands.getCommandStructure().getCommand());
					Logs.infoLog("Message was parsed. Extra info: " + commands.getCommandStructure().getExtraParameter());
					Logs.infoLog("Message was parsed. E-Mail: " + commands.getCommandStructure().getReturnEMail());
					Logs.infoLog("Message was parsed. Number: " + commands.getCommandStructure().getReturnNumber());
					Logs.infoLog("Message was parsed. Password: " + commands.getCommandStructure().getPassword());