• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps startforeground problems

tneva82

Newbie
Been looking at net for couple examples on that(not that good tutorials that I have been able to found so far). So far basic gist has been:

Code:
Notification myNotification=new Notification(R.drawable.myLogo, getText(R.string.notificationText),
                System.currentTimeMillis());
        
        Service.startForeground(NOTIFICATION, myNotification);

If the last line doesn't have the Service. then it complains:

Description Resource Path Location Type
The method startForeground(int, Notification) is undefined for the type myActivity MyActivity.java... yadda yadda. If the Service. is there then error is:

Description Resource Path Location Type
Cannot make a static reference to the non-static method startForeground(int, Notification) from the type Service

(very funny to give example code, say "just put this in and you are good to go" and then when you try to do that results in mere compiler errors :-/)

What am I doing wrong? Probably quite a lot :(
 
Back
Top Bottom