Android ResultReceiver - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Android ResultReceiver class.

This code example shows how to use the following methods:send
	protected void onHandleIntent(Intent intent) {
		final ResultReceiver receiver = intent.getParcelableExtra("receiver");
		String command = intent.getStringExtra("command");
		Bundle bundle = new Bundle();
		if (command.equals("query")) {
			receiver.send(STATUS_RUNNING, Bundle.EMPTY);
			DataSource dataSource = new DataSource(getApplicationContext());
			try { 
				final ISipgateAPI sipgate = new SipgateXmlRpcImpl();
				dataSource.open(false);
 
				queryAccount(sipgate, dataSource);
				receiver.send(STATUS_UPDATED_ACCOUNT, bundle);
 
				queryCalls(sipgate, dataSource);
				receiver.send(STATUS_UPDATED_CALLS, bundle);
			} catch (Exception e) {
				Log.e("QueryService", "Error when updating", e);
 
				if (e instanceof AuthenticationException) {

6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:send
            // TODO Auto-generated catch block 
            e.printStackTrace();
        } 
		 
		final ResultReceiver receiver = intent.getParcelableExtra(EXTRA_STATUS_RECEIVER);
        if (receiver != null) receiver.send(STATUS_RUNNING, Bundle.EMPTY);
         
        params = null; // disable till ...
        String jsonText = new RemoteExecutor().executeCommand(command, params);
        if (jsonText == null || jsonText.equals(""))
        { 
                final Bundle bundle = new Bundle();
            bundle.putString(Intent.EXTRA_TEXT, "No Connection");
            receiver.send(STATUS_ERROR, bundle);
        } 
        else 
        { 
                 Log.d(TAG, "sync finished");
                 final Bundle bundle = new Bundle();
                  

6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:send
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:send
		resultReceiver = (ResultReceiver) intent.getParcelableExtra("com.merybere.app.EXTRA_MYRESULTRECEIVER");
		 
		// Comprobar que nos han pasado el resultReceiver, para evitar null pointer exception 
		if(resultReceiver != null) {
			// Al arrancar, mandar un result code 1 
			resultReceiver.send(1, null);
		} 
		 
		Dummy heavyTask = new Dummy();
		heavyTask.hardWork();
 
		if(resultReceiver != null) {
			resultReceiver.send(0, null);
		} 
	} 
 
	@Override 
	public void onCreate() { 
		Log.d(TAG, "onCreate");
		super.onCreate(); 
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:send
				Log.d(TAG, "LOGOUT_CMD");
				logout(receiver, b);
			} 
		} catch (SocketTimeoutException e) {
			Log.e(TAG, e.getMessage());
			receiver.send(STATUS_CONNECTION_ERROR, b);
		} catch (JSONException e) {
			Log.e(TAG, e.getMessage());
			receiver.send(STATUS_ERROR, b);
		} catch (ClientProtocolException e) {
			Log.e(TAG, e.getMessage());
			receiver.send(STATUS_ERROR, b);
		} catch (IllegalArgumentException e) {
			Log.e(TAG, e.getMessage());
			receiver.send(STATUS_ILLEGAL_ARGUMENT, b);
		} catch (IOException e) {
			Log.e(TAG, e.getMessage());
			receiver.send(STATUS_ERROR, b);
		} catch (Exception e) {
			Log.e(TAG, e.getMessage());

5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:send
				} 
				break; 
				 
			case 400: 
				bundle.putInt("errorCode", ERROR_404); 
				receiver.send(REQUEST_ERROR, bundle);
				break; 
			} 
			 
		} else { 
			bundle.putInt("errorCode", ERROR_NO_CONNECTION);
			receiver.send(REQUEST_ERROR, bundle);
		} 
		 
	}	 
	 
	@Override 
	public void onDestroy() { 
		hp.getConnectionManager().shutdown();
	} 
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:send
		Log.d(TAG, "onHandleIntent");
		 
		resultReceiver = (ResultReceiver) intent.getParcelableExtra("EXTRA_MYRESULTRECEIVER");
		 
		if(resultReceiver != null) {
			resultReceiver.send(1, null);
		} 
		 
		Dummy heavyTask = new Dummy();
		heavyTask.hardWork();
		 
		if(resultReceiver != null) {
			resultReceiver.send(0, null);
		} 
	} 
 
	@Override 
	public void onCreate() { 
		Log.d(TAG, "onCreate");
		super.onCreate(); 
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:send
    public void succeed(HttpRequestJob job, ResultReceiver receiver, Result result, NetHttpSendParams params) {
        showCompletedNotification(job.getNotificationId(), params.getNotification());
 
        Bundle bundle = new Bundle();
        bundle.putParcelable(CallbackReceiver.RESULT, result);
        receiver.send(CallbackReceiver.SUCCESS_CODE, bundle);
    } 
 
    public void fail(HttpRequestJob job, ResultReceiver receiver, int code, String msg) {
        showFailedNotification(job.getNotificationId(), mParams.getNotification());
        receiver.send(code, null);
    } 
 
    private void buildResult(NetHttpSendResult result, HttpResponse response) throws IllegalStateException, IOException {
        result.setCode(response.getStatusLine().getStatusCode() + "");
 
        Header[] headers = response.getAllHeaders();
        Bundle bundle = new Bundle();
        for (Header header : headers)
            bundle.putString(header.getName(), header.getValue());
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:send
	@Override 
	protected void onHandleIntent(Intent intent) {
		Log.d(TAG, "onHandleIntent(intent=" + intent.toString() + ")");
 
		ResultReceiver receiver = intent.getParcelableExtra(EXTRA_STATUS_RECEIVER);
		receiver.send(STATUS_RUNNING, Bundle.EMPTY);
		try { 
			String lineName = intent.getStringExtra("lineName");
			String ud = intent.getStringExtra("ud");
			String sno = intent.getStringExtra("sno");
			String hczd = intent.getStringExtra("hczd");
			 
			// 调用http 
			//String back = ServerUtilities.getGps(lineName,ud,sno,hczd); 
			String[] back = ServerUtilities.getGps(lineName,ud,sno);
		//	Log.d(TAG, back); 
			Bundle b = new Bundle();
			b.putStringArray("response", back);
			receiver.send(STATUS_FINISHED, b);
		} catch (Exception e) {

5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:send
		final Bundle b = new Bundle();
		try { 
			callMethod(url, receiver, b);
		} catch (SocketTimeoutException e) {
			Log.e(TAG, e.getMessage());
			receiver.send(STATUS_CONNECTION_ERROR, b);
		} catch (JSONException e) {
			Log.e(TAG, e.getMessage());
			receiver.send(STATUS_ERROR, b);
		} catch (ClientProtocolException e) {
			Log.e(TAG, e.getMessage());
			receiver.send(STATUS_ERROR, b);
		} catch (IllegalArgumentException e) {
			Log.e(TAG, e.getMessage());
			receiver.send(STATUS_ILLEGAL_ARGUMENT, b);
		} catch (IOException e) {
			Log.e(TAG, e.getMessage());
			receiver.send(STATUS_ERROR, b);
		} 
 

5
CodeRank
Experience pair programming with AI  Get Codota for Java

Related Android ResultReceiver Questions & Answers:

See Code Examples for Android ResultReceiver Methods: