Code example for SmsMessage: Receiving Text Messages (SMS)

Methods: getMessageBodygetOriginatingAddress

	 * @param sms 
	 * @return 
	private String parseMessage(SmsMessage sms) {
		// Should try and get the name from the contact list here 
		String sender = sms.getOriginatingAddress();
		String message = sms.getMessageBody();
		// Construct a new message, with the sender's name parsed in 
		// The first word will get parsed out and used as sender it appears, it 
		// even matches contact names on target phone on the emulator 
		String newMessage = sender + " ";
		newMessage += message;
		return newMessage;
	 * Forwards an SMS to another phone-number 
Experience pair programming with AI  Get Codota for Java