Example usage for android.content Context sendBroadcast

List of usage examples for android.content Context sendBroadcast

Introduction

In this page you can find the example usage for android.content Context sendBroadcast.

Prototype

public abstract void sendBroadcast(@RequiresPermission Intent intent);

Source Link

Document

Broadcast the given intent to all interested BroadcastReceivers.

Usage

From source file:Main.java

public static void allScan(Context context) {
    context.sendBroadcast(new Intent(Intent.ACTION_MEDIA_MOUNTED,
            Uri.parse("file://" + Environment.getExternalStorageDirectory())));
}

From source file:Main.java

public static void sendViolation2(Context cxt, Intent intent) {
    cxt.sendBroadcast(intent); // lint violation
}

From source file:Main.java

public static void fileScan(Context context, String s) {
    context.sendBroadcast(new Intent("android.intent.action.MEDIA_SCANNER_SCAN_FILE",
            Uri.parse((new StringBuilder()).append("file://").append(s).toString())));
}

From source file:Main.java

public static void sendBroadcast(Context context, String action) {
    context.sendBroadcast(new Intent(action));
}

From source file:Main.java

public static void sendBroadCastReceiver(Context context, Intent intent) {
    context.sendBroadcast(intent);
}

From source file:Main.java

/**
 * Send overall broadcast/*from w  w  w.j  a v a  2  s. c  o  m*/
 *
 * @param i Intent which contains action
 */
public static void sendOverall(Context context, Intent i) {
    context.sendBroadcast(i);
}

From source file:Main.java

/**
 * Broadcast an intent to notify of a new picture in the Gallery
 * @param context/* w  ww  .  ja  va  2 s.  c  o  m*/
 * @param uri
 */
private static void broadcastNewPicture(Context context, Uri uri) {
    context.sendBroadcast(new Intent("android.hardware.action.NEW_PICTURE", uri));
    // Keep compatibility
    context.sendBroadcast(new Intent("com.android.camera.NEW_PICTURE", uri));
}

From source file:Main.java

/**
 * Fires the broadcast intent that connects to Scrobble Droid.
 *//*from w ww  .j a v a 2  s .  com*/
public static void sendBroadcast(Context mContext) {
    mContext.sendBroadcast(mScrobbleDroidIntent);
}

From source file:Main.java

/**
 * /* ww  w .j  a  v a  2s. c  o m*/
 * @param context
 */
public static void notifyScanMediaFiles(Context context) {
    context.sendBroadcast(new Intent(Intent.ACTION_MEDIA_MOUNTED,
            Uri.parse("file://" + Environment.getExternalStorageDirectory())));
}

From source file:Main.java

/**
 * Sends an Intent, notifying CallerInfo cache should be updated.
 *
 * Note: CallerInfo is *not* part of public API, and no guarantee is available around its
 * specific behavior. In practice this will only be used by Phone package, but may change
 * in the future.//w ww.  j ava  2 s.  c o m
 *
 * See also CallerInfoCache in Phone package for more information.
 */
public static void sendUpdateCallerInfoCacheIntent(Context context) {
    context.sendBroadcast(new Intent(UPDATE_CALLER_INFO_CACHE));
}