broadcastreceiver - Can an Android app's service run before it is launched by the user? -
the app has broadcastreceiver listens boot-complete event , starts background service send data http server.
my question is, if app never run user (only installed), broadcastreceiver receive boot event?
starting android 3.1 user has launch application once receive boot_complete broadcast..
following official javadoc:
starting android 3.1, system's package manager keeps track of applications in stopped state , provides means of controlling launch background processes , other applications.
note application's stopped state not same activity's stopped state. system manages 2 stopped states separately.
the platform defines 2 new intent flags let sender specify whether intent should allowed activate components in stopped application.
flag_include_stopped_packages — include intent filters of stopped applications in list of potential targets resolve against. flag_exclude_stopped_packages — exclude intent filters of stopped applications list of potential targets. when neither or both of these flags defined in intent, default behavior include filters of stopped applications in list of potential targets.
note system adds flag_exclude_stopped_packages broadcast intents. prevent broadcasts background services inadvertently or unnecessarily launching components of stoppped applications. background service or application can override behavior adding flag_include_stopped_packages flag broadcast intents should allowed activate stopped applications.
applications in stopped state when first installed not yet launched , when manually stopped user (in manage applications).
check out this blog more detail
Comments
Post a Comment