Java Code Examples for android.os.Bundle.putBinder()

The following are Jave code examples for showing how to use putBinder() of the android.os.Bundle class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: DroidIPC   File: RemoteCommandSender.java   View Source Code Vote up 6 votes
public static void sendCommand(Context context,ResolveInfo resolveInfo,int cmd) {
	
	ServiceInfo serviceInfo = resolveInfo.serviceInfo;
	String sender = serviceInfo.packageName;
	Intent intent = new Intent();
	intent.setAction(serviceInfo.packageName+"._SERVICE_");
	intent.setPackage(sender);
	Bundle binderBunder = new Bundle();
	binderBunder.putBinder(ServiceContext.EXTRA_BUNDLE_BINDER, ServiceManagerThread.getDefault());
	binderBunder.putString(ServiceContext.EXTRA_BUNDLE_PACKAGE_NAME, sender);
	
	intent.putExtra(ServiceContext.EXTRA_BUNDLE, binderBunder);
	intent.putExtra(ServiceContext.EXTRA_COMMAND, cmd);
	
	LogControler.print(Level.INFO, "[RemoteCommandSender] "+sender+" sendCommand start service pkg name = "+serviceInfo.packageName+", class name = " + serviceInfo.name);
	
	ComponentName componentName = context.startService(intent);
	
	LogControler.print(Level.INFO, "[RemoteCommandSender] "+sender+" sendCommand start service result = " + componentName);
}
 
Example 2
Project: DroidIPC   File: RemoteCommandSender.java   View Source Code Vote up 6 votes
public static void sendServerCommand(Context context,int cmd,IBinder callback){
	Intent intent = new Intent();
	intent.setAction(ServiceContext.ACTION_REMOTE_CLIENT_COMMAND);
	intent.setPackage(ServiceContext.SERVER_PACKAGE_NAME);
	
	String sender = context.getPackageName();
	
	Bundle binderBunder = new Bundle();
	binderBunder.putBinder(ServiceContext.EXTRA_BUNDLE_SERVER_READY_BINDER, callback);
	binderBunder.putString(ServiceContext.EXTRA_BUNDLE_PACKAGE_NAME, sender);
	
	intent.putExtra(ServiceContext.EXTRA_BUNDLE, binderBunder);
	intent.putExtra(ServiceContext.EXTRA_COMMAND, cmd);
	
	ComponentName componentName = context.startService(intent);
	
	LogControler.print(Level.INFO, "[RemoteCommandSender] "+sender+" sendServerCommand start service result = " + componentName);
}
 
Example 3
Project: DroidIPC   File: ServiceManagerThread.java   View Source Code Vote up 6 votes
private static void attachToActivityManagerService(Context context) {
	
	LogControler.print(Level.INFO, "[ServerManagerThread] attach To ActivityManagerService");
	
	Intent intent = new Intent(ServiceContext.ACTION_RECEIVE_SERVICE_MANAGER);
	Bundle binderBunder = new Bundle();
	binderBunder.putBinder(ServiceContext.EXTRA_BUNDLE_BINDER, ServiceManagerThread.getDefault());
	intent.putExtra(ServiceContext.EXTRA_BUNDLE, binderBunder);
	intent.putExtra(ServiceContext.EXTRA_COMMAND, ServiceContext.CMD_CREATE_CLIENT_SERVICE_MANAGER);
	context.sendStickyBroadcast(intent);
}
 
Example 4
Project: RxRemote   File: RemoteEventController.java   View Source Code Vote up 5 votes
/**
 * Writes the @Remoter data
 */
private void writeRemoter(Object data, Bundle bundle, String keyPrefix) throws Exception {
    Class remoterInterfaceClass = getRemoterBinder(data);
    if (remoterInterfaceClass != null) {
        Class remoterStubClass = Class.forName(remoterInterfaceClass.getName() + "_Stub");
        Constructor constructor = remoterStubClass.getConstructor(remoterInterfaceClass);
        IBinder binder = (IBinder) constructor.newInstance(data);
        bundle.putString(RemoteEventManager.REMOTE_DATA_EXTRA + keyPrefix, remoterInterfaceClass.getName());
        bundle.putBinder(RemoteEventManager.REMOTE_DATA_KEY + keyPrefix, binder);
    }
}
 
Example 5
Project: VirtualAPK   File: PluginUtil.java   View Source Code Vote up 5 votes
public static void putBinder(Bundle bundle, String key, IBinder value) {
    if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
        bundle.putBinder(key, value);
    } else {
        try {
            ReflectUtil.invoke(Bundle.class, bundle, "putIBinder", new Class[]{String.class, IBinder.class}, key, value);
        } catch (Exception e) {
        }
    }
}
 
Example 6
Project: VirtualHook   File: BundleCompat.java   View Source Code Vote up 5 votes
public static void putBinder(Bundle bundle, String key, IBinder value) {
	if (Build.VERSION.SDK_INT >= 18) {
		bundle.putBinder(key, value);
	} else {
		mirror.android.os.Bundle.putIBinder.call(bundle, key, value);
	}
}
 
Example 7
Project: TPlayer   File: BundleCompat.java   View Source Code Vote up 5 votes
public static void putBinder(Bundle bundle, String key, IBinder value) {
    if (Build.VERSION.SDK_INT >= 18) {
        bundle.putBinder(key, value);
    } else {
        mirror.android.os.Bundle.putIBinder.call(bundle, key, value);
    }
}
 
Example 8
Project: container   File: BundleCompat.java   View Source Code Vote up 5 votes
public static void putBinder(Bundle bundle, String key, IBinder value) {
	if (Build.VERSION.SDK_INT >= 18) {
		bundle.putBinder(key, value);
	} else {
		mirror.android.os.Bundle.putIBinder.call(bundle, key, value);
	}
}
 
Example 9
Project: boohee_v5.6   File: BundleCompatJellybeanMR2.java   View Source Code Vote up 4 votes
public static void putBinder(Bundle bundle, String key, IBinder binder) {
    bundle.putBinder(key, binder);
}
 
Example 10
Project: DroidIPC   File: BundleSendDecorator.java   View Source Code Vote up 3 votes
@Override
public Bundle send(Bundle bundle) {
	
	bundle.putBinder(ServiceContext.EXTRA_CALLBACK, new IBinderCallback(mCallback));
	
	return mBundleSender.send(bundle);
}