Code a simple Intent Listener for receiving New SMS in your Android Mobile
Code a simple Intent Listener for receiving New SMS in your Android Mobile package org.apache.sms; import android.app.NotificationManager; import android.content.Context; import android.content.Intent; import android.content.IntentReceiver; import android.os.Bundle; import android.provider.Telephony; import android.util.Log; import android.telephony.gsm.SmsMessage; public class SMSApp extends IntentReceiver { private static final String LOG_TAG = "SMSApp"; /* package */ static final String ACTION = "android.provider.Telephony.SMS_RECEIVED"; public void onReceiveIntent(Context context, Intent intent) { if (intent.getAction().equals(ACTION)) { StringBuilder buf = new StringBuilder(); Bundle bundle = intent.getExtras(); if (bundle != null) { SmsMessage[] messages = Telephony.Sms.Intents.getMessagesFromIntent(intent); for (int i = 0; i < messages.length; i++) { SmsMessage message = messages[i]; buf.append("Received SMS from "); buf.appe