java - How to suppress new SMS notification? -


i'm writing own sms messenger , need suppress new sms notification raised default stock messenger. sure i'm intercepting incoming sms notification , aborting broadcast through broadcastreceiver.abortbroadcast(), like:

public void onreceive(context context, intent intent) {         map<string, string> msgs = retrievemessages(intent);         (string address : msgs.keyset()) {             string msg = msgs.get(address);             log.i(tag, "new sms received=" + msg);             //saving message in phone             message message = message.createincomingmessage(address, msg);             message.setseen(1); ////mark message seen, stock messenger couldn't arose notification             message.setread(1); //mark message read, stock messenger couldn't report unread             message.setunread(true); //mark message unread our messenger             message = me.getme().getmessagedao().save(context, message); //saving message              smsreceiver.updatenotification(context, message, true, true); //raise notification "our" messenger         }         //aborting default broadcast, since done , no need more         this.abortbroadcast();     } 

everything works planned. whenever i'm inserting new sms database through me.getme().getmessagedao().save(context, message); within few seconds stock messenger somehow being notified new message in database , again raises notification.

question is: how suppress notification?

first need set priority of receiver see docs.

secondly, call abortbroadcast before heavy processing task(storing db).

or can try db storing thing in thread, start thread , call abortbroadcast() immediately.


Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -