Reputation: 1129
hi guys i am looking for solution to fire my own activity to be lauched to handle incoming sms notification. i am not talking about receving broadcast of incoming sms but i want to launch my own activity when user clicks the new sms notification.Is it possible?
Upvotes: 0
Views: 280
Reputation: 887
To elaborate further on what @Lyrkan said, add the following to your manifest,
<receiver class=".SMSReceiver">
<intent-filter>
<action android:value="android.provider.Telephony.SMS_RECEIVED" />
</intent-filter>
</receiver>
and make sure you have the appropriate permission, i.e.
<uses-permission android:name="android.permission.RECEIVE_SMS"/>
and the class you need to implement is something like
public class SMSReceiver extends BroadcastReceiver{
@Override
public void onReceive(Context context,Intent intent){
//your code here
}
}//end of class
Now from the onReceive you can do whatever it is that you want to do with the SMS.
Upvotes: 0
Reputation: 1063
The notification is generated by the default sms application, so it is linked to it, you can't change that.
The only thing you can do is create by yourself a notification through a receiver/intent-filter and link it to the Activity you want to launch.
Upvotes: 2