Create An Android Screaming App [SMS HotWord]

In this post you will learn how to create an android app which will scream aloud no mater if the mobile is in silent or in general mode. This will work even if the app isnt in the open state. The screaming gets triggered when someone sends “scream” to your mobile as SMS. That is basically the hot word for triggering the screaming sound.


The Code:
The SMSReciever Broadcast Class:

public class RecieveSMS extends BroadcastReceiver 
public static final String SMS_BUNDLE = "pdus";
MediaPlayer mp;
public void onReceive(Context context, Intent intent) {

Bundle intentExtras = intent.getExtras();
if (intentExtras != null) {
Object[] sms = (Object[]) intentExtras.get(SMS_BUNDLE);
for (int i = 0; i < sms.length; ++i) {
SmsMessage smsMessage = SmsMessage.createFromPdu((byte[]) sms[i]);

String smsBody = smsMessage.getMessageBody().toString();
if (smsBody.contains("scream") || smsBody.contains("SCREAM"))
for(int i1=0;i1<3;i1++)
mp=MediaPlayer.create(context, R.raw.plutonium);
// Toast.makeText(context, "Alarm....", Toast.LENGTH_LONG).show();
try {
}catch (InterruptedException e){
// TODO Auto-generated catch block
Toast.makeText(context, smsBody, Toast.LENGTH_SHORT).show();

The Manifest File:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android=""
android:versionName="1.0" >

android:targetSdkVersion="18" />

android:theme="@style/AppTheme" >
android:label="@string/app_name" >
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
<receiver android:name=".RecieveSMS">
<action android:name="android.provider.Telephony.SMS_RECEIVED"></action>
<uses-permission android:name="android.permission.RECEIVE_SMS"></uses-permission>

There is a folder raw inside res which contains the plutonium.mp3 file which has scream output !
Alternatively you can download the complete Eclipse ADT package by clicking here !

Found Bugs ? Feel free to report them here !

Bikash Panda
Catch Me On

Bikash Panda

Blogger / Embedded System Developer at WGLabz
A techie, tinkerer and tech lover, who loves to blog and feels everyone can learn tech provided they have the right attitude towards learning and passion. By profession, I am an IOT developer working in Smart Home/ Smart Grid domain.
Bikash Panda
Catch Me On

Latest posts by Bikash Panda (see all)

Related posts