当前位置: 首页>>代码示例>>Java>>正文


Java Service.START_NOT_STICKY属性代码示例

本文整理汇总了Java中android.app.Service.START_NOT_STICKY属性的典型用法代码示例。如果您正苦于以下问题:Java Service.START_NOT_STICKY属性的具体用法?Java Service.START_NOT_STICKY怎么用?Java Service.START_NOT_STICKY使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在android.app.Service的用法示例。


在下文中一共展示了Service.START_NOT_STICKY属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onStartCommand

@Override
public int onStartCommand(Intent intent, int flags, int startId) {
    mStartID = startId;

    // Check if we got an intent to clear the current login
    if (intent.getBooleanExtra("clear_drive_data", false)){
        // Could be a race condition here, thus we need to set a flag to clear the account
        // in case we're not connected yet, but also call ClearAccount if we are connected.
        shouldClearAccount = true;
        if (getGoogleApiClient().isConnected()) {
            ClearAccount();
        }
    } else {
        // Only sync if the use Google Drive setting is true
        if (mSharedPreferences.getBoolean(PREF_USE_GOOGLE_DRIVE, false)) {
            Toast.makeText(this, "Starting Google Drive Sync", Toast.LENGTH_SHORT).show();
            FindOrCreateDriveFile();
        }
    }

    return Service.START_NOT_STICKY;
}
 
开发者ID:etsy,项目名称:divertsy-client,代码行数:22,代码来源:SyncToDriveService.java

示例2: onStartCommand

@Override
public int onStartCommand(Intent intent, int flags, int startId) {
    Log.d(TAG, "Service is started");

    if (android.os.Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP)
        return Service.START_NOT_STICKY;
    if (android.os.Build.VERSION.SDK_INT > Build.VERSION_CODES.LOLLIPOP_MR1)
        return Service.START_NOT_STICKY;

    IntentFilter filter = new IntentFilter();
    filter.addAction(ACTION_SET_STATE);
    registerReceiver(settingsReceiver, filter);

    mGoogleApiClient = new GoogleApiClient.Builder(this)
            .addApi(Wearable.API)
            .build();

    mGoogleApiClient.connect();

    int interruptionFilter = getCurrentInterruptionFilter();
    SettingsService.sendState(mGoogleApiClient, interruptionFilter, mStateTime);

    return Service.START_STICKY;
}
 
开发者ID:rkkr,项目名称:wear-dnd-sync,代码行数:24,代码来源:LGHackService.java

示例3: onStartCommand

public int onStartCommand(Intent intent, int flags, int startId) {
    path = intent.getStringExtra("path");
    if (path == null) {
        stopSelf();
        return Service.START_NOT_STICKY;
    }
    FileLog.e("tmessages", "start video service");
    if (builder == null) {
        builder = new NotificationCompat.Builder(ApplicationLoader.applicationContext);
        builder.setSmallIcon(android.R.drawable.stat_sys_upload);
        builder.setWhen(System.currentTimeMillis());
        builder.setContentTitle(LocaleController.getString("AppName", R.string.AppName));
        builder.setTicker(LocaleController.getString("SendingVideo", R.string.SendingVideo));
        builder.setContentText(LocaleController.getString("SendingVideo", R.string.SendingVideo));
    }
    currentProgress = 0;
    builder.setProgress(100, currentProgress, currentProgress == 0);
    startForeground(4, builder.build());
    NotificationManagerCompat.from(ApplicationLoader.applicationContext).notify(4, builder.build());
    return Service.START_NOT_STICKY;
}
 
开发者ID:MLNO,项目名称:airgram,代码行数:21,代码来源:VideoEncodingService.java

示例4: onStartCommand

@Override
public int onStartCommand(Intent intent, int flags, int startId) {
    this.start();

    if(intent != null){
        String deviceAddress = intent.getStringExtra(KEY_MAC_ADDRESS);
        if(deviceAddress != null){
            try{
                BluetoothDevice device = mAdapter.getRemoteDevice(deviceAddress.toUpperCase());
                this.connect(device, false);
            }catch(RuntimeException e){
                EventBus.getDefault().post(new UiToastEvent(e.getMessage()));
                Crashlytics.logException(e);
                Crashlytics.log("MAC ADDRESS: " + KEY_MAC_ADDRESS);
                disconnectService();
                stopSelf();
            }
        }
    }else{
        EventBus.getDefault().post(new UiToastEvent(getString(R.string.unknown_error)));
        disconnectService();
        stopSelf();
    }

    return Service.START_NOT_STICKY;
}
 
开发者ID:zeevy,项目名称:grblcontroller,代码行数:26,代码来源:GrblSerialService.java

示例5: onStartCommand

@Override
public int onStartCommand(Intent intent, int flags, int startId) {
    Log.d(TAG, "onStartCommand()");

    // Create an instance of GoogleAPIClient.
    if (mGoogleApiClient == null) {
        mGoogleApiClient = new GoogleApiClient.Builder(this)
                .addConnectionCallbacks(this)
                .addOnConnectionFailedListener(this)
                .addApi(LocationServices.API)
                .build();
        mGoogleApiClient.connect();
    }

    //Reset triggered tasks
    SharedPreferenceUtil.setTriggeredTaskList(new ArrayList<Integer>(), getApplicationContext());

    //Update Alarms
    AlarmManagerUtil.updateAlarms(getApplicationContext());


    return Service.START_NOT_STICKY;
}
 
开发者ID:abicelis,项目名称:Remindy,代码行数:23,代码来源:NotificationIntentService.java

示例6: onStartCommand

@Override
public int onStartCommand(Intent intent, int flags, int startId) {
    if (DebugOverlay.DEBUG) {
        Log.i(TAG, "onStartCommand() called");
    }
    config = intent.getParcelableExtra(DebugOverlay.KEY_CONFIG);
    // no need to restart this service
    return Service.START_NOT_STICKY;
}
 
开发者ID:Manabu-GT,项目名称:DebugOverlay-Android,代码行数:9,代码来源:DebugOverlayService.java

示例7: onStartCommand

@Override
public int onStartCommand(Intent intent, int flags, int startId) {
    Log.d(TAG, "Vibrate Service started");
    return Service.START_NOT_STICKY;
    //return super.onStartCommand(intent, flags, startId);

}
 
开发者ID:ponewheel,项目名称:android-ponewheel,代码行数:7,代码来源:VibrateService.java

示例8: onStartCommand

@Override
public int onStartCommand(Intent intent, int flags, int startId) {
    if (!running) {
        Log.i(TAG, "Command starting");
        final IntentFilter filter = new IntentFilter();
        filter.addAction(SKIP_INTENT);
        filter.addAction(STOP_INTENT);
        filter.addAction(PAUSE_INTENT);
        filter.addAction(RESUME_INTENT);
        registerReceiver(receiver, filter);
        start();
    }
    return Service.START_NOT_STICKY;
}
 
开发者ID:steevp,项目名称:UpdogFarmer,代码行数:14,代码来源:SteamService.java

示例9: onStartCommand

public int onStartCommand(Intent intent, int flags, int startId) {
    if (intent != null) {
        String action = intent.getAction();
        if (SessionAlarmService.ACTION_NOTIFICATION_DISMISSAL.equals(action)) {
            String sessionId = intent.getStringExtra(SessionAlarmService.KEY_SESSION_ID);
            LOGD(TAG, "onStartCommand(): Action = ACTION_NOTIFICATION_DISMISSAL Session: "
                    + sessionId);
            dismissWearableNotification(sessionId);
        }
    }
    return Service.START_NOT_STICKY;
}
 
开发者ID:dreaminglion,项目名称:iosched-reader,代码行数:12,代码来源:FeedbackWearableListenerService.java

示例10: onStartCommand

public int onStartCommand(Intent intent, int flags, int startId) {
    path = intent.getStringExtra("path");
    boolean isGif = intent.getBooleanExtra("gif", false);
    if (path == null) {
        stopSelf();
        return Service.START_NOT_STICKY;
    }
    FileLog.e("tmessages", "start video service");
    if (builder == null) {
        builder = new NotificationCompat.Builder(ApplicationLoader.applicationContext);
        builder.setSmallIcon(android.R.drawable.stat_sys_upload);
        builder.setWhen(System.currentTimeMillis());
        builder.setContentTitle(LocaleController.getString("AppName", R.string.AppName));
        if (isGif) {
            builder.setTicker(LocaleController.getString("SendingGif", R.string.SendingGif));
            builder.setContentText(LocaleController.getString("SendingGif", R.string.SendingGif));
        } else {
            builder.setTicker(LocaleController.getString("SendingVideo", R.string.SendingVideo));
            builder.setContentText(LocaleController.getString("SendingVideo", R.string.SendingVideo));
        }
    }
    currentProgress = 0;
    builder.setProgress(100, currentProgress, currentProgress == 0);
    startForeground(4, builder.build());
    NotificationManagerCompat.from(ApplicationLoader.applicationContext).notify(4, builder.build());
    return Service.START_NOT_STICKY;
}
 
开发者ID:pooyafaroka,项目名称:PlusGram,代码行数:27,代码来源:VideoEncodingService.java

示例11: onStartCommand

@Override
    public int onStartCommand(Intent intent, int flags, int startId) {

        //初始化发送通知
        notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
        PendingIntent pendingIntent = PendingIntent.getActivity(this, 1, new Intent(),
                PendingIntent.FLAG_UPDATE_CURRENT);
        remoteViews = new RemoteViews
                (getPackageName(), R.layout.custom_notification);
        builder = new NotificationCompat.Builder(this);
        notification = builder.setSmallIcon(R.mipmap.launcher512_qihoo)
                .setContent(remoteViews)
                .setAutoCancel(true)
                .setContentIntent(pendingIntent)
                .setWhen(System.currentTimeMillis())
                .build();

//        initDownManager();
        try {
            // 调用下载
            initDownManager();
        } catch (Exception e) {
            Log.e("异常", e.getMessage());
            e.printStackTrace();
            Toast.makeText(getApplicationContext(), "下载失败", Toast.LENGTH_SHORT).show();
        }
        return Service.START_NOT_STICKY;
    }
 
开发者ID:BittleDragon,项目名称:MyRepository,代码行数:28,代码来源:DownloadService.java

示例12: onStartCommand

@Override
public int onStartCommand(Intent intent, int flags, int startId) {
    Bundle data = intent.getExtras();
    if(data != null) {
        save((Ruuvitag) data.getParcelable("favorite"));
    }
    return Service.START_NOT_STICKY;
}
 
开发者ID:CentriaUniversityOfAppliedSciences,项目名称:Android_RuuvitagScannner,代码行数:8,代码来源:ScannerService.java

示例13: onStartCommand

@Override
public int onStartCommand(Intent intent, int flags, int startId) {
    log.d("onStartCommand");
    get7();
    return Service.START_NOT_STICKY;
}
 
开发者ID:yippeesoft,项目名称:NotifyTools,代码行数:6,代码来源:HeWeatherService.java

示例14: onStartCommand

@Override
public int onStartCommand(Intent intent, int flags, int startId) {
    log.d("onStartCommand");
    return Service.START_NOT_STICKY;
}
 
开发者ID:yippeesoft,项目名称:NotifyTools,代码行数:5,代码来源:NotifyService.java

示例15: onStartCommand

@Override
public int onStartCommand(Intent intent, int flags, int startId) {
    return Service.START_NOT_STICKY;
}
 
开发者ID:mezau532,项目名称:smart_commuter,代码行数:4,代码来源:GetCurrentLocation.java


注:本文中的android.app.Service.START_NOT_STICKY属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。