Hi Kostya,

I removed the category, but have still the same issue: boot completed
is never recognized. You said you dont see the other action. I create
the Broadcast- Intent and put it into PendingIntent.getBroadcast(),
without a action in AndroidManifest:
...
alertReceiverIntent = new Intent(this, AlertReceiver.class);
alarmSender = PendingIntent.getBroadcast(this, task.getId(),
alertReceiverIntent, 0);
// insert a new alert
mAlarmManager.set(AlarmManager.RTC_WAKEUP, deliverTime, alarmSender);
...

The receiver is used like expected, onReceive() is called, but never
when the device came up.
I can try using a second receiver if it is ever possible, only for
boot recognization. But this seems not the best way... My receiver
should be able to differ between actions and do several things...

Thanks a lot!
-Danny S.

On 27 Jan., 14:15, Kostya Vasilyev <kmans...@gmail.com> wrote:
> Danny,
>
> You don't need a <category> in the filter to receive BOOT_COMPLETED,
> just <action>. In fact, that's probably the cause of your code not
> receiving it.
>
> Also I don't see "the other" action in the manifest, for receiving your
> own alarms.
>
> -- Kostya
>
> 27.01.2011 16:00, Danny S. пишет:
>
>
>
>
>
>
>
>
>
> > Hi,
>
> > I tried to implement a receiver that will be called when the device
> > booted:
>
> >            <receiver android:name=".AlertReceiver">
> >                    <intent-filter>
> >                            <action 
> > android:name="android.intent.action.BOOT_COMPLETED" />
> >                            <category 
> > android:name="android.intent.category.HOME" />
> >                    </intent-filter>
> >            </receiver>
>
> > <uses-permission
> > android:name="android.permission.RECEIVE_BOOT_COMPLETED" />  is already
> > added in AndroidManifest.xml.
>
> > I am using the receiver for recognizing alarms AND want to use the
> > same for check whether the device has booted. The alarm came up, but I
> > found no output on log console for recognizing that the device booted
> > successfully. Here is the code of the receivers onReceive() method:
>
> > if (Intent.ACTION_BOOT_COMPLETED.equals(intent.getAction()))
> >                    Log.i("AlertReceiver", "Boot completed :D");
> >            else {
> >                    Log.d("AlertReceiver", "Intent action is: " + 
> > intent.getAction());
> >                    Toast.makeText(context, "Alarm scheduled",
> > Toast.LENGTH_SHORT).show();
> >                    System.out.println("AlertManager alert succeeded!");
> >            }
>
> > I started the emulator without new installation of my app so I
> > expected the output "Boot completed :D"... What is my fault? Is my
> > receiver construct in the manifest incorrect?
>
> > Hope you can help me,
> > Thanks a lot!
> > -Danny S.
>
> > On 20 Jan., 10:33, Kostya Vasilyev<kmans...@gmail.com>  wrote:
> >> Danny,
>
> >> Android already keeps a global registry of pending intents, so keeping a
> >> parallel hash map should not be necessary.
>
> >> To cancel an alarm, you don't need a reference to the original Java
> >> object, you can just construct a pending intent the same way as you did
> >> when setting the alarm (including the request code).
>
> >> The hash table can go away with the process, while alarms persist (with
> >> them being inside Android). If you're relying on the map being an
> >> up-to-date representation of your alarms, make sure that it's correctly
> >> reconstructed from scratch - or get rid of it altogether.
>
> >> -- Kostya
>
> >> 20.01.2011 11:55,DannyS. пишет:
>
> >>> Good Morning!
> >>> Wow, you helped me to get it work. I create a PendingIntent with a
> >>> unique id and store the intent mapped to their IDs in a HashMap. I
> >>> collect all intents with the known id and can the cancel them using
> >>> the AlarmManager. I dont know if it is recommended and efficient to
> >>> store those intents in a HashMap, but I need the PendingIntent when
> >>> I'll cancel the alarm and it worked.
> >>> Maybe I have to optimize something, but now I understood how to work
> >>> with the AlarmManager AND multiple scheduling tasks.
> >>> Thans a lot!
> >>> -DannyS.
> >>> On 19 Jan., 17:26, Kostya Vasilyev<kmans...@gmail.com>    wrote:
> >>>> Danny,
> >>>> The issue with multiple alarms comes up quite often, this is one of
> >>>> several responses:
> >>>>http://groups.google.com/group/android-developers/browse_thread/threa...
> >>>> -- Kostya
> >>>> 19.01.2011 19:09,DannyS. пишет:
> >>>>> Hi,
> >>>>> the AlarmManager is exactly what I need. It works fine, but I don't
> >>>>> figured out yet how to set more than 1 alarm on a AlarmManager.
> >>>>> I am using a BroadcastReceiver to receive that is called if the
> >>>>> scheduling time is reached. First I forgot to add the receiver- Tag in
> >>>>> the AndroidManifest.xml and wondered why the alarm is not fired ^^ But
> >>>>> now it works, but only for the last data I set on the manager.
> >>>>> Hope you can help, meanwhile I go home and do some searches on
> >>>>> Google :D
> >>>>> ´Thanks!
> >>>>> -DannyS.
> >>>>> On Jan 19, 10:49 am, "DannyS."<danny.schi...@googlemail.com>      wrote:
> >>>>>> Hello Kostya,
> >>>>>> WOW, thank you very much, I'll have a look and reply with results and
> >>>>>> questions if I have ;-)
> >>>>>> -DannyS.
> >>>>>> On Jan 19, 9:09 am, Kostya Vasilyev<kmans...@gmail.com>      wrote:
> >>>>>>> 19.01.2011 10:07,DannyS. пишет:
> >>>>>>>> Hi,
> >>>>>>>> I have a service that is running in background. It needs to send
> >>>>>>>> notifications to the user. In my application you can create data with
> >>>>>>>> date and time. The service now can fetch this data and give the user 
> >>>>>>>> a
> >>>>>>>> notification t-x minutes before the saved time is reached ("remind 
> >>>>>>>> for
> >>>>>>>> appointments").
> >>>>>>>> Can I set a fix moment when the service should send the user a
> >>>>>>>> notification instead of listen/check all the time for (approximately)
> >>>>>>>> time identity?
> >>>>>>> See AlarmManager
> >>>>>>>> And a secondary question: how can I set "Autostart" for the
> >>>>>>>> applications service?
> >>>>>>> See Intent.ACTION_BOOT_COMPLETED
> >>>>>>> -- Kostya
> >>>>>>>> Thanks a lot!
> >>>>>>>> -DannyS.
> >>>>>>> --
> >>>>>>> Kostya Vasilyev -- WiFi Manager + pretty widget 
> >>>>>>> --http://kmansoft.wordpress.com
> >>>> --
> >>>> Kostya Vasilyev -- WiFi Manager + pretty widget 
> >>>> --http://kmansoft.wordpress.com
> >> --
> >> Kostya Vasilyev -- WiFi Manager + pretty widget 
> >> --http://kmansoft.wordpress.com
>
> --
> Kostya Vasilyev -- WiFi Manager + pretty widget 
> --http://kmansoft.wordpress.com

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

Reply via email to