Sachin
Sachin

Reputation: 11

React to an incoming message in android

I have got the project to develop an app where my android phone rings loud when it is in silent mode by an incoming SMS. I am NOT asking for any source codes. I just want to know how to proceed with this .

Upvotes: 1

Views: 963

Answers (3)

Prachi
Prachi

Reputation: 3672

UrbanAirship is a good thing. It will give you notifications as well !

Upvotes: 0

vinayak jadi
vinayak jadi

Reputation: 959

u need to register receiver for incoming sms

public class SmsReceiver extends BroadcastReceiver {

@Override
public void onReceive(Context context, Intent intent) {
    Bundle bundle = intent.getExtras();


           //play ringtone here

}

}

for playing ringtone refer here & here and here

*note: dont forget to include permission in Manifest file

<uses-permission android:name="android.permission.SEND_SMS"/>

and the receiver part:

<receiver android:name=".listener.SmsListener">
    <intent-filter>
        <action android:name="android.provider.Telephony.SMS_RECEIVED" />
    </intent-filter>
</receiver>

Upvotes: 2

Anup Cowkur
Anup Cowkur

Reputation: 20563

You need to implement a BroadcastReceiver to listen for SMS events. These tutorials should help you get started:

Upvotes: 1

Related Questions