My apologies... looking at your code again, I was a bit mistaken... you are
using an explicit intent to start your activity.  My guess is that the
broadcast is getting sent before your activity has registered itself.

If that is indeed the case, I would suggest passing extra data through the
intent used to start the activity.  When your activity starts up, you can
look for this data, and if present, you know you are starting it from your
broadcast receiver and you need to reset the alarm (I assume you are doing
something like that based on the code).

I still think it would be good to read up on this though:
http://developer.android.com/guide/components/intents-filters.html

Sorry for the confusion... that's what I get for scanning the code too
quickly. I missed your startActivity() call in the middle of the code
snippet.

Hope that helps,
Justin

On Tue, Jan 19, 2016 at 4:21 PM Justin Anderson <magouyaw...@gmail.com>
wrote:

> If you send a broadcast, and your activity isn't currently running, then
> your Broadcast receiver isn't registered with the OS. How could it be? Your
> activity hasn't run the code to register itself.  And, furthermore, if
> you've done it correctly, when your activity goes away, it should
> unregister itself or you will run into problems.
>
> I think you are confusing receivers with intent-filters. I would read
> through this before continuing:
> http://developer.android.com/guide/components/intents-filters.html
>
> I think what you are TRYING to do is the equivalent of using an intent
> filter to implicitly start your activity.  But that is likely overkill.
> When you are trying to launch an activity that is part of your own
> application, 99% of the time you will want to use an explicit intent to
> start the activity.
>
> In both cases, you will want to use the context.startActivity() method...
> The difference between implicit and explicit intents is in how you
> construct the Intent object.
>
> On Tue, Jan 19, 2016 at 4:02 PM NuffsaidM8 <mcditt...@gmail.com> wrote:
>
>> I did the receiver with only code, that's correct. What do you mean that
>> I need to start the activity? I thought that was what I was doing.
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Android Developers" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to android-developers+unsubscr...@googlegroups.com.
>> To post to this group, send email to android-developers@googlegroups.com.
>> Visit this group at https://groups.google.com/group/android-developers.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/android-developers/dc32640d-926f-4033-9198-5b94e6f4298d%40googlegroups.com
>> <https://groups.google.com/d/msgid/android-developers/dc32640d-926f-4033-9198-5b94e6f4298d%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
To post to this group, send email to android-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/android-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/android-developers/CAOq06s_-sehxEY26U7U1XNkQmpHqR8upb%3D0jkMR3qsXAgFyk2w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to