List of usage examples for android.content Context sendBroadcast
public abstract void sendBroadcast(@RequiresPermission Intent intent);
From source file:Main.java
public static void closeNaviBroadcast_auto(Context context) { Intent intent = new Intent("android.intent.action.VIEW", android.net.Uri.parse("androidauto://mapOpera?sourceApplication=launcher&traffic=1")); intent.setPackage("com.autonavi.amapauto"); context.sendBroadcast(intent); }
From source file:Main.java
public static void galleryAddPic(Context context, String path) { Intent mediaScanIntent = new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE); File f = new File(path); Uri contentUri = Uri.fromFile(f);/*from www .java 2 s . c o m*/ mediaScanIntent.setData(contentUri); context.sendBroadcast(mediaScanIntent); }
From source file:foodcenter.android.AndroidUtils.java
public static void notifySignIn(Context context, String msg) { MsgBroadcastReceiver.progressDismissAndToastMsg(context, msg); Intent intent = new Intent(ACTION_SIGNED_IN); context.sendBroadcast(intent); }
From source file:Main.java
public static void startNavi3D_auto(Context context) { Intent intent = new Intent("android.intent.action.VIEW", android.net.Uri.parse("androidauto://mapOpera?sourceApplication=launcher&switchView=2")); intent.setPackage("com.autonavi.amapauto"); context.sendBroadcast(intent); }
From source file:Main.java
/** * Deletes an image given its Uri.// w ww. j a v a 2s .co m * * @param cameraPicUri * @param context * @return true if it was deleted successfully, false otherwise. */ public static boolean deleteImageWithUriIfExists(Uri cameraPicUri, Context context) { if (cameraPicUri != null) { File fdelete = new File(cameraPicUri.getPath()); if (fdelete.exists()) { if (fdelete.delete()) { context.sendBroadcast(new Intent(Intent.ACTION_MEDIA_MOUNTED, Uri.parse("file://" + Environment.getExternalStorageDirectory()))); return true; } } } return false; }
From source file:Main.java
public static void startNaviNightMode_auto(Context context) { Intent intent = new Intent("android.intent.action.VIEW", android.net.Uri.parse("androidauto://mapOpera?sourceApplication=launcher&switchNightMode=1")); intent.setPackage("com.autonavi.amapauto"); context.sendBroadcast(intent); }
From source file:Main.java
public static void addNewImageToGallery(Context context, String filePath) { Intent mediaScanIntent = new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE); File f = new File(filePath); Uri contentUri = Uri.fromFile(f);/* w ww . j ava 2 s .c o m*/ mediaScanIntent.setData(contentUri); context.sendBroadcast(mediaScanIntent); }
From source file:Main.java
public static void broadcastMessage(Context context, String servername, String message) { Intent intent = new Intent(DISPLAY_MESSAGE_ACTION); intent.putExtra(EXTRA_SERVER_NAME, servername); intent.putExtra(EXTRA_MESSAGE, message); context.sendBroadcast(intent); }
From source file:Main.java
@SuppressWarnings("deprecation") private static void closeBelowApiLevel17(Context context) throws Exception { Settings.System.putInt(context.getContentResolver(), Settings.System.AIRPLANE_MODE_ON, 0); Intent intent = new Intent(Intent.ACTION_AIRPLANE_MODE_CHANGED); intent.putExtra("state", false); context.sendBroadcast(intent); }
From source file:Main.java
public static void sendBroadcast(Context context, String filter, String name, Serializable serializable) { Intent intent = new Intent(); intent.putExtra(name, serializable); intent.setAction(filter);//w w w . j av a2s . c o m context.sendBroadcast(intent); }