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


Java ResultReceiver.send方法代碼示例

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


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

示例1: onHandleIntent

import android.os.ResultReceiver; //導入方法依賴的package包/類
@Override
protected void onHandleIntent(final Intent intent) {


    int phase = intent.getIntExtra(INTENT_REQUESTED_PHASE, 0) & 0x03;
    resultReceiver = (ResultReceiver) intent.getParcelableExtra(INTENT_RESULT_RECEIVER);
    delayForInitDeviceFirmware = intent.getLongExtra(EXTRA_WAIT_FOR_INIT_DEVICE_FIRMWARE, 0);

    int rc = 0;

    logi("DFUBaseService onHandleIntent phase = " + phase);
    mServicePhase = 0;

    if ((phase & FLASHING_WITH_PAIR_CODE) != 0) {
        mServicePhase = FLASHING_WITH_PAIR_CODE;

        rc = flashingWithPairCode(intent);
    }

    if (resultReceiver != null) {
        rc <<= 8;
        resultReceiver.send(rc | phase, null);
    }
}
 
開發者ID:Samsung,項目名稱:microbit,代碼行數:25,代碼來源:DfuBaseService.java

示例2: onStartCommand

import android.os.ResultReceiver; //導入方法依賴的package包/類
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
    if (intent != null && intent.getAction() != null) {
        if (intent.getAction().equals(ACTION_RECORDING_START)) {
            if (intent.hasExtra(EXTRA_SAMPLING_RATE)) {
                mSamplingRate = intent.getIntExtra(EXTRA_SAMPLING_RATE, DEFAULT_SAMPLING_RATE);
            }
            startRecording();
            return START_STICKY;
        } else if (intent.getAction().equals(ACTION_RECORDING_STOP)) {
            stopRecording();
            return START_STICKY;
        } else if (intent.getAction().equals(ACTION_RECORDING_GET_STATUS)) {
            ResultReceiver receiver = intent.getParcelableExtra("receiver");
            Bundle data = new Bundle();
            data.putInt(EXTRA_RECORDING_STATUS, mRecordingStatus);
            receiver.send(0, data);
            return START_STICKY;
        }
    }

    stopSelf();
    return START_NOT_STICKY;
}
 
開發者ID:WrBug,項目名稱:GravityBox,代碼行數:25,代碼來源:RecordingService.java

示例3: maybeProcessStartIntent

import android.os.ResultReceiver; //導入方法依賴的package包/類
private void maybeProcessStartIntent() {
    if (mStartIntent == null || mTorchStatus == TORCH_STATUS_UNKNOWN) return;

    if (ACTION_TOGGLE_TORCH.equals(mStartIntent.getAction())) {
        if (DEBUG) Log.d(TAG, "maybeProcessStartIntent: ACTION_TOGGLE_TORCH");
        toggleTorch();
    } else if (ACTION_TORCH_GET_STATUS.equals(mStartIntent.getAction())) {
        if (DEBUG) Log.d(TAG, "maybeProcessStartIntent: " +
                "ACTION_TORCH_GET_STATUS: mTorchStatus=" + mTorchStatus);
        ResultReceiver receiver = mStartIntent.getParcelableExtra("receiver");
        Bundle data = new Bundle();
        data.putInt(EXTRA_TORCH_STATUS, mTorchStatus);
        receiver.send(0, data);
    }
    mStartIntent = null;
}
 
開發者ID:WrBug,項目名稱:GravityBox,代碼行數:17,代碼來源:TorchService.java

示例4: sendNfcState

import android.os.ResultReceiver; //導入方法依賴的package包/類
private static void sendNfcState(ResultReceiver receiver) {
    if (mContext == null || receiver == null) return;
    int nfcState = NFC_STATE_UNKNOWN;
    try {
        NfcAdapter adapter = NfcAdapter.getDefaultAdapter(mContext);
        if (adapter != null) {
            nfcState = (Integer) XposedHelpers.callMethod(adapter, "getAdapterState");
        }
    } catch (Throwable t) {
        XposedBridge.log(t);
    } finally {
        Bundle b = new Bundle();
        b.putInt("nfcState", nfcState);
        receiver.send(0, b);
    }
}
 
開發者ID:WrBug,項目名稱:GravityBox,代碼行數:17,代碼來源:ConnectivityServiceWrapper.java

示例5: checkOverlayDrawingCapability

import android.os.ResultReceiver; //導入方法依賴的package包/類
/**
 * オーバーレイ表示のパーミッションを確認します.
 *
 * @param context コンテキスト
 * @param handler ハンドラー
 * @param resultReceiver 確認を受けるレシーバ
 */
@TargetApi(23)
private static void checkOverlayDrawingCapability(final Context context, final Handler handler, final ResultReceiver resultReceiver) {
    if (Settings.canDrawOverlays(context)) {
        resultReceiver.send(Activity.RESULT_OK, null);
    } else {
        Intent intent = new Intent(Settings.ACTION_MANAGE_OVERLAY_PERMISSION,
                Uri.parse("package:" + context.getPackageName()));
        IntentHandlerActivity.startActivityForResult(context, intent, new ResultReceiver(handler) {
            @Override
            protected void onReceiveResult(int resultCode, Bundle resultData) {
                if (Settings.canDrawOverlays(context)) {
                    resultReceiver.send(Activity.RESULT_OK, null);
                } else {
                    resultReceiver.send(Activity.RESULT_CANCELED, null);
                }
            }
        });
    }
}
 
開發者ID:DeviceConnect,項目名稱:DeviceConnect-Android,代碼行數:27,代碼來源:CapabilityUtil.java

示例6: onActivityResult

import android.os.ResultReceiver; //導入方法依賴的package包/類
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    if (requestCode == REQUEST_CODE) {
        Intent callingIntent = getIntent();
        if (callingIntent == null || callingIntent.getExtras() == null || !callingIntent.hasExtra(EXTRA_CALLBACK)) {
            finish();
            return;
        }

        Bundle extras = callingIntent.getExtras();
        ResultReceiver callback = extras.getParcelable(EXTRA_CALLBACK);
        if (callback == null) {
            finish();
            return;
        }

        Bundle dataBundle = new Bundle();
        dataBundle.putParcelable(EXTRA_INTENT_DATA, data);
        callback.send(resultCode, dataBundle);
        finish();
    }
}
 
開發者ID:DeviceConnect,項目名稱:DeviceConnect-Android,代碼行數:23,代碼來源:IntentHandlerActivity.java

示例7: onRequestPermissionsResult

import android.os.ResultReceiver; //導入方法依賴的package包/類
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions,
        @NonNull int[] grantResults) {
    Intent callingIntent = getIntent();
    if (callingIntent == null || callingIntent.getExtras() == null || !callingIntent.hasExtra(EXTRA_CALLBACK)) {
        finish();
        return;
    }

    Bundle extras = callingIntent.getExtras();
    ResultReceiver callback = extras.getParcelable(EXTRA_CALLBACK);
    if (callback == null) {
        finish();
        return;
    }

    Bundle resultData = new Bundle();
    resultData.putStringArray(EXTRA_PERMISSIONS, permissions);
    resultData.putIntArray(EXTRA_GRANT_RESULTS, grantResults);
    callback.send(Activity.RESULT_OK, resultData);
    finish();
}
 
開發者ID:DeviceConnect,項目名稱:DeviceConnect-Android,代碼行數:23,代碼來源:PermissionRequestActivity.java

示例8: test

import android.os.ResultReceiver; //導入方法依賴的package包/類
private void test(final int resultCode, final Intent data) {
    Intent callingIntent = getIntent();
    if (callingIntent == null) {
        return;
    }

    Bundle extras = callingIntent.getExtras();
    if (extras == null) {
        return;
    }

    ResultReceiver callback = extras.getParcelable(EXTRA_CALLBACK);
    if (callback == null) {
        return;
    }

    callback.send(resultCode, null);

}
 
開發者ID:DeviceConnect,項目名稱:DeviceConnect-Android,代碼行數:20,代碼來源:BleEnableActivity.java

示例9: onResponse

import android.os.ResultReceiver; //導入方法依賴的package包/類
@Override
public void onResponse(JSONObject response) {
    switch (mType) {
        case Api.TYPE_LATEST:
            Api.parseLatestTopics(response);
            break;
        case Api.TYPE_CATEGORIES:
            Api.parseCategories(response);
            break;

    }
    ResultReceiver rr = mCallbacks.get(mType);
    if (rr != null) {
        rr.send(Activity.RESULT_OK, null);
        mCallbacks.delete(mType);
    }
}
 
開發者ID:goodev,項目名稱:android-discourse,代碼行數:18,代碼來源:JsonObjectListener.java

示例10: startConfigDownloading

import android.os.ResultReceiver; //導入方法依賴的package包/類
private boolean startConfigDownloading(ResultReceiver receiver, String userid) throws IOException {
    displayNotification("MAST", getResources().getString(R.string.DownloadingConfig),
            getResources().getString(R.string.Downloading));
    if(downloadConfiguration(userid) && downloadMBtiles()){
        updateNotification("MAST", getResources().getString(R.string.ConfigDownloadSuccessful),
                getResources().getString(R.string.DownloadFinished));
        if(receiver != null)
            receiver.send(STATUS_FINISHED, Bundle.EMPTY);
        return true;
    } else {
        updateNotification("MAST", getResources().getString(R.string.ConfigDonwloadFailed),
                getResources().getString(R.string.DownloadError));
        if(receiver != null)
            receiver.send(STATUS_ERROR, Bundle.EMPTY);
        return false;
    }
}
 
開發者ID:MASTUSAID,項目名稱:MAST-MOBILE,代碼行數:18,代碼來源:DownloadService.java

示例11: onHandleIntent

import android.os.ResultReceiver; //導入方法依賴的package包/類
@Override
protected void onHandleIntent(Intent intent) {
    int error = FetchPositionsFile();
    ResultReceiver receiver = intent.getParcelableExtra("EXTRA_RECEIVER");
    routeID = intent.getStringExtra("EXTRA_ROUTE_ID");
    Bundle resultData = new Bundle();
    if (error == 0){
        resultData.putBoolean("Errors", false);
        ParseLocations();
    }
    else {
        resultData.putBoolean("Errors", true);
    }
    resultData.putIntegerArrayList("LatitudeList", latitudeList);
    resultData.putIntegerArrayList("LongitudeList", longitudeList);
    receiver.send(error,resultData);
    System.out.println("Sent Results");
}
 
開發者ID:matt662,項目名稱:GetThere,代碼行數:19,代碼來源:RefreshPositionsService.java

示例12: startDataDownloading

import android.os.ResultReceiver; //導入方法依賴的package包/類
private void startDataDownloading(ResultReceiver receiver, String userid) throws IOException {
    // First check for config being downloaded
    DbController db = DbController.getInstance(getApplicationContext());
    if (db.getClaimTypes(false).size() < 1) {
        if(!startConfigDownloading(null, userid)){
            receiver.send(STATUS_ERROR, Bundle.EMPTY);
            return;
        }
    }

    displayNotification("MAST", getResources().getString(R.string.DownloadingData),
            getResources().getString(R.string.Downloading));
    if(downloadProperties(userid)){
        updateNotification("MAST", getResources().getString(R.string.DataDownloadSuccessful),
                getResources().getString(R.string.DownloadFinished));
        receiver.send(STATUS_FINISHED, Bundle.EMPTY);
    } else {
        updateNotification("MAST", getResources().getString(R.string.DataDownloadFailed),
                getResources().getString(R.string.DownloadError));
        receiver.send(STATUS_ERROR, Bundle.EMPTY);
    }
}
 
開發者ID:MASTUSAID,項目名稱:MAST-MOBILE,代碼行數:23,代碼來源:DownloadService.java

示例13: handleIsInCallQuery

import android.os.ResultReceiver; //導入方法依賴的package包/類
private void handleIsInCallQuery(Intent intent) {
  ResultReceiver resultReceiver = intent.getParcelableExtra(EXTRA_RESULT_RECEIVER);

  if (resultReceiver != null) {
    resultReceiver.send(callState != CallState.STATE_IDLE ? 1 : 0, null);
  }
}
 
開發者ID:XecureIT,項目名稱:PeSanKita-android,代碼行數:8,代碼來源:WebRtcCallService.java

示例14: onHandleIntent

import android.os.ResultReceiver; //導入方法依賴的package包/類
@Override
protected void onHandleIntent(@Nullable Intent intent) {

    if(!PreferenceHelper.isSynced(getApplicationContext())) {

        final ResultReceiver receiver = intent.getParcelableExtra("receiver");
        Bundle bundle = new Bundle();

        String urlPart = "http://hproroute.hpcl.co.in/StateDistrictMap_4/fetchmshsdprice.jsp?param=T&statecode=";
        long time = System.currentTimeMillis();
        List<State> stateList = DatabaseHelper.getStates(getApplicationContext(), true);
        mFuelPriceList = new ArrayList<>();

        for (int i = 0; i < stateList.size(); i++) {
            State state = stateList.get(i);
            String result = "State : " + state.getName();
            fullUrl = urlPart + state.getCode() + "?" + time;
            try {
                result += downloadData(fullUrl);
                bundle.putString("result", result);
                receiver.send(STATUS_FINISHED, bundle);

            } catch (Exception e) {
                bundle.putString(Intent.EXTRA_TEXT, e.toString());
                receiver.send(STATUS_ERROR, bundle);
            }

        }

        DatabaseHelper.updateFuelPrice(getApplicationContext(), mFuelPriceList);
        PreferenceHelper.setCurrentDataDownloadDate(getApplicationContext());
        receiver.send(STATUS_FINISHED, bundle);
        Log.d(TAG, "service stopping");
    }
}
 
開發者ID:andy1729,項目名稱:FuelFriend,代碼行數:36,代碼來源:DownloadService.java

示例15: handleStopRecordingCommand

import android.os.ResultReceiver; //導入方法依賴的package包/類
private void handleStopRecordingCommand(Intent intent) {
    ResultReceiver resultReceiver = null;
    if(intent != null)
        resultReceiver = intent.getParcelableExtra(RESULT_RECEIVER);

    if (!mRecording) {
        // have not recorded
        if (resultReceiver != null)
            resultReceiver.send(RECORD_RESULT_NOT_RECORDING, null);
        return;
    }

    try {
        mMediaRecorder.stop();
        mMediaRecorder.release();
    } catch (RuntimeException e) {
        mMediaRecorder.reset();
        if (resultReceiver != null)
            resultReceiver.send(RECORD_RESULT_UNSTOPPABLE, new Bundle());
        return;
    } finally {
        mMediaRecorder = null;
        mCamera.stopPreview();
        mCamera.release();

        mRecording = false;
        SharedPreferenceHelper.getInstance().saveIsRecording(mRecording);
    }

    Bundle b = new Bundle();
    b.putString(VIDEO_PATH, mRecordingPath);
    if (resultReceiver != null)
        resultReceiver.send(RECORD_RESULT_OK, b);

    Log.d(TAG, "recording is finished.");
}
 
開發者ID:imjaspreet,項目名稱:Camera-Background-Servce,代碼行數:37,代碼來源:CameraService.java


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