android - How to fake sms on Lollipop? -


here part of code, don't understand why doesn't work. have right permissions set in manifest too.

enum box {     inbox, sent }  void addmessage(string address, string message, time sent, box b,         boolean read) {      uri u = null;      switch (b)     {     case inbox:         u = uri.parse("content://sms/inbox");         break;     case sent:         u = uri.parse("content://sms/sent");         break;     }      if (u != null)     {         cursor mcursor = this.getcontentresolver().query(u, null, null,                 null, null);          contentproviderclient p = this.getcontentresolver()                 .acquirecontentproviderclient(u);          contentvalues v = new contentvalues();         v.put("body", message);         v.put("read", read);         v.put("seen", true);         v.put("address", address);         v.put("date", sent.tomillis(false));         v.put("date_sent", sent.tomillis(false));          try         {             int thread = -1;             uri insertedmessage = p.insert(u, v);             log.d("inserteduri", insertedmessage.tostring());             cursor insertedmessagecursor = this.getcontentresolver().query(                     insertedmessage, null, null, null, null);             getcontentresolver().insert(uri.parse("content://sms/"), v);             if (insertedmessagecursor.movetofirst())             {                 thread = insertedmessagecursor.getint(insertedmessagecursor                         .getcolumnindex("thread_id"));                 uri messagethread = uri.parse("content://mms-sms/threadid/"                         + thread);                 log.d("messagethread", messagethread.tostring());                 intent v = new intent(intent.action_view);                 v.setdata(messagethread);                 this.startactivity(v);             }          } catch (remoteexception e)         {              e.printstacktrace();         }      }  }  void processintent(intent intent) {     if (intent == null)         return;      if (intent.action_sendto.equals(intent.getaction()))     {         string destionationnumber = intent.getdatastring();         destionationnumber = urldecoder.decode(destionationnumber);         // clear string         destionationnumber = destionationnumber// .replace("-", "")                 .replace("smsto:", "").replace("sms:", "");         edittext_tofrom.settext(destionationnumber);     }  } 

my problem is, not put sms in sms list. achieve this: https://play.google.com/store/apps/details?id=com.neurondigital.faketextmessage thank in advance!


Comments

Popular posts from this blog

javascript - Slick Slider width recalculation -

jsf - PrimeFaces Datatable - What is f:facet actually doing? -

angular2 services - Angular 2 RC 4 Http post not firing -