本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例14: onStartCommand
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
log.d("onStartCommand");
return Service.START_NOT_STICKY;
}
示例15: onStartCommand
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
return Service.START_NOT_STICKY;
}