List of usage examples for android.content Context sendBroadcast
public abstract void sendBroadcast(@RequiresPermission Intent intent);
From source file:Main.java
public static void broadcastNewPicture(Context context, Uri uri) { context.sendBroadcast(new Intent(android.hardware.Camera.ACTION_NEW_PICTURE, uri)); // Keep compatibility context.sendBroadcast(new Intent("com.android.camera.NEW_PICTURE", uri)); }
From source file:Main.java
/** * Send a broadcast to external receivers. *///from w ww .j av a 2s .c om public static void sendToExternal(@NonNull Context cxt, @NonNull Intent intent) { cxt.sendBroadcast(intent); }
From source file:Main.java
public static void sendBroadcast(Context context, Intent intent) { context.sendBroadcast(intent); }
From source file:Main.java
/** * Notifies UI to display a message.//w w w. ja va2 s . com * <p/> * This method is defined in the common helper because it's used both by * the UI and the background service. * * @param context application's context. * @param message message to be displayed. */ public static void displayMessage(Context context, String message) { context.sendBroadcast(new Intent(DISPLAY_MESSAGE_ACTION).putExtra(EXTRA_MESSAGE, message)); }
From source file:Main.java
public static void send(Context context, Intent intent, Object obj) { object = obj; context.sendBroadcast(intent); }
From source file:Main.java
public static void sendBroadcast(Context context, String action) { Intent mIntent = new Intent(action); context.sendBroadcast(mIntent); }
From source file:Main.java
/** * Forces the Android gallery to refresh its thumbnail images. * @param context//from w w w . j av a 2 s .co m * @param fdelete */ private static void refreshGalleryImages(Context context, File fdelete) { try { context.sendBroadcast(new Intent(Intent.ACTION_MEDIA_MOUNTED, Uri.parse("file://" + Environment.getExternalStorageDirectory()))); } catch (Exception e1) { try { Intent mediaScanIntent = new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE); Uri contentUri = Uri.fromFile(fdelete); mediaScanIntent.setData(contentUri); context.sendBroadcast(mediaScanIntent); } catch (Exception e2) { } } }
From source file:Main.java
public static void notifyScanFile(Context context, String fileName) { Uri data = Uri.parse("file://" + fileName); context.sendBroadcast(new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE, data)); }
From source file:Main.java
public static void send(Context context, Intent intent, Bundle bundle) { intent.putExtras(bundle); context.sendBroadcast(intent); }
From source file:Main.java
public static void allScan(Context context) { if (null == context) { return;// ww w.j a v a 2 s. c o m } context.sendBroadcast(new Intent(Intent.ACTION_MEDIA_MOUNTED, Uri.parse("file://" + android.os.Environment.getExternalStorageDirectory()))); }