Code example for IBinder

Methods: transact

0
		try { 
			//Send a random number to the service 
			android.os.Parcel data = android.os.Parcel.obtain(); 
			data.writeInt(mRandom.nextInt());
			android.os.Parcel reply = android.os.Parcel.obtain(); 
			service.transact(1, android.os.Parcel.obtain(), reply, 0);
			if (data.readInt() == reply.readInt()) //Check if the service returns us this number
			{ 
				final String _openUDID = reply.readString();
				if (_openUDID != null) { //if valid OpenUDID, save it
					if (LOG) Log.d(TAG, "Received " + _openUDID);
 
					if (mReceivedOpenUDIDs.containsKey(_openUDID)) mReceivedOpenUDIDs.put(_openUDID, mReceivedOpenUDIDs.get(_openUDID) + 1);
					else mReceivedOpenUDIDs.put(_openUDID, 1);
						 
				} 
			} 
		} catch (RemoteException e) {if (LOG) Log.e(TAG, "RemoteException: " + e.getMessage());}		    	    			
		mContext.unbindService(this);
		 
Contextual code suggestions in your IDE  Get Codota for Java