我已经创建了从一个特定号码接收消息的应用程序。它工作正常。现在我想在收到消息后在收件箱应用程序图标上显示警报图标。我应该在哪里添加代码。
if ( extras != null ) {
// get array data from SMS
Object[] smsExtra = (Object[]) extras.get( "pdus" ); // "pdus" is the key
for ( int i = 0; i < smsExtra.length; ++i ) {
// get sms message
SmsMessage sms = SmsMessage.createFromPdu((byte[])smsExtra[i]);
// get content and number
String body = sms.getMessageBody();
String address = sms.getOriginatingAddress();
// create display message
if( address.equals("+91999999999")){
messages += "SMS from " + address + " :\n";
messages += body + "\n";
// notify new arriving message
Toast.makeText( context, messages, Toast.LENGTH_LONG ).show();
listSms.add(new SmsInfo(address, body));
this.abortBroadcast();
}