Tuesday, March 27, 2012

[android-developers] Re: Start service

write like context.startservice();


On Sunday, 4 July 2010 23:29:34 UTC+5:30, Alex wrote:
Hi there,
I am trying to start a service from the BroadcastReceiver, but I keep
getting the startService line marked as an error (The constructor
Intent(alarmReceiver, Class<aService>) is undefined)

public class alarmReceiver extends BroadcastReceiver{

        NotificationManager notifMgr;

        private static final int NOTIFICATION_ID = 0;

        @Override
        public void onReceive(Context context, Intent intent) {

                startService(new Intent(this,aService.class));
        }
}

Any help is greatly appreciated.
Thanks!!



On Sunday, 4 July 2010 23:29:34 UTC+5:30, Alex wrote:
Hi there,
I am trying to start a service from the BroadcastReceiver, but I keep
getting the startService line marked as an error (The constructor
Intent(alarmReceiver, Class<aService>) is undefined)

public class alarmReceiver extends BroadcastReceiver{

        NotificationManager notifMgr;

        private static final int NOTIFICATION_ID = 0;

        @Override
        public void onReceive(Context context, Intent intent) {

                startService(new Intent(this,aService.class));
        }
}

Any help is greatly appreciated.
Thanks!!


--
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+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment