Thanks, I'll try

On 16 май, 23:21, Mark Murphy <[email protected]> wrote:
> The device is falling asleep before your startService() and
> startActivity() (YUCK!!!) calls complete. This is perfectly normal.
>
> For your startService(), perhaps you can use the WakefulIntentService 
> approach:
>
> https://github.com/commonsguy/cwac-wakeful
>
>
>
>
>
>
>
>
>
> On Mon, May 16, 2011 at 4:17 PM, Nick <[email protected]> wrote:
> > n my alarm clock I use the following code to enable signals:
>
> > Intent i = new Intent(AlarmReciever.ACTION_WAKEUP);
> > i.putExtra(AlarmDao.ID_COLUMN, a.getId());
> > PendingIntent pendingIntent = PendingIntent.getBroadcast(
> > context, a.getId(), i, PendingIntent.FLAG_CANCEL_CURRENT);
> > Calendar cal = a.getNextAlarm();
> > if(cal!=null){
> >    AlarmManager alarmManager = (AlarmManager)
> > context.getSystemService(context.ALARM_SERVICE);
> >    alarmManager.set(AlarmManager.RTC_WAKEUP, cal.getTimeInMillis(),
> > pendingIntent);
> >    if(toast) showToast(context, cal);
> > }
> > My receiver starts service, that plays music and show "switch off"
> > dialog.
>
> > onReceive(....
> > context.startService(wakePlayer);
> > context.startActivity(wakeWindow);
> > ...}
> > The problem with this code is that sometimes it fails. I mean it
> > doesn't start music and show the dialog. Have anyone faced the same
> > problem?
>
> > --
> > 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
>
> --
> Mark Murphy (a Commons 
> Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy
>
> Android 3.0 Programming Books:http://commonsware.com/books

-- 
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