Back to project page tinysmsgate.
The source code is released under:
GNU General Public License
If you think the Android project tinysmsgate listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package rocks.jahn.tinysmsgate; /*from ww w . j a v a 2s . c o m*/ import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.os.Bundle; import android.preference.PreferenceManager; import android.telephony.SmsMessage; public class SMSReceiver extends BroadcastReceiver { public SMSReceiver() { super(); } @Override public void onReceive(Context context, Intent intent) { SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context); boolean forwardingEnabled = preferences.getBoolean("chkForwardSMS", false); if(forwardingEnabled) { Bundle bundle = intent.getExtras(); SmsMessage[] messages = null; String from = ""; String message = ""; if(bundle != null) { Object[] pdus = (Object[]) bundle.get("pdus"); messages = new SmsMessage[pdus.length]; for(int i = 0; i < messages.length; i ++) { messages[i]= SmsMessage.createFromPdu((byte[]) pdus[i]); message += messages[i].getMessageBody().toString(); from = messages[i].getOriginatingAddress(); } } new SMSForwarder( context, from, message, preferences.getString("txtUrl", ""), preferences.getString("lstSendMethod", "POST") ).execute(); } } }