Java 类android.support.v4.app.ServiceCompat 实例源码

项目:androidclient    文件:MessageCenterService.java   
private void setForeground() {
    boolean enable = Preferences.getForegroundServiceEnabled(this);
    if (enable) {
        startForeground(NOTIFICATION_ID_FOREGROUND,
            MessagingNotification.buildForegroundNotification(this));
    }
    else {
        ServiceCompat.stopForeground(this, ServiceCompat.STOP_FOREGROUND_REMOVE);
    }
}
项目:informant-droid    文件:LocalServiceBroadcaster.java   
public int onStartCommand(Intent intent, int flags, int startId) {
    // Tell any local interested parties about the start.
    mLocalBroadcastManager.sendBroadcast(new Intent(ACTION_STARTED));

    // Prepare to do update reports.
    mHandler.removeMessages(MSG_UPDATE);
    Message msg = mHandler.obtainMessage(MSG_UPDATE);
    mHandler.sendMessageDelayed(msg, 1000);
    return ServiceCompat.START_STICKY;
}
项目:V.FlyoutTest    文件:LocalServiceBroadcaster.java   
public int onStartCommand(Intent intent, int flags, int startId) {
    // Tell any local interested parties about the start.
    mLocalBroadcastManager.sendBroadcast(new Intent(ACTION_STARTED));

    // Prepare to do update reports.
    mHandler.removeMessages(MSG_UPDATE);
    Message msg = mHandler.obtainMessage(MSG_UPDATE);
    mHandler.sendMessageDelayed(msg, 1000);
    return ServiceCompat.START_STICKY;
}