java - Need to convert a String to a Intent that I can send? -
what code need on receiving end of broadcast receiver convert string working intent can send? in short need intent1 converted working intent can send! in advance everyone!
edit came find out method of storing notification intent didn't work guess main question @ point how can notifications intent , send on broadcast sender , receive intent in broadcast receiver , being able send intent...thanks bearing me i'm confused on how make happen thank community helping me out
broadcast sender
public void onnotificationposted(statusbarnotification sbn) { string pack = sbn.getpackagename(); string ticker = sbn.getnotification().tickertext.tostring(); bundle extras = sbn.getnotification().extras; string title = extras.getstring("android.title"); string text = extras.getcharsequence("android.text").tostring(); intent intent = new intent(); intent.putextra("action", notification.contentintent); log.i("package", pack); log.i("ticker", ticker); log.i("title",title); log.i("text", text); intent msgrcv = new intent("msg"); msgrcv.putextra("package", pack); msgrcv.putextra("ticker", ticker); msgrcv.putextra("title", title); msgrcv.putextra("text", text); localbroadcastmanager.getinstance(context).sendbroadcast(msgrcv);
broadcast receiver
public void onreceive(context context, final intent intent) { string pack = intent.getstringextra("package"); string title = intent.getstringextra("title"); string text = intent.getstringextra("text"); int seconds = integer.parseint(duration);
use intent.getparcelableextra()
intent intent1 = intent.getparcelableextra("action");
Comments
Post a Comment