Start service

by Alex » Thu, 08 Jul 2010 02:29:12 GMT


Sponsored Links
 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!!


--



Start service

by Mark Murphy » Thu, 08 Jul 2010 03:10:18 GMT


 A BroadcastReceiver is not a Context and so does not have a
startService() method. Call startService() on the Context supplied to
the onReceive() method.



>


Sponsored Links


Other Threads

1. How can I partecipate to an Android project?

Hi everybody. I'm a student in computer science. I know Java, I don't
know Android framework and the design patterns but I wish I learn
them. Where can I find an Android project which I might partecipate?
I'm sorry for my terrible english. Thank you :D

-- 

2. Status bar expanded dialog and Search dialog will not cover entire screen in 1.6r1?

Status bar expanded dialog and Search dialog will not cover the entire
screen if we are running the emulator with 480x800 skin with default
dpi (160)?. But other applications runs in full screen.

But running with skin WVGA800 (or HVGA or WVGA854) displays both
status bar expanded and search dialog correctly. Am I missing
somethings here? or is it the expected behavior?. How can I make it
cover entire screen?

// Thanks
// TG

-- 
unsubscribe: android-porting+unsubscr...@googlegroups.com
website: 

3. play video encounter PV SW DECODER IS USED FOR MPEG4

4. building 1.6 for a cdma device

5. Layar agak buram

6. How to move homescreen focus to specific widget?

7. The application android has stopped unexpectedly