本文整理了Java中android.content.Intent.toString()
方法的一些代码示例,展示了Intent.toString()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Intent.toString()
方法的具体详情如下:
包路径:android.content.Intent
类名称:Intent
方法名:toString
暂无
代码示例来源:origin: oasisfeng/condom
void logIfOutboundPass(final String tag, final Intent intent, final @Nullable String target_pkg, final CondomEvent event) {
if (target_pkg != null && ! mBase.getPackageName().equals(target_pkg))
log(tag, event, target_pkg, intent.toString());
}
代码示例来源:origin: leolin310148/ShortcutBadger
public static void sendIntentExplicitly(Context context, Intent intent) throws ShortcutBadgeException {
List<ResolveInfo> resolveInfos = resolveBroadcast(context, intent);
if (resolveInfos.size() == 0) {
throw new ShortcutBadgeException("unable to resolve intent: " + intent.toString());
}
for (ResolveInfo info : resolveInfos) {
Intent actualIntent = new Intent(intent);
if (info != null) {
actualIntent.setPackage(info.resolvePackageName);
context.sendBroadcast(actualIntent);
}
}
}
代码示例来源:origin: stackoverflow.com
public class NetworkService extends IntentService {
Handler mMainThreadHandler = null;
public NetworkService() {
super(NetworkService.class.getName());
mMainThreadHandler = new Handler();
}
@Override
protected void onHandleIntent(Intent arg) {
System.out.printf("Network service intent handling: %s\n", arg.toString());
mMainThreadHandler.post(new Runnable() {
@Override
public void run() {
Toast.makeText(getApplicationContext(), "BusyBox updated", Toast.LENGTH_LONG).show();
}
});
}
}
代码示例来源:origin: AltBeacon/android-beacon-library
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
LogManager.i(TAG,
intent == null ?
"starting with null intent"
:
"starting with intent " + intent.toString()
);
return super.onStartCommand(intent, flags, startId);
}
代码示例来源:origin: commonsguy/cw-omnibus
@Override
public boolean onControlRequest(Intent i, ControlRequestCallback cb) {
if (i.hasCategory(MediaControlIntent.CATEGORY_REMOTE_PLAYBACK)) {
if (MediaControlIntent.ACTION_PLAY.equals(i.getAction())) {
return(onPlayRequest(i, cb));
}
else if (MediaControlIntent.ACTION_PAUSE.equals(i.getAction())) {
return(onPauseRequest(i, cb));
}
else if (MediaControlIntent.ACTION_RESUME.equals(i.getAction())) {
return(onResumeRequest(i, cb));
}
else if (MediaControlIntent.ACTION_STOP.equals(i.getAction())) {
return(onStopRequest(i, cb));
}
else if (MediaControlIntent.ACTION_GET_STATUS.equals(i.getAction())) {
return(onGetStatusRequest(i, cb));
}
else if (MediaControlIntent.ACTION_SEEK.equals(i.getAction())) {
return(onSeekRequest(i, cb));
}
}
Log.w(getClass().getSimpleName(), "unexpected control request"
+ i.toString());
return(false);
}
代码示例来源:origin: commonsguy/cw-omnibus
@Override
public boolean onControlRequest(Intent i, ControlRequestCallback cb) {
if (i.hasCategory(MediaControlIntent.CATEGORY_REMOTE_PLAYBACK)) {
if (MediaControlIntent.ACTION_PLAY.equals(i.getAction())) {
return(onPlayRequest(i, cb));
}
else if (MediaControlIntent.ACTION_PAUSE.equals(i.getAction())) {
return(onPauseRequest(i, cb));
}
else if (MediaControlIntent.ACTION_RESUME.equals(i.getAction())) {
return(onResumeRequest(i, cb));
}
else if (MediaControlIntent.ACTION_STOP.equals(i.getAction())) {
return(onStopRequest(i, cb));
}
else if (MediaControlIntent.ACTION_GET_STATUS.equals(i.getAction())) {
return(onGetStatusRequest(i, cb));
}
else if (MediaControlIntent.ACTION_SEEK.equals(i.getAction())) {
return(onSeekRequest(i, cb));
}
}
Log.w(getClass().getSimpleName(), "unexpected control request"
+ i.toString());
return(false);
}
代码示例来源:origin: leolin310148/ShortcutBadger
@Override
public void executeBadge(Context context, ComponentName componentName, int badgeCount) throws ShortcutBadgeException {
Intent intent1 = new Intent(INTENT_SET_NOTIFICATION);
boolean intent1Success;
intent1.putExtra(EXTRA_COMPONENT, componentName.flattenToShortString());
intent1.putExtra(EXTRA_COUNT, badgeCount);
Intent intent = new Intent(INTENT_UPDATE_SHORTCUT);
boolean intentSuccess;
intent.putExtra(PACKAGENAME, componentName.getPackageName());
intent.putExtra(COUNT, badgeCount);
try {
BroadcastHelper.sendIntentExplicitly(context, intent1);
intent1Success = true;
} catch (ShortcutBadgeException e) {
intent1Success = false;
}
try {
BroadcastHelper.sendIntentExplicitly(context, intent);
intentSuccess = true;
} catch (ShortcutBadgeException e) {
intentSuccess = false;
}
if (!intent1Success && !intentSuccess) {
throw new ShortcutBadgeException("unable to resolve intent: " + intent.toString());
}
}
代码示例来源:origin: oasisfeng/condom
@Nullable ResolveInfo filterCandidates(final OutboundType type, final Intent original_intent, final @Nullable List<ResolveInfo> candidates,
final String tag, final boolean remove) {
if (candidates == null || candidates.isEmpty()) return null;
final int my_uid = Process.myUid();
BackgroundUidFilter bg_uid_filter = null;
ResolveInfo match = null;
for (final Iterator<ResolveInfo> iterator = candidates.iterator(); iterator.hasNext(); match = null) {
final ResolveInfo candidate = iterator.next();
final ApplicationInfo app_info = candidate.serviceInfo.applicationInfo;
final int uid = app_info.uid;
if (uid == my_uid) match = candidate; // Self UID is always allowed
else if (mOutboundJudge == null || mOutboundJudge.shouldAllow(type, original_intent, app_info.packageName)) {
if (mExcludeBackgroundServices) {
if (bg_uid_filter == null) bg_uid_filter = new BackgroundUidFilter();
if (bg_uid_filter.isUidNotBackground(uid)) match = candidate;
} else match = candidate;
}
if (match == null) log(tag, CondomEvent.FILTER_BG_SERVICE, app_info.packageName, original_intent.toString());
if (mDryRun) return candidate; // Always touch nothing and return the first candidate in dry-run mode.
if (remove) {
if (match == null) iterator.remove();
} else if (match != null) return match;
}
return null;
}
代码示例来源:origin: cSploit/android
/**
* if mContentIntent is null delete our notification,
* else assign it to the notification onClick
*/
private void finishNotification() {
if(mContentIntent==null){
Logger.debug("deleting notifications");
mNotificationManager.cancel(NOTIFICATION_ID);
} else {
Logger.debug("assign '"+mContentIntent.toString()+"'to notification");
mBuilder.setContentIntent(PendingIntent.getActivity(this, CLICK_CODE, mContentIntent, 0))
.setProgress(0,0,false)
.setAutoCancel(true)
.setDeleteIntent(PendingIntent.getActivity(this, 0, new Intent(), 0))
.setChannelId(getBaseContext().getString(R.string.csploitChannelId));
mNotificationManager.notify(NOTIFICATION_ID, mBuilder.build());
}
if(mReceiver!=null)
unregisterReceiver(mReceiver);
mReceiver = null;
mBuilder = null;
mNotificationManager = null;
}
代码示例来源:origin: Justson/AgentWeb
private boolean openFileChooserAboveL(WebView webView, ValueCallback<Uri[]> valueCallbacks, FileChooserParams fileChooserParams) {
LogUtils.i(TAG, "fileChooserParams:" + fileChooserParams.getAcceptTypes() + " getTitle:" + fileChooserParams.getTitle() + " accept:" + Arrays.toString(fileChooserParams.getAcceptTypes()) + " length:" + fileChooserParams.getAcceptTypes().length + " :" + fileChooserParams.isCaptureEnabled() + " " + fileChooserParams.getFilenameHint() + " intent:" + fileChooserParams.createIntent().toString() + " mode:" + fileChooserParams.getMode());
Activity mActivity = this.mActivityWeakReference.get();
if (mActivity == null || mActivity.isFinishing()) {
return false;
}
return AgentWebUtils.showFileChooserCompat(mActivity,
mWebView,
valueCallbacks,
fileChooserParams,
this.mPermissionInterceptor,
null,
null,
null
);
}
代码示例来源:origin: cSploit/android
/**
* if mContentIntent is null delete our notification,
* else assign it to the notification onClick
*/
private void finishNotification() {
boolean errorOccurred;
Intent contentIntent;
errorOccurred = mCurrentTask.errorOccurred;
contentIntent = mCurrentTask.haveIntent() ? mCurrentTask.buildIntent() : null;
if(errorOccurred || contentIntent==null){
Logger.debug("deleting notifications");
if(mNotificationManager!=null)
mNotificationManager.cancel(NOTIFICATION_ID);
} else {
Logger.debug("assign '"+contentIntent.toString()+"' to notification");
if(mBuilder!=null&&mNotificationManager!=null) {
mBuilder.setContentIntent(PendingIntent.getActivity(this, DOWNLOAD_COMPLETE_CODE, contentIntent, 0))
.setChannelId(getBaseContext().getString(R.string.csploitChannelId));
mNotificationManager.notify(NOTIFICATION_ID, mBuilder.build());
}
}
if(mReceiver!=null)
unregisterReceiver(mReceiver);
mReceiver = null;
mBuilder = null;
mNotificationManager = null;
}
代码示例来源:origin: ankidroid/Anki-Android
setContentView(R.layout.progress_bar);
Intent intent = getIntent();
Timber.v(intent.toString());
Intent reloadIntent = new Intent(this, DeckPicker.class);
reloadIntent.setDataAndType(getIntent().getData(), getIntent().getType());
代码示例来源:origin: stackoverflow.com
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
Log.d("Activity result"," "+requestCode+" "+resultCode+" "+data.toString());
Session.getActiveSession().onActivityResult(this, requestCode,
resultCode, data);
}
代码示例来源:origin: oasisfeng/condom
assertEquals("Condom." + TAG, data[1]);
assertEquals(intent.getPackage(), data[2]);
assertEquals(intent.toString(), data[3]);
assertEquals("Condom." + TAG, data[1]);
assertEquals(intent.getPackage(), data[2]);
assertEquals(intent.toString(), data[3]);
assertEquals("Condom." + TAG, data[1]);
assertEquals("bg.service.1", data[2]);
final String expected_intent = new Intent(intent).toString(); // Flags altered
assertEquals(expected_intent, data[3]);
data = (Object[]) events.get(1).getData();
assertEquals("Condom", data[1]);
assertEquals(intent.getComponent().getPackageName(), data[2]);
assertEquals(intent.toString(), data[3]);
assertEquals("Condom", data[1]);
assertEquals(intent.getComponent().getPackageName(), data[2]);
assertEquals(intent.toString(), data[3]);
代码示例来源:origin: Trumeet/MiPushFramework
void logIfOutboundPass(final String tag, final Intent intent, final @Nullable String target_pkg, final CondomEvent event) {
if (target_pkg != null && ! mBase.getPackageName().equals(target_pkg))
log(tag, event, target_pkg, intent.toString());
}
代码示例来源:origin: Trumeet/MiPushFramework
@Nullable ResolveInfo filterCandidates(final OutboundType type, final Intent original_intent, final @Nullable List<ResolveInfo> candidates, final String tag, final boolean remove) {
if (candidates == null || candidates.isEmpty()) return null;
final int my_uid = Process.myUid();
BackgroundUidFilter bg_uid_filter = null;
ResolveInfo match = null;
for (final Iterator<ResolveInfo> iterator = candidates.iterator(); iterator.hasNext(); match = null) {
final ResolveInfo candidate = iterator.next();
final ApplicationInfo app_info = candidate.serviceInfo.applicationInfo;
final int uid = app_info.uid;
if (uid == my_uid) match = candidate; // Self UID is always allowed
else if (mOutboundJudge == null || mOutboundJudge.shouldAllow(type, original_intent, app_info.packageName)) {
if (mExcludeBackgroundServices) {
if (bg_uid_filter == null) bg_uid_filter = new BackgroundUidFilter();
if (bg_uid_filter.isUidNotBackground(uid)) match = candidate;
} else match = candidate;
}
if (match == null) log(tag, CondomEvent.FILTER_BG_SERVICE, app_info.packageName, original_intent.toString());
if (mDryRun) return candidate; // Always touch nothing and return the first candidate in dry-run mode.
if (remove) {
if (match == null) iterator.remove();
} else if (match != null) return match;
}
return null;
}
代码示例来源:origin: limpoxe/Android-Plugin-Framework
LogUtil.v("未匹配到插件Intent, 说明目标不是插件,也可能是插件未正确安装", packageName, intent.toString());
} else {
LogUtil.v(packageName, "插件Intent匹配成功");
代码示例来源:origin: limpoxe/Android-Plugin-Framework
String orignalIntent = intent.toString();
throw new ClassNotFoundException("className : " + className + ", intent : " + intent.toString(), new Throwable());
", currentCl : " + cl.toString() +
", currentClassName : " + className +
", currentIntent : " + intent.toString() +
", process : " + ProcessUtil.isPluginProcess() +
", isStubActivity : " + PluginManagerProviderClient.isStub(orginalClassName) +
代码示例来源:origin: Trumeet/MiPushFramework
assertEquals("Condom." + TAG, data[1]);
assertEquals(intent.getPackage(), data[2]);
assertEquals(intent.toString(), data[3]);
assertEquals("Condom." + TAG, data[1]);
assertEquals(intent.getPackage(), data[2]);
assertEquals(intent.toString(), data[3]);
assertEquals("Condom." + TAG, data[1]);
assertEquals("bg.service.1", data[2]);
final String expected_intent = new Intent(intent).toString(); // Flags altered
assertEquals(expected_intent, data[3]);
data = (Object[]) events.get(1).getData();
assertEquals("Condom", data[1]);
assertEquals(intent.getComponent().getPackageName(), data[2]);
assertEquals(intent.toString(), data[3]);
assertEquals("Condom", data[1]);
assertEquals(intent.getComponent().getPackageName(), data[2]);
assertEquals(intent.toString(), data[3]);
代码示例来源:origin: linkedin/test-butler
@Override
public boolean activityStarting(Intent intent, String pkg) throws RemoteException {
Log.v(TAG, "activityStarting: " + pkg + " " + intent.toString());
// allow all activities to start
return true;
}
内容来源于网络,如有侵权,请联系作者删除!