Wednesday, 15 January 2014

Missed call alert in android

Missed call alert:

This Missed call alert android example alert tutorial is very useful to find the missed calls with numbers. From that you can get missed call notification via sms.
Follow the simple steps to create this app:
1)First, you have set the Receiver for receive the CALLS.
2)In receiver create Intent-filter with "android.intent.action.PHONE_STATE" action.
<receiver android:name="com.rajaappstore.missedcallalert.MainActivity">
<intent-filter>
<action android:name="android.intent.action.PHONE_STATE">
</action></intent-filter>
</receiver>

3)In MainActivity extends BroadcastReceiver for receiver intent-filter action.
Then,
Create object for the TelephonyManager.
TelephonyManager telephony = (TelephonyManager)context.getSystemService(Context.TELEPHONY_SERVICE);
4)Then,Register PhoneStateListener with the TelephonyManager.
CustomPhoneStateListener customPhoneListener = new CustomPhoneStateListener();
telephony.listen(customPhoneListener, PhoneStateListener.LISTEN_CALL_STATE);
5)Finally,You have to check wether the incoming call is missed or answered by the user under the PhoneStateListener using the TelephonyManager.
case TelephonyManager.CALL_STATE_IDLE:

if((prev_state==TelephonyManager.CALL_STATE_OFFHOOK)){
prev_state=state;
//call answered
}
if((prev_state==TelephonyManager.CALL_STATE_RINGING)){
prev_state=state;
//call missed or rejected
}
break;
Then,
You can create sms with the missed call number to the another user using the SmsManager.
SmsManager sms= SmsManager.getDefault();
sms.sendTextMessage("5556", null, "Missed call from"+incomingNumber, nullnull);

Dont forget to add permissions
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.SEND_SMS" />

 Screenshot:

Missed call alert android example
Missed call alert android example
Missed call alert android example
Missed call alert android example



2 comments:

Unknown said...

Awesome !!!
Really It's a great post related to MISSED CALL ALERT IN ANDROID development...
I like it.
Missed Call Services In India

Unknown said...

thanks a lot you have made a great effort to write the article now i am very happy that u can use the service in my mobile it self
missed call service in india