android - Pass Context with Intent -
all,
i have broadcast receiver start intent service work on separate thread.
i have tried digging intent documentation find way obtain context used create intent:
intent(context packagecontext, class<?> cls) however signature of on start command following , not allow context passed. did not see context public method intent, have missed something.
public int onstartcommand(intent intent, int flag, int startid) is there way @ context used create intent without going route of second broadcast receiver access ui, or handler.
thanks
i have tried digging intent documentation find way obtain context used create intent
since context may not in process, not possible. moreover, not necessary.
is there way @ context used create intent without going route of second broadcast receiver access ui
the broadcastreceiver cannot update ui. hence, if wanted possible (which not), no good.
moreover, since kicking off intentservice, may not have ui. user in control of phone, , welcome leave app , go home screen or app.
one pattern dealing send ordered broadcast intentservice. have activity implement high-priority broadcastreceiver broadcast, normal-priority receiver registered in manifest. latter raise notification, if activity not in foreground, user see notification instead. here blog post going bit more detail, , here sample application demonstrating technique.
Comments
Post a Comment