마스터Q&A 안드로이드는 안드로이드 개발자들의 질문과 답변을 위한 지식 커뮤니티 사이트입니다. 안드로이드펍에서 운영하고 있습니다. [사용법, 운영진]

오류 도움주시면 감사하겠습니다.

0 추천
http://ccdev.tistory.com/22 소스 참고했습니다.
 
public class ScreenService extends Service {

    private ScreenReciver mReceiver = null;

    @Override
    public IBinder onBind(Intent intent) {
        return null;
    }

    @Override
    public void onCreate(){
        super.onCreate();

        mReceiver = new ScreenReciver();
        IntentFilter filter = new IntentFilter(Intent.ACTION_SCREEN_OFF);
        registerReceiver(mReceiver, filter);
    }

    @Override

    public int onStartCommand(Intent intent, int flags, int startId){
        super.onStartCommand(intent, flags, startId);

        startForeground(1, new Notification());
        Notification notification = new Notification(R.drawable.a_launcher, "서비스 실행됨", System.currentTimeMillis());
        notification.setLastestEventInfo(getApplicationContext(), "Screen Service", "Foreground로 실행됨", null);
        startForeground(1, notification);


        if (intent != null) {
            if ( intent.getAction() == null) {
                if (mReceiver == null ) {
                    mReceiver = new ScreenReciver();
                    IntentFilter filter = new IntentFilter(Intent.ACTION_SCREEN_OFF);
                    registerReceiver(mReceiver, filter);
                }
            }
        }
        return  START_REDELIVER_INTENT;
    }

    @Override

    public  void onDestory() {
        super.onDestroy();

        if(mReceiver != null) {
            unregisterReceiver(mReceiver);
        }
    }
}
 
Error:(38, 21) error: cannot find symbol method setLatestEventInfo(Context,String,String,<null>)
Error:Execution failed for task ':app:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use or override a deprecated API.
Error:(53, 5) error: method does not override or implement a method from a supertype
 
도와주시면 감사하겠습니다 ㅠㅠ 초보라서 아직 미숙한점이 많네요..
하루종일 고민하고 수정해봐도 오류뜨네요
GyeongYeol (140 포인트) 님이 2015년 11월 9일 질문

1개의 답변

0 추천
https://github.com/OneBusAway/onebusaway-android/issues/290

api레벨 23에서 해당 메소드가 제거되었습니다.

빌드 타겟을 조정하세요
익명사용자 님이 2015년 11월 10일 답변
...