服务错误

时间:2014-05-04 10:51:56

标签: android

我得到了这个代码并且它出错了 此行有多个标记      - UpdateService类型必须实现继承的抽象方法      Service.onBind(意向)      - UpdateService类的非法修饰符;只有公共的,抽象的和允许进入决赛

import android.app.Service;
import android.content.BroadcastReceiver;
import android.content.Intent;
import android.content.IntentFilter;

public static class UpdateService extends Service {

@Override
public void onCreate() {
    super.onCreate();
    // register receiver that handles screen on and screen off logic
    IntentFilter filter = new IntentFilter(Intent.ACTION_SCREEN_ON);
    filter.addAction(Intent.ACTION_SCREEN_OFF);
    BroadcastReceiver mReceiver = new Receiver();
    registerReceiver(mReceiver, filter);
}

@Override
public void onStart(Intent intent, int startId) {
    boolean screenOn = intent.getBooleanExtra("screen_state", false);
    if (!screenOn) {
        // your code
    } else {
        // your code
    }
}
}

0 个答案:

没有答案