当前位置: 首页>>代码示例>>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;未经允许,请勿转载。