Answer: you register it in the manifest, the rest is automatic.

Question: did you open those links to Android documentation?

12 января 2012 г. 20:32 пользователь saex <[email protected]> написал:
> But, how can the broadcast listen for push notification's if it is
> started by my app, and my app has not been started?
>
> i think i am losing something
>
>
> On 12 ene, 16:50, Kostya Vasilyev <[email protected]> wrote:
>> No, you don't have to.
>>
>> Quoting myself: :)
>>
>> > For a manifest-registered broadcast receiver, Android will do this
>> > (create the process and load the code if necessary) for you, and then
>> > execute the receiver's onReceive.
>>
>> I also recommend reading this:
>>
>> http://developer.android.com/guide/topics/fundamentals.html
>>
>> In particular, it says:
>>
>>
>>
>> Although broadcast receivers don't display a user interface, they may
>> create a status bar notification to alert the user when a broadcast
>> event occurs.
>> <<<
>>
>> Sounds like exactly what you intend to do.
>>
>> ... and reading this:
>>
>> http://developer.android.com/reference/android/content/BroadcastRecei...
>>
>>
>>
>> You can either dynamically register an instance of this class with
>> Context.registerReceiver() or statically publish an implementation
>> through the <receiver> tag in your AndroidManifest.xml
>> <<<
>>
>>
>>
>> The BroadcastReceiver class (when launched as a component through a
>> manifest's <receiver> tag) is an important part of an application's
>> overall lifecycle.
>> <<<
>>
>> -- Kostya
>>
>> 12 января 2012 г. 19:35 пользователь saex <[email protected]> написал:
>>
>>
>>
>>
>>
>>
>>
>> > then i must open the app and close it to activate the broadcast??? how
>> > can i do that?
>>
>> > On 12 ene, 16:26, Kostya Vasilyev <[email protected]> wrote:
>> >> I believe I did:
>>
>> >> > > a
>> >> > > notification must be shown in the notification bar, and if the user
>> >> > > press on the notification, my app must be started and show a specific
>> >> > > activity describing that notification, and not the normal fist
>> >> > > activity of my app
>>
>> >> .... and explained how to go from a notification displayed by some
>> >> piece of your code to a particular activity within your app, and not
>> >> the main/launcher activity.
>>
>> >> Let's try and get the terminology straight(-er):
>>
>> >> Executing code in a broadcast receiver, or any code in any application
>> >> is only possible in a started application, by definition - code can't
>> >> execute surrounded by nothingness, there has to be a process to run
>> >> it.
>>
>> >> This does not necessarily mean starting the main/launcher activity: a
>> >> broadcast receiver or a service have no UI of their own, a
>> >> PendingIntent used in a Notification can resolve to something else,
>> >> etc.
>>
>> >> For a manifest-registered broadcast receiver, Android will do this
>> >> (create the process and load the code if necessary) for you, and then
>> >> execute the receiver's onReceive.
>>
>> >> -- Kostya
>>
>> >> 12 января 2012 г. 19:07 пользователь saex <[email protected]> написал:
>>
>> >> > no no, you didn't understand my question, im telling you that the app
>> >> > must be NOT STARTED, and the broadcastreceiver must start it; please,
>> >> > read it again and answer me
>>
>> >> > On 12 ene, 15:49, Kostya Vasilyev <[email protected]> wrote:
>> >> >> When creating a notification, you're supposed to supply a
>> >> >> PendingIntent. When the user click on the notification, this
>> >> >> PendingIntent is "fired" by the system.
>>
>> >> >> What the PendingIntent resolves to is entirely up to you - it can be
>> >> >> any of your activities, not necessarily the main/launcher one.
>>
>> >> >>http://developer.android.com/guide/topics/ui/notifiers/notifications....
>>
>> >> >>http://developer.android.com/reference/android/app/PendingIntent.html
>>
>> >> >> For Android 3.0 and higher, consider using getActivities() / note the
>> >> >> plural / to take the user inside your activity stack.
>>
>> >> >> -- Kostya
>>
>> >> >> 12 января 2012 г. 18:45 пользователь saex <[email protected]> 
>> >> >> написал:
>>
>> >> >> > i want that when the phone receives a push notification from AC2M, a
>> >> >> > notification must be shown in the notification bar, and if the user
>> >> >> > press on the notification, my app must be started and show a specific
>> >> >> > activity describing that notification, and not the normal fist
>> >> >> > activity of my app.
>>
>> >> >> > It is possible to achieve this? can someone explain me how?
>>
>> >> >> > My app must be started to listen the receiver? or can my app be not
>> >> >> > started?
>>
>> >> >> > thanks
>>
>> >> >> > --
>> >> >> > You received this message because you are subscribed to the Google
>> >> >> > Groups "Android Developers" group.
>> >> >> > To post to this group, send email to 
>> >> >> > [email protected]
>> >> >> > To unsubscribe from this group, send email to
>> >> >> > [email protected]
>> >> >> > For more options, visit this group at
>> >> >> >http://groups.google.com/group/android-developers?hl=en
>>
>> >> > --
>> >> > You received this message because you are subscribed to the Google
>> >> > Groups "Android Developers" group.
>> >> > To post to this group, send email to [email protected]
>> >> > To unsubscribe from this group, send email to
>> >> > [email protected]
>> >> > For more options, visit this group at
>> >> >http://groups.google.com/group/android-developers?hl=en
>>
>> > --
>> > You received this message because you are subscribed to the Google
>> > Groups "Android Developers" group.
>> > To post to this group, send email to [email protected]
>> > To unsubscribe from this group, send email to
>> > [email protected]
>> > For more options, visit this group at
>> >http://groups.google.com/group/android-developers?hl=en
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to