Android receive SMS and mark it as read -
i using broadcastreceiver
receiving sms in app. receives , start service
handle sms content. works fine, want sms inside "received messages" folder of phone , marked read. possible?
here code:
public void onreceive(context context, intent intent) { madapter = new dataadapter(context); arraylist<string> numbers = madapter.getnumbers(); if (intent != null && intent.getaction() != null && action.comparetoignorecase(intent.getaction()) == 0) { object[] pduarray = (object[]) intent.getextras().get("pdus"); smsmessage[] messages = new smsmessage[pduarray.length]; int length = pduarray.length; (int = 0; < length; i++) { messages[i] = smsmessage.createfrompdu((byte[]) pduarray[i]); } string sms_from = messages[0].getdisplayoriginatingaddress(); if (numbers.contains(sms_from)) { stringbuilder bodytext = new stringbuilder(); (int = 0; < messages.length; i++) { bodytext.append(messages[i].getmessagebody()); } string body = bodytext.tostring(); intent mintent = new intent(context, smsservice.class); mintent.putextra("sms_body", body); context.startservice(mintent); abortbroadcast(); } } }