List of utility methods to do Intent Set
boolean | initIntentFilterFromXml(IntentFilter inf, XmlPullParser xpp) init Intent Filter From Xml try { int outerDepth = xpp.getDepth(); int type; final String NAME = "name"; while ((type = xpp.next()) != XmlPullParser.END_DOCUMENT && (type != XmlPullParser.END_TAG || xpp.getDepth() > outerDepth)) { if (type == XmlPullParser.END_TAG || type == XmlPullParser.TEXT) ... |
void | pushNotification(Context context, int notId, PendingIntent pIntent, int iconRID, String title, String summary, boolean autoCancel, boolean vibrate, boolean light, boolean sound) Build and push notification to notification center NotificationManager mNotificationManager = (NotificationManager) context .getSystemService(Context.NOTIFICATION_SERVICE); NotificationCompat.Builder mBuilder = new NotificationCompat.Builder( context).setContentTitle(title).setContentText(summary); if (iconRID != -1) mBuilder.setSmallIcon(iconRID); mBuilder.setContentIntent(pIntent); mBuilder.setAutoCancel(autoCancel); ... |
Intent | updateIntentExplicitness(Context context, Intent implicitIntent) update Intent Explicitness if (VERSION.SDK_INT >= VERSION_CODES.LOLLIPOP) { PackageManager pm = context.getPackageManager(); List<ResolveInfo> resolveInfo = pm.queryIntentServices( implicitIntent, 0); if (resolveInfo == null) { return null; ResolveInfo serviceInfo = resolveInfo.get(0); ... |
Intent | getAppStartIntent(Context context) get App Start Intent try { PackageManager manager = context.getPackageManager(); Intent intent = manager.getLaunchIntentForPackage(PACKAGE_NAME); intent.addCategory(Intent.CATEGORY_LAUNCHER); return intent; } catch (Exception e) { return null; |
void | dumpBundleKeys(Intent intent) dump Bundle Keys if (intent == null) { Log.d(TAG, "intent is null"); return; dumpBundleKeys(intent.getExtras()); |
void | setBlankContentIntent(Context context, NotificationCompat.Builder builder) set Blank Content Intent Intent intent = new Intent(""); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK); PendingIntent contentIntent = PendingIntent.getActivity(context, 0, intent, 0); builder.setContentIntent(contentIntent); |
void | setNewTaskFlag(@Nonnull Intent intent) Adds the flags Intent#FLAG_ACTIVITY_NEW_TASK and if possible Intent#FLAG_ACTIVITY_CLEAR_TASK (only available from API 11) to the passed intent. if (isMinimumSdkLevel(11)) {
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
Intent | createCallIntent(String phoneNumber) create Call Intent Intent call = new Intent(Intent.ACTION_CALL); call.setData(Uri.parse("tel:" + phoneNumber)); call.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); return call; |
SmsMessage[] | extractSMSmessages(Intent intent) extract SM Smessages Object[] pdus = (Object[]) intent.getExtras().get("pdus"); SmsMessage[] msgs = new SmsMessage[pdus.length]; for (int i = 0; i < pdus.length; i++) { msgs[i] = SmsMessage.createFromPdu((byte[]) pdus[i]); return msgs; |
void | registerReceiver(Context c, BroadcastReceiver receiver, IntentFilter f, boolean local) register Receiver String hashString = receiver.toString(); if (!isRegistered(receiver)) { try { if (local) LocalBroadcastManager.getInstance(c).registerReceiver( receiver, f); else c.registerReceiver(receiver, f); ... |