本文整理汇总了Java中android.os.Bundle.putBinder方法的典型用法代码示例。如果您正苦于以下问题:Java Bundle.putBinder方法的具体用法?Java Bundle.putBinder怎么用?Java Bundle.putBinder使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.os.Bundle
的用法示例。
在下文中一共展示了Bundle.putBinder方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: sendCommand
import android.os.Bundle; //导入方法依赖的package包/类
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);
}
示例2: sendServerCommand
import android.os.Bundle; //导入方法依赖的package包/类
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);
}
示例3: attachToActivityManagerService
import android.os.Bundle; //导入方法依赖的package包/类
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);
}
示例4: writeRemoter
import android.os.Bundle; //导入方法依赖的package包/类
/**
* 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);
}
}
示例5: putBinder
import android.os.Bundle; //导入方法依赖的package包/类
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) {
}
}
}
示例6: putBinder
import android.os.Bundle; //导入方法依赖的package包/类
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);
}
}
示例7: putBinder
import android.os.Bundle; //导入方法依赖的package包/类
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);
}
}
示例8: putBinder
import android.os.Bundle; //导入方法依赖的package包/类
public static void putBinder(Bundle bundle, String key, IBinder binder) {
bundle.putBinder(key, binder);
}
示例9: send
import android.os.Bundle; //导入方法依赖的package包/类
@Override
public Bundle send(Bundle bundle) {
bundle.putBinder(ServiceContext.EXTRA_CALLBACK, new IBinderCallback(mCallback));
return mBundleSender.send(bundle);
}