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;

        public void onReceive(Context context, Intent intent) {

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

Any help is greatly appreciated.


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. PackageManager ComponentInfo error getting assets?

my application caches static resources in its /assets directory and 
implements a content provider to provide them to a WebView on 
request. i kinda have to drive around the houses a bit because it 
seems i can't get a linear file descriptor on an asset, i get "this 
resource is zipped" or somesuch, don't know why that's a problem. the 
content provider just caches the asset in /sdcard and then returns a 
file descriptor off that.

this has been mostly working fine, but i've started seeing errors 
from the PackageManager. nothing's changed on my end, the assets are 
still there, etc.

the actual error i'm getting is --$NameNotFoundException: 

(where "package" is the name of the package, etc)

can i get anything wrong with this stuff? caching javascript and css 
stuff in the apk has been a big performance win.



2. How 2 install app on MY phone

Does anyone know how to install an app on your personal phone?  I saw
a post that i thought would do it, but that did'nt work.  I have a app
that I would like to install on MY phone, to use it, test it and debug
it, prior to public offering(ANDROID MARKET).
Can be just a java program, or does it have to be an android app?  Is
there any documentation available on how to achieve this?  My job does
not allow me alot of time to develop apps, so if there is anyone who
could help, please email me,
Additionally, is there any documentation on ECLIPSE.  Tried following
install instructions, but having problems, as well as ANT.
thank you very much for all your help,

3. Method to detect a widget is visible - or otherwise in the foreground or background?

4. Notification and NotificationManager

5. persistent saveCacheFile in webview?

6. notifydatasetchanged in a ListView and handle Event click

7. Capture key pressed