當前位置: 首頁>>代碼示例>>Java>>正文


Java Process.THREAD_PRIORITY_BACKGROUND屬性代碼示例

本文整理匯總了Java中android.os.Process.THREAD_PRIORITY_BACKGROUND屬性的典型用法代碼示例。如果您正苦於以下問題:Java Process.THREAD_PRIORITY_BACKGROUND屬性的具體用法?Java Process.THREAD_PRIORITY_BACKGROUND怎麽用?Java Process.THREAD_PRIORITY_BACKGROUND使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在android.os.Process的用法示例。


在下文中一共展示了Process.THREAD_PRIORITY_BACKGROUND屬性的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onCreate

@Override
public void onCreate() {
    if (DBG) Log.d(TAG, "onCreate");
    sIsScannerAlive = true;
    notifyListeners();
    UpnpServiceManager.getSingleton(this).lockStop();
    /*
         during all scan process, we need to keep UpnpService on, otherwise listing will fail.
         To avoid blinking, we keep it on in the networkscanner instead of the lister
     */
    // setup handler
    mHandlerThread = new HandlerThread("ScanWorker", Process.THREAD_PRIORITY_BACKGROUND);
    mHandlerThread.start();
    Looper looper = mHandlerThread.getLooper();
    mHandler = new Handler(looper, this);

    mBlacklist = Blacklist.getInstance(this);
}
 
開發者ID:archos-sa,項目名稱:aos-MediaLib,代碼行數:18,代碼來源:NetworkScannerServiceVideo.java

示例2: onCreate

@Override
public void onCreate() {
    // Start up the thread running the service.  Note that we create a
    // separate thread because the service normally runs in the process's
    // main thread, which we don't want to block.  We also make it
    // background priority so CPU-intensive work will not disrupt our UI.
    HandlerThread thread = new HandlerThread("ServiceStartArguments",
            Process.THREAD_PRIORITY_BACKGROUND);
    thread.start();

    mNotificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
    mNotificationMap = new SparseIntArray();

    // Get the HandlerThread's Looper and use it for our Handler
    mServiceLooper = thread.getLooper();
    //mServiceHandler = new ServiceHandler(mServiceLooper);
    mServiceHandler = new ServiceHandler(mServiceLooper, this);
    setPrefs(PreferenceManager.getDefaultSharedPreferences(this));
}
 
開發者ID:SalmanTKhan,項目名稱:MyAnimeViewer,代碼行數:19,代碼來源:ManualAnimeUpdaterService.java

示例3: onCreate

@Override
public void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    final Bundle args = getArguments();
    final byte[] txHash = (byte[]) args.getSerializable(KEY_TRANSACTION);
    transaction = checkNotNull(wallet.getTransaction(Sha256Hash.wrap(txHash)));

    backgroundThread = new HandlerThread("backgroundThread", Process.THREAD_PRIORITY_BACKGROUND);
    backgroundThread.start();
    backgroundHandler = new Handler(backgroundThread.getLooper());

    loaderManager.initLoader(ID_DYNAMIC_FEES_LOADER, null, dynamicFeesLoaderCallbacks);
}
 
開發者ID:guodroid,項目名稱:okwallet,代碼行數:14,代碼來源:RaiseFeeDialogFragment.java

示例4: onCreate

/**
 * Initializes the content provider when it is created.
 */
@Override
public boolean onCreate() {

    HandlerThread handlerThread =
            new HandlerThread("DownloadProvider handler", Process.THREAD_PRIORITY_BACKGROUND);
    handlerThread.start();
    mHandler = new Handler(handlerThread.getLooper());

    mOpenHelper = new DatabaseHelper(getContext());
    // Initialize the system uid
    mSystemUid = Process.SYSTEM_UID;
    // Initialize the default container uid. Package name hardcoded
    // for now.
    ApplicationInfo appInfo = null;
    try {
        appInfo = getContext().getPackageManager().
                getApplicationInfo("com.android.defcontainer", 0);
    } catch (NameNotFoundException e) {
        Log.wtf(Constants.TAG, "Could not get ApplicationInfo for com.android.defconatiner", e);
    }
    if (appInfo != null) {
        mDefContainerUid = appInfo.uid;
    }
    // start the DownloadService class. don't wait for the 1st download to be issued.
    // saves us by getting some initialization code in DownloadService out of the way.
    Context context = getContext();
    context.startService(new Intent(context, DownloadService.class));
    return true;
}
 
開發者ID:redleaf2002,項目名稱:downloadmanager,代碼行數:32,代碼來源:DownloadProvider.java

示例5: onCreate

@Override
public void onCreate() {
    super.onCreate();
    Utils.debugLog(TAG, "Creating downloader service.");

    HandlerThread thread = new HandlerThread(TAG, Process.THREAD_PRIORITY_BACKGROUND);
    thread.start();

    serviceLooper = thread.getLooper();
    serviceHandler = new ServiceHandler(serviceLooper);
    localBroadcastManager = LocalBroadcastManager.getInstance(this);
}
 
開發者ID:uhuru-mobile,項目名稱:mobile-store,代碼行數:12,代碼來源:DownloaderService.java

示例6: starts

private void starts(){
    stops();
    workThread = new HandlerThread(
            GlobalAsyncThread.class.getSimpleName(),
            Process.THREAD_PRIORITY_BACKGROUND);
    workThread.start();
    workHandler  = new Handler(workThread.getLooper());
}
 
開發者ID:wuyisheng,項目名稱:libRtmp,代碼行數:8,代碼來源:GlobalAsyncThread.java

示例7: onCreate

@Override
public void onCreate() {
    HandlerThread thread = new HandlerThread(
            "ServiceStartArguments",
            Process.THREAD_PRIORITY_BACKGROUND);
    thread.start();

    serviceLooper = thread.getLooper();
    serviceHandler = createServiceHandler(serviceLooper, this);
}
 
開發者ID:kranthi0987,項目名稱:easyfilemanager,代碼行數:10,代碼來源:NetworkServerService.java

示例8: onCreate

@Override
public void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    if (!Constants.ENABLE_SWEEP_WALLET)
        throw new IllegalStateException("ENABLE_SWEEP_WALLET is disabled");

    setRetainInstance(true);
    setHasOptionsMenu(true);

    backgroundThread = new HandlerThread("backgroundThread", Process.THREAD_PRIORITY_BACKGROUND);
    backgroundThread.start();
    backgroundHandler = new Handler(backgroundThread.getLooper());

    if (savedInstanceState != null) {
        restoreInstanceState(savedInstanceState);
    } else {
        final Intent intent = activity.getIntent();

        if (intent.hasExtra(SweepWalletActivity.INTENT_EXTRA_KEY)) {
            privateKeyToSweep = (VersionedChecksummedBytes) intent
                    .getSerializableExtra(SweepWalletActivity.INTENT_EXTRA_KEY);

            // delay until fragment is resumed
            handler.post(maybeDecodeKeyRunnable);
        }
    }
}
 
開發者ID:guodroid,項目名稱:okwallet,代碼行數:28,代碼來源:SweepWalletFragment.java

示例9: onCreate

@Override
public void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setRetainInstance(true);
    setHasOptionsMenu(true);

    bluetoothAdapter = BluetoothAdapter.getDefaultAdapter();

    backgroundThread = new HandlerThread("backgroundThread", Process.THREAD_PRIORITY_BACKGROUND);
    backgroundThread.start();
    backgroundHandler = new Handler(backgroundThread.getLooper());

    if (savedInstanceState != null) {
        restoreInstanceState(savedInstanceState);
    } else {
        final Intent intent = activity.getIntent();
        final String action = intent.getAction();
        final Uri intentUri = intent.getData();
        final String scheme = intentUri != null ? intentUri.getScheme() : null;
        final String mimeType = intent.getType();

        if ((Intent.ACTION_VIEW.equals(action) || NfcAdapter.ACTION_NDEF_DISCOVERED.equals(action))
                && intentUri != null && "bitcoin".equals(scheme)) {
            initStateFromBitcoinUri(intentUri);
        } else if ((NfcAdapter.ACTION_NDEF_DISCOVERED.equals(action))
                && PaymentProtocol.MIMETYPE_PAYMENTREQUEST.equals(mimeType)) {
            final NdefMessage ndefMessage = (NdefMessage) intent
                    .getParcelableArrayExtra(NfcAdapter.EXTRA_NDEF_MESSAGES)[0];
            final byte[] ndefMessagePayload = Nfc.extractMimePayload(PaymentProtocol.MIMETYPE_PAYMENTREQUEST,
                    ndefMessage);
            initStateFromPaymentRequest(mimeType, ndefMessagePayload);
        } else if ((Intent.ACTION_VIEW.equals(action))
                && PaymentProtocol.MIMETYPE_PAYMENTREQUEST.equals(mimeType)) {
            final byte[] paymentRequest = BitcoinIntegration.paymentRequestFromIntent(intent);

            if (intentUri != null)
                initStateFromIntentUri(mimeType, intentUri);
            else if (paymentRequest != null)
                initStateFromPaymentRequest(mimeType, paymentRequest);
            else
                throw new IllegalArgumentException();
        } else if (intent.hasExtra(SendCoinsActivity.INTENT_EXTRA_PAYMENT_INTENT)) {
            initStateFromIntentExtras(intent.getExtras());
        } else {
            updateStateFrom(PaymentIntent.blank());
        }
    }
}
 
開發者ID:guodroid,項目名稱:okwallet,代碼行數:49,代碼來源:SendCoinsFragment.java

示例10: newThread

public Thread newThread(Runnable r) {
    Thread t = new Thread(group, r,
            namePrefix + threadNumber.getAndIncrement(),
            0);
    if (t.isDaemon())
        t.setDaemon(false);
    if (t.getPriority() != Process.THREAD_PRIORITY_BACKGROUND)
        t.setPriority(Process.THREAD_PRIORITY_BACKGROUND);
    return t;
}
 
開發者ID:jessie345,項目名稱:RetrofitAppArchitecture,代碼行數:10,代碼來源:RequestExecutor.java

示例11: onCreate

@Override
public void onCreate() {
    // We are using a HandlerThread and a Looper to avoid loading and closing
    // concurrency
    MoneroHandlerThread thread = new MoneroHandlerThread("WalletService",
            Process.THREAD_PRIORITY_BACKGROUND);
    thread.start();

    // Get the HandlerThread's Looper and use it for our Handler
    final Looper serviceLooper = thread.getLooper();
    mServiceHandler = new WalletService.ServiceHandler(serviceLooper);

    Timber.d("Service created");
}
 
開發者ID:m2049r,項目名稱:xmrwallet,代碼行數:14,代碼來源:WalletService.java

示例12: onCreate

@Override
public void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    backgroundThread = new HandlerThread("backgroundThread", Process.THREAD_PRIORITY_BACKGROUND);
    backgroundThread.start();
    backgroundHandler = new Handler(backgroundThread.getLooper());
}
 
開發者ID:guodroid,項目名稱:okwallet,代碼行數:8,代碼來源:MaintenanceDialogFragment.java

示例13: DefaultExecutorSupplier

public DefaultExecutorSupplier() {
    ThreadFactory backgroundPriorityThreadFactory = new PriorityThreadFactory(Process.THREAD_PRIORITY_BACKGROUND);
    mNetworkExecutor = new ANExecutor(DEFAULT_MAX_NUM_THREADS, backgroundPriorityThreadFactory);
    mImmediateNetworkExecutor = new ANExecutor(2, backgroundPriorityThreadFactory);
    mMainThreadExecutor = new MainThreadExecutor();
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:6,代碼來源:DefaultExecutorSupplier.java

示例14: createDbHandler

private static HandlerThread createDbHandler() {
    final HandlerThread handlerThread = new HandlerThread("RealmReadThread", Process.THREAD_PRIORITY_BACKGROUND);
    handlerThread.start();
    return handlerThread;
}
 
開發者ID:Popalay,項目名稱:RxRealm,代碼行數:5,代碼來源:RxRealm.java

示例15: BackgroundScheduledThreadPoolExecutor

public BackgroundScheduledThreadPoolExecutor() {
    super(1, new PriorityThreadFactory(TAG, Process.THREAD_PRIORITY_BACKGROUND));
    setMaximumPoolSize(1);
    setKeepAliveTime(10 * 1000L, TimeUnit.MILLISECONDS);
    allowCoreThreadTimeOut(true);
}
 
開發者ID:miLLlulei,項目名稱:Accessibility,代碼行數:6,代碼來源:BackgroundExecutors.java


注:本文中的android.os.Process.THREAD_PRIORITY_BACKGROUND屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。