>From what you've described, I suspect you are doing your receiver only in
code, which will not allow you to do what you want... This kind of receiver
is only active while your activity is active. Since your activity is not
active, neither is your receiver.

Why not just start your activity explicitly?

On Tue, Jan 19, 2016 at 3:34 PM NuffsaidM8 <mcditt...@gmail.com> wrote:

> I have a broadcast receiver that is detecting a boot up of the phone. This
> part works fine. What I want to do is send a notification to a broadcast
> receiver in the Main Activity of the app, which is registered in the
> onCreate method as having an intent filter of "RESET_ALARM". This is what
> doesn't seem to be working. I tried starting the application with this
> (found it on stackkoverflow):
>
> Intent i = new Intent(context, MainActivity.class);
> i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
> context.startActivity(i);
> Intent intent1 = new Intent("RESET_ALARM");
> context.sendBroadcast(intent1);
>
> but this does not seem to be working. I know the code is running, but a
> log statement in the receiver in the MainActivity.class file is not logging
> to the logcat. What am I doing wrong?
>
> --
> 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/948117f7-0e11-41a0-9745-f16e19099d17%40googlegroups.com
> <https://groups.google.com/d/msgid/android-developers/948117f7-0e11-41a0-9745-f16e19099d17%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-6eU4js-JwqX0Otb3Og0%2Bg5JAWMkO%2BgGxXNpyYqmwCng%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to