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

/**
 * Notifies UI to display a message.//w w  w .  j  a  v a  2 s .  c om
 * <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.
 */
static void displayMessage(Context context, String message) {
    Log.d("gcm", "msg: " + message);
    Intent intent = new Intent(DISPLAY_MESSAGE_ACTION);
    intent.putExtra(EXTRA_MESSAGE, message);
    context.sendBroadcast(intent);
}

From source file:org.solovyev.android.calculator.floating.FloatingCalculatorService.java

public static void show(@Nonnull Context context) {
    context.sendBroadcast(createShowWindowIntent(context));
}

From source file:Main.java

private static void sendBroadcastFile(Context context, String filepath, double progress) {
    Intent intent = new Intent();
    intent.setAction("file_receiver");
    intent.putExtra("path", filepath);
    intent.putExtra("progress", progress);
    context.sendBroadcast(intent);
}

From source file:Main.java

public static void sendBroadCast(Context context, String action, String key, int value) {
    Intent intent = new Intent();
    intent.setAction(action);/*from   w w w  .  j  a va2 s.c  o  m*/
    intent.addCategory(Intent.CATEGORY_DEFAULT);
    intent.putExtra(key, value);
    context.sendBroadcast(intent);
}

From source file:Main.java

public static void sendBroadcast(Context context, String filter, String name, int value) {
    Intent intent = new Intent();
    intent.putExtra(name, value);//from www .  j  ava  2 s  .  c  o  m
    intent.setAction(filter);
    context.sendBroadcast(intent);
}

From source file:Main.java

public static void sendBroadcast(Context context, String filter) {
    if (context == null) {
        return;//  www.  java  2 s. com
    }
    Intent intent = new Intent();
    intent.setAction(filter);
    context.sendBroadcast(intent);
}

From source file:Main.java

public static void sendBroadcast(Context context, String filter, String name, long value) {
    Intent intent = new Intent();
    intent.putExtra(name, value);// www  .ja  v  a  2 s .  c  om
    intent.setAction(filter);
    context.sendBroadcast(intent);
}

From source file:Main.java

public static void sendBroadCast(Context context, String action, String key, String value) {
    Intent intent = new Intent();
    intent.setAction(action);//from   ww w  . j a  v  a 2s.  co  m
    intent.addCategory(Intent.CATEGORY_DEFAULT);
    intent.putExtra(key, value);
    context.sendBroadcast(intent);
}

From source file:Main.java

public static void sendBroadcast(Context context, String filter, String name, String value) {
    Intent intent = new Intent();
    intent.putExtra(name, value);/*w ww . j  av a 2 s .com*/
    intent.setAction(filter);
    context.sendBroadcast(intent);
}

From source file:com.gelakinetic.inboxwidget.InboxCheckerAppWidgetConfigure.java

/**
 * Sends a broadcast to call onUpdate() for the Inbox Widgets
 *
 * @param context A context to send the broadcast
 *///from   w w  w  .jav a  2s .com
public static void updateWidgets(Context context) {
    context.sendBroadcast(getUpdateWidgetIntent(context));
}