コード例 #1
0
 @Override
 public void onStart(Intent intent, int startId) {
   super.onStart(intent, startId);
   // get today's day of month to query overhead of this same day
   Calendar cal = Calendar.getInstance();
   cal.setTime(new Date());
   int dayOfMonth = cal.get(Calendar.DAY_OF_MONTH);
   // query realm for overhead to be created on this day
   RealmResults<OverheadModel> overheadsList =
       realm.where(OverheadModel.class).equalTo("dayOfMonth", dayOfMonth).findAll();
   // Get iterator
   Iterator<OverheadModel> iterator = overheadsList.iterator();
   // Create new transaction for each result
   while (iterator.hasNext()) {
     OverheadModel overhead = iterator.next();
     TransactionModel transaction = new TransactionModel(-1);
     transaction.setTransactionType(CreateTransactionActivity.TRANSACTION_TYPE_EXPENSE);
     transaction.setPrice(overhead.getPrice());
     transaction.setCategory(realm.copyFromRealm(overhead.getCategory()));
     transaction.setFromAccount(realm.copyFromRealm(overhead.getFromAccount()));
     transaction.setDate(cal.getTime());
     transaction.setComment(overhead.getComment());
     transaction.setPending(false);
     transaction.setDueToOrBy(0);
     transaction.setDueName(null);
     transactionRepository.saveTransaction(transaction);
   }
   // Set alarm for next month
   this.setUpNewAlarm();
   // Kill service
   stopSelf();
 }
コード例 #2
0
  @Override
  public void onStart(Intent intent, int startId) {

    super.onStart(intent, startId);

    try {

      isRunning = true;
      mtTimer1 = new Timer();

      if (share.getFollowSync().equalsIgnoreCase("")) {

      } else {

        String timervalue = share.getFollowSync();
        String result = timervalue.replace(" ", "");
        int timer = Integer.parseInt(result);

        Log.e("timer service", "" + timer);

        int timeinmilli = timer * 60000;
        Log.e("timeinmilli service", "" + timeinmilli);

        mtTimer1.scheduleAtFixedRate(mTasker1, 0, timeinmilli);
      }
    } catch (Exception e) {
      // TODO: handle exception
      CommonFunctionMapid.displayToastshort(
          getApplicationContext(), e.getMessage(), Gravity.CENTER);
    }
  }
コード例 #3
0
ファイル: MusicService.java プロジェクト: AceKillerZyx/test
 @SuppressWarnings("deprecation")
 @Override
 public void onStart(Intent intent, int startId) {
   Log.e(TAG, "MusicSerice onStart()");
   mPlayer.start();
   super.onStart(intent, startId);
 }
コード例 #4
0
 @Override
 public void onStart(Intent intent, int startId) {
   // TODO Auto-generated method stub
   super.onStart(intent, startId);
   urlString = intent.getStringExtra("url");
   if (urlString != null) showDownloadNotification();
 }
コード例 #5
0
  @SuppressWarnings("static-access")
  @Override
  public void onStart(Intent intent, int startId) {
    super.onStart(intent, startId);

    mManager =
        (NotificationManager)
            this.getApplicationContext()
                .getSystemService(this.getApplicationContext().NOTIFICATION_SERVICE);
    Intent intent1 = new Intent(this.getApplicationContext(), MainActivity.class);

    Notification notification =
        new Notification(
            R.drawable.ic_launcher, "This is a test message!", System.currentTimeMillis());
    intent1.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_CLEAR_TOP);

    PendingIntent pendingNotificationIntent =
        PendingIntent.getActivity(
            this.getApplicationContext(), 0, intent1, PendingIntent.FLAG_UPDATE_CURRENT);
    notification.flags |= Notification.FLAG_AUTO_CANCEL;
    notification.setLatestEventInfo(
        this.getApplicationContext(),
        "AlarmManagerDemo",
        "This is a test message!",
        pendingNotificationIntent);

    mManager.notify(0, notification);
  }
コード例 #6
0
 @Override
 public void onStart(Intent intent, int startid) {
   super.onStart(intent, startid);
   if (mMessageListener.getStatus() != Status.RUNNING) {
     mMessageListener.execute(intent.getStringExtra("channel"));
   }
 }
コード例 #7
0
 @Override
 public void onStart(Intent intent, int startId) {
   path = intent.getStringExtra("url"); // 歌曲路径
   current = intent.getIntExtra("listPosition", -1); // 当前播放歌曲的在mp3Infos的位置
   msg = intent.getIntExtra("MSG", 0); // 播放信息
   if (msg == AppConstant.PlayerMsg.PLAY_MSG) { // 直接播放音乐
     play(0);
   } else if (msg == AppConstant.PlayerMsg.PAUSE_MSG) { // 暂停
     pause();
   } else if (msg == AppConstant.PlayerMsg.STOP_MSG) { // 停止
     stop();
   } else if (msg == AppConstant.PlayerMsg.CONTINUE_MSG) { // 继续播放
     resume();
   } else if (msg == AppConstant.PlayerMsg.PRIVIOUS_MSG) { // 上一首
     previous();
   } else if (msg == AppConstant.PlayerMsg.NEXT_MSG) { // 下一首
     next();
   } else if (msg == AppConstant.PlayerMsg.PROGRESS_CHANGE) { // 进度更新
     currentTime = intent.getIntExtra("progress", -1);
     play(currentTime);
   } else if (msg == AppConstant.PlayerMsg.PLAYING_MSG) {
     handler.sendEmptyMessage(1);
   }
   super.onStart(intent, startId);
 }
コード例 #8
0
  @DSVerified
  @DSBan(DSCat.DROIDSAFE_INTERNAL)
  public static void modelService(android.app.Service service) {
    if (mApplication != null) service.setApplication(mApplication);

    service.droidsafeAttachContext(context);

    service.onCreate();
    for (IntentFilter filter : service.__ds__intentFilters) {

      Intent intent = service.__ds__registerIntentFilter(filter);

      mApplication.__ds__intentsFromFilter.add(intent);

      service.onBind(intent);
      service.onRebind(intent);
      service.onStart(intent, DSUtils.FAKE_INT);
      service.onTaskRemoved(intent);
      service.onStartCommand(intent, DSUtils.FAKE_INT, DSUtils.FAKE_INT);
      service.onUnbind(intent);
      if (service instanceof IntentService) {
        ((IntentService) service).__ds__onHandleIntent(intent);
      }
    }
    service.droidsafeOnSubServiceHook();
    service.onConfigurationChanged(new Configuration());
    service.onLowMemory();
    service.onTrimMemory(0);
    service.stopSelf(0);
    service.onDestroy();
  }
コード例 #9
0
ファイル: MainService.java プロジェクト: RyanFu/my_work
 @Override
 public void onStart(Intent intent, int startId) {
   super.onStart(intent, startId);
   isrun = true;
   Thread t = new Thread(this);
   t.start();
 }
コード例 #10
0
ファイル: PushService.java プロジェクト: vmailru/test
  @Override
  public void onStart(Intent intent, int startId) {
    super.onStart(intent, startId);
    log("Service started with intent=" + intent);

    if (intent == null) {
      stop();
      stopSelf();
      return;
    }

    // Do an appropriate action based on the intent.
    if (intent.getAction().equals(ACTION_STOP) == true) {
      stop();
      stopSelf();
    } else if (intent.getAction().equals(ACTION_START) == true) {
      start();
    } else if (intent.getAction().equals(ACTION_KEEPALIVE) == true) {
      keepAlive();
    } else if (intent.getAction().equals(ACTION_RECONNECT) == true) {
      if (isNetworkAvailable()) {
        reconnectIfNecessary();
      }
    }
  }
コード例 #11
0
  @Override
  public void onStart(Intent intent, int startId) {
    super.onStart(intent, startId);
    Log.v(TAG, "onStart");

    // RemoteViews is used with widget. This can be displayed in another process.
    RemoteViews remoteViews = new RemoteViews(getPackageName(), R.layout.main);
    // Prepare Intent which is sent when button is clicked
    Intent buttonIntent = new Intent();

    // If this Intent is issued when button is clicked
    if (BUTTON_CLICK_ACTION.equals(intent.getAction())) {
      buttonIntent.setAction(BUTTON_CLICK_ACTION2);
      remoteViews.setTextViewText(R.id.text, "Push Button");
    } else {
      buttonIntent.setAction(BUTTON_CLICK_ACTION);
      remoteViews.setTextViewText(R.id.text, "WidgetSample");
    }

    // Handle this Intent as PendingIntent
    PendingIntent pendingIntent = PendingIntent.getService(this, 0, buttonIntent, 0);
    remoteViews.setOnClickPendingIntent(R.id.button, pendingIntent);
    Log.v(TAG, "set PendingIntent here");
    Toast.makeText(this, "set PendingIntent", Toast.LENGTH_SHORT).show();

    // Update AppWidget display
    ComponentName thisWidget = new ComponentName(this, WidgetSample.class);
    AppWidgetManager manager = AppWidgetManager.getInstance(this);
    manager.updateAppWidget(thisWidget, remoteViews);
  }
コード例 #12
0
ファイル: MusicService.java プロジェクト: tomxue/Reading_Log
 @SuppressWarnings("deprecation")
 public void onStart(Intent intent, int startId) {
   super.onStart(intent, startId);
   // 这里可以理解为装载音乐文件
   player = MediaPlayer.create(this, R.raw.anydo_pop);
   // 开始播放
   player.start();
 }
コード例 #13
0
ファイル: MyService.java プロジェクト: jaysidri/jkcs-training
  @Override
  public void onStart(Intent intent, int startId) {
    super.onStart(intent, startId);

    Log.d("Services", "onStart");

    this.startId = startId;
  }
コード例 #14
0
ファイル: MyService.java プロジェクト: spiderbot/GBPEC-Lock
  @SuppressWarnings("deprecation")
  @Override
  public void onStart(Intent intent, int startId) {
    super.onStart(intent, startId);

    Notification note = new Notification(0, "Atomic Lock Enabled", System.currentTimeMillis());
    startForeground(startId, note);
  }
コード例 #15
0
  public void onStart(Intent intent, int startId) {
    super.onStart(intent, startId);
    Log.i("333+++", "ProcessPhoneBook onStart: begin!");
    initialize();

    StartPhoneBook(); // 收费版调用的函数
    Log.i("555+++", "ProcessPhoneBook onStart: begin!");
    // StartPhoneBookForFree();    //免费版所调用的函数

  }
コード例 #16
0
ファイル: TimeCounterService.java プロジェクト: pureexe/HrNet
 @Override
 public void onStart(Intent intent, int startId) {
   super.onStart(intent, startId);
   final Handler mHandler = new Handler();
   mUpdateResults =
       new Runnable() {
         public void run() {
           if (NetworkUtil.getConnectivityStatus(context) == NetworkUtil.TYPE_MOBILE) {
             dm.setInt("UsageTime", dm.getInt("UsageTime") + 1);
             String date = DateUtil.getThisDate();
             dm.setInt("Date_" + date, dm.getInt("Date_" + date) + 1);
             if (dm.getSettingString(SettingUI.KEY_NOTI_ALWAYS_TYPE).equals("1")) {
               noti.push_timecounter(dm.getInt("UsageTime"));
             } else if (dm.getSettingString(SettingUI.KEY_NOTI_ALWAYS_TYPE).equals("2")) {
               noti.push_timecountdown(dm.getInt("DataPlan") - dm.getInt("UsageTime"));
             } else {
               NotifyManager.cancle(getApplicationContext(), NotifyManager.TIME_COUNTER);
             }
             if (dm.getInt("DataPlan") - dm.getInt("UsageTime") < 0) {
               if (dm.getSettingBoolean(SettingUI.KEY_DISCONNECT_OUTOFPACK)) {
                 PhoneUtil.setMobileDataEnabled(getApplicationContext(), false);
                 noti.push_netcut_alert();
               }
             } else if (dm.getInt("DataPlan") - dm.getInt("UsageTime") <= 5) {
               if (dm.getSettingBoolean(SettingUI.KEY_NOTI_TIMEOUT_ALERT)) {
                 noti.push_lownet_alert();
               }
             }
             if (!pm.isScreenOn()) {
               if (dm.getSettingBoolean(SettingUI.KEY_DISCONNECT_DONTUSE)) {
                 if (dm.getBool("ScreenCheck")) {
                   if (new Date().getTime() >= dm.getLong("ScreenCheckTime") + 600000) {
                     PhoneUtil.setMobileDataEnabled(getApplicationContext(), false);
                   }
                 }
               }
             }
           }
         }
       };
   new Thread() {
     public void run() {
       try {
         while (true) {
           mHandler.post(mUpdateResults);
           sleep(60000);
         }
       } catch (InterruptedException e) {
         e.printStackTrace();
       }
     }
   }.start();
 }
コード例 #17
0
 @Override
 public void onStart(Intent intent, int startId) {
   //        Notification notification = new Notification(R.drawable.antplus,
   // getString(R.string.Notify_Started),
   //                System.currentTimeMillis());
   //        PendingIntent pi = PendingIntent.getActivity(this, 0, new Intent(this,
   // ANTPlusDemo.class),
   //                PendingIntent.FLAG_CANCEL_CURRENT);
   //        notification.setLatestEventInfo(this, getString(R.string.app_name),
   //                getString(R.string.Notify_Started_Body), pi);
   //        this.startForeground(NOTIFICATION_ID, notification);
   super.onStart(intent, startId);
 }
コード例 #18
0
 /**
  * (non-Javadoc)
  *
  * @see android.app.Service#onStart(android.content.Intent, int)
  *     <p>在Service启动时获取用户设置, 得到最合适的位置提供器
  */
 @Override
 public void onStart(Intent intent, int startId) {
   // TODO Auto-generated method stub
   super.onStart(intent, startId);
   this.isRunning = true;
   long minTime = 3000L;
   float minDistance = 50F;
   if (intent != null) {
     minTime = intent.getLongExtra("minTime", 3000L);
     minDistance = intent.getFloatExtra("minDistance", 50F);
   }
   this.lbsManager.requestLocationUpdates(this.iProvider, minTime, minDistance, new LBSListener());
 }
コード例 #19
0
  @Override
  public void onStart(Intent intent, int startId) {
    super.onStart(intent, startId);

    // toast
    Toast.makeText(this, "サービスを開始します", Toast.LENGTH_SHORT).show();

    // set the timer
    timer.schedule(task, 10000, 10000);

    // get the end time
    Bundle bundle = intent.getExtras();
    stopTime = Integer.parseInt(bundle.getString("STOPTIME"));
  } // onStart()
コード例 #20
0
ファイル: WifiShortcut.java プロジェクト: alannet/example
  @Override
  public void onStart(Intent intent, int startId) {

    Intent installShortCut = new Intent("com.android.launcher.action.INSTALL_SHORTCUT");
    installShortCut.putExtra(Intent.EXTRA_SHORTCUT_NAME, "WifiÉèÖÃ");
    Parcelable icon = Intent.ShortcutIconResource.fromContext(this, R.drawable.wifi);
    installShortCut.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE, icon);
    Intent wifiSettingsIntent = new Intent("android.settings.WIFI_SETTINGS");
    installShortCut.putExtra(Intent.EXTRA_SHORTCUT_INTENT, wifiSettingsIntent);

    sendBroadcast(installShortCut);

    super.onStart(intent, startId);
  }
    @Override
    public void onStart(Intent intent, int startId) {
      // TODO Auto-generated method stub
      super.onStart(intent, startId);
      Log.i(TAG, "intent=" + intent);
      if (intent == null) {
        return;
      }
      int widgetId = intent.getIntExtra("widgetId", -1);
      if (widgetId == -1) {
        return;
      }

      entity = queryEntityById(widgetId);
      if (entity != null) {}
      if (entity == null) {
        return;
      }
      if (mTokenizer == null) {
        mTokenizer = new CalculatorExpressionTokenizer(this);
      }
      if (mSymbols == null) {
        mSymbols = new Symbols();
      }

      Uri data = intent.getData();
      if (data != null) {
        int index = Integer.parseInt(data.getSchemeSpecificPart());
        if (isEvalClick) {
          if (index <= BUTTON_INDEX_9) {
            entity.setFormula("");
          }
          isEvalClick = false;
        }
        checkInput(index);
        if (index == BUTTON_INDEX_EQUAL) return;
      }
      if (entity.getView() != null) {
        int res = evaluate(entity.getFormula());
        entity.getView().setTextViewText(R.id.widget_formula, entity.getFormula());
        if (res == RESULT) {
          entity.getView().setTextViewText(R.id.widget_result, entity.getResult());
        } else {
          entity.getView().setTextViewText(R.id.widget_result, "");
        }
        AppWidgetManager.getInstance(this).updateAppWidget(widgetId, entity.getView());
      }
    }
コード例 #22
0
  @Override
  public void onStart(Intent intent, int startId) {
    // TODO Auto-generated method stub
    super.onStart(intent, startId);

    try {
      if (intent.getExtras() != null) {
        if (intent.getExtras().getBoolean("stopService")) {
          this.stopSelf();
        }
      }
    } catch (Exception e) {
      // TODO Auto-generated catch block
      if (D) e.printStackTrace();
    }
  }
コード例 #23
0
 @Override
 public void onStart(Intent intent, int startId) {
   super.onStart(intent, startId);
   mRunning = true;
   Notification notification =
       new Notification(
           R.drawable.ic_launcher, "BotBrew Supervisor started", System.currentTimeMillis());
   notification.setLatestEventInfo(
       getApplicationContext(),
       "BotBrew Supervisor running",
       "tap to manage",
       PendingIntent.getActivity(this, 0, new Intent(this, SupervisorActivity.class), 0));
   startForeground(ID_RUNNING, notification);
   mSupervisorProcess = new SupervisorProcess(startId);
   mSupervisorThread = new Thread(mSupervisorProcess);
   mSupervisorThread.start();
 }
  @Override
  public void onStart(Intent intent, int startId) {
    // TODO Auto-generated method stub
    super.onStart(intent, startId);

    Log.d("service", "synchronize service call");

    Intent myIntent = new Intent(getApplicationContext(), SynchronizeContactService.class);
    PendingIntent pendingIntent = PendingIntent.getService(getApplicationContext(), 0, myIntent, 0);

    AlarmManager alarmManager = (AlarmManager) getSystemService(ALARM_SERVICE);

    Calendar calendar = Calendar.getInstance();
    calendar.setTimeInMillis(System.currentTimeMillis());
    calendar.add(Calendar.SECOND, 5);
    alarmManager.set(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(), pendingIntent);

    new SyncTask(GlobalConstant.mContext, false).execute();
  }
コード例 #25
0
  public void onStart(Intent intent, int startId) {
    super.onStart(intent, startId);
    Log.d(PluginConstants.LOG_TAG, "Enter LiveViewService.onStart.");

    if (intent.getBooleanExtra(INTENT_EXTRA_ANNOUNCE, false)) {
      Bundle extras = intent.getExtras();
      if (extras != null) {
        try {
          if (mLiveView != null) {
            mLiveView.sendAnnounce(
                mPluginId,
                mMenuIcon,
                extras.getString(INTENT_EXTRA_TITLE),
                extras.getString(INTENT_EXTRA_TEXT),
                System.currentTimeMillis(),
                "");
            Log.d(PluginConstants.LOG_TAG, "Announce sent to LiveView Application");
          } else {
            Log.d(PluginConstants.LOG_TAG, "LiveView Application not reachable");
          }
        } catch (Exception e) {
          Log.e(PluginConstants.LOG_TAG, "Failed to send announce", e);
        }
      }

    } else {
      // We end up here when LiveView Application probes the plugin
      if (isAlreadyRunning()) {
        Log.d(PluginConstants.LOG_TAG, "Already started.");
      } else {
        // Init
        mPluginName =
            PluginUtils.getDynamicResourceString(this, PluginConstants.RESOURCE_STRING_PLUGIN_NAME);

        // Bind to LiveView
        connectToLiveView();

        // Singleton
        alreadyRunning = true;
      }
    }
  }
コード例 #26
0
  @SuppressWarnings("static-access")
  @Override
  public void onStart(Intent intent, int startId) {
    super.onStart(intent, startId);

    if (intent == null) {
      return;
    }

    Bundle reminderData = intent.getExtras();
    if (reminderData == null) {
      Log.i("testing", "Intent extras are null in ReminderService intent");
      return;
    }

    String reminderText = reminderData.getString("text");

    mManager =
        (NotificationManager)
            this.getApplicationContext()
                .getSystemService(this.getApplicationContext().NOTIFICATION_SERVICE);
    // Intent intent1 = new Intent(this.getApplicationContext(),DrugView.class);
    Intent intent1 = new Intent();

    Notification notification =
        new Notification(R.mipmap.ic_launcher, reminderText, System.currentTimeMillis());
    intent1.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_CLEAR_TOP);

    PendingIntent pendingNotificationIntent =
        PendingIntent.getActivity(
            this.getApplicationContext(), 0, intent1, PendingIntent.FLAG_UPDATE_CURRENT);
    notification.flags |= Notification.FLAG_AUTO_CANCEL;
    notification.setLatestEventInfo(
        this.getApplicationContext(), "Drug Log Reminder", reminderText, pendingNotificationIntent);

    mManager.notify(0, notification);
    Log.i("testing", "Reminder notification notified");
  }
コード例 #27
0
  @Override
  public void onStart(Intent intent, int startId) {
    Log.i(APP_TAG, "start!");

    super.onStart(intent, startId);

    waitForGPSCoorinates();

    // fetch widgets to be updated
    int[] widgetIds = intent.getIntArrayExtra(AppWidgetManager.EXTRA_APPWIDGET_IDS);
    if (widgetIds.length > 0) {
      for (int widgetId : widgetIds) {
        if (intent.hasExtra(PreferenceKeys.EXTRA_EMERGENCY)) {
          Log.d(APP_TAG, "intent has extra enableLock");
          if (intent.getBooleanExtra(PreferenceKeys.EXTRA_EMERGENCY, true)) {
            onEmergency();
          }
        } else {
          Log.d(APP_TAG, "intent has no extra enableLock");
        }
      }
    }
  }
コード例 #28
0
ファイル: AlarmService.java プロジェクト: alexBeuth/whatsToDo
  @Override
  public void onStart(Intent intent, int startId) {
    super.onStart(intent, startId);

    Bundle bundle = intent.getExtras();

    TodoListManager.getInstance().load(bundle.getLong("ListId"));
    task = TaskManager.getInstance().load(bundle.getLong("TaskId"));

    if (task.getReminder() != null) {

      Intent nIntent = new Intent(this, TaskActivity.class);
      nIntent.putExtras(bundle);

      PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, nIntent, 0);

      NotificationManager nm = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
      Notification notif =
          new Notification(R.drawable.ic_launcher, "WhatsToDo", System.currentTimeMillis());
      notif.setLatestEventInfo(this, "WhatsToDo", "Erinnerung: " + task.getName(), pendingIntent);
      notif.vibrate = new long[] {100, 250, 100, 500};
      nm.notify((int) task.getId(), notif);
    }
  }
コード例 #29
0
  @Override
  public void onStart(Intent intent, int startId) {
    super.onStart(intent, startId);
    doStart();

    final Uri uri = intent.getData();
    if (uri == null) {
      doStop();
      return;
    }
    intent.setData(null);

    final int notifications = intent.getIntExtra(SHOW_NOTIFICATIONS_KEY, 0);

    final String url = uri.toString();
    final int bookFormat = intent.getIntExtra(BOOK_FORMAT_KEY, BookUrlInfo.Format.NONE);
    UrlInfo.Type referenceType = (UrlInfo.Type) intent.getSerializableExtra(REFERENCE_TYPE_KEY);
    if (referenceType == null) {
      referenceType = UrlInfo.Type.Book;
    }

    String cleanURL = intent.getStringExtra(CLEAN_URL_KEY);
    if (cleanURL == null) {
      cleanURL = url;
    }

    if (myDownloadingURLs.contains(url)) {
      if ((notifications & Notifications.ALREADY_DOWNLOADING) != 0) {
        showMessage("alreadyDownloading");
      }
      doStop();
      return;
    }

    String fileName = BookUrlInfo.makeBookFileName(cleanURL, bookFormat, referenceType);
    if (fileName == null) {
      doStop();
      return;
    }

    int index = fileName.lastIndexOf(File.separator);
    if (index != -1) {
      final String dir = fileName.substring(0, index);
      final File dirFile = new File(dir);
      if (!dirFile.exists() && !dirFile.mkdirs()) {
        showMessage("cannotCreateDirectory", dirFile.getPath());
        doStop();
        return;
      }
      if (!dirFile.exists() || !dirFile.isDirectory()) {
        showMessage("cannotCreateDirectory", dirFile.getPath());
        doStop();
        return;
      }
    }

    final File fileFile = new File(fileName);
    if (fileFile.exists()) {
      if (!fileFile.isFile()) {
        showMessage("cannotCreateFile", fileFile.getPath());
        doStop();
        return;
      }
      // TODO: question box: redownload?
      doStop();
      startActivity(getFBReaderIntent(fileFile));
      return;
    }
    String title = intent.getStringExtra(TITLE_KEY);
    if (title == null || title.length() == 0) {
      title = fileFile.getName();
    }
    if ((notifications & Notifications.DOWNLOADING_STARTED) != 0) {
      showMessage("downloadingStarted");
    }
    final String sslCertificate = intent.getStringExtra(SSL_CERTIFICATE_KEY);
    startFileDownload(url, sslCertificate, fileFile, title);
  }
コード例 #30
0
 @Override
 public void onStart(Intent intent, int startId) {
   super.onStart(intent, startId);
   Log.i("-> REMOTE SERVICE", "onStart()");
 }