Example usage for android.support.v4.content LocalBroadcastManager getInstance

List of usage examples for android.support.v4.content LocalBroadcastManager getInstance

Introduction

In this page you can find the example usage for android.support.v4.content LocalBroadcastManager getInstance.

Prototype

public static LocalBroadcastManager getInstance(Context context) 

Source Link

Usage

From source file:be.ehb.fallwear.MainActivity.java

@Override
protected void onPause() {
    LocalBroadcastManager.getInstance(this).unregisterReceiver(mRegistrationBroadcastReceiver);
    LocalBroadcastManager.getInstance(this).unregisterReceiver(mUnRegisterBroadcastReceiver);
    super.onPause();
}

From source file:com.android.trustagent.test.SampleTrustAgent.java

public static void sendGrantTrust(Context context, String message, long durationMs, boolean initiatedByUser) {
    Intent intent = new Intent(ACTION_GRANT_TRUST);
    intent.putExtra(EXTRA_MESSAGE, message);
    intent.putExtra(EXTRA_DURATION, durationMs);
    intent.putExtra(EXTRA_INITIATED_BY_USER, initiatedByUser);
    LocalBroadcastManager.getInstance(context).sendBroadcast(intent);
}

From source file:activeng.pt.activenglab.BluetoothChatService.java

/**
 * Set the current state of the chat connection
 *
 * @param state An integer defining the current connection state
 *//*from   ww  w.  j  av  a  2  s .  c  om*/
private synchronized void setState(int state) {
    Log.d(TAG, "setState() " + mState + " -> " + state);
    mState = state;

    // Give the new state to the Handler so the UI Activity can update
    // mHandler.obtainMessage(Constants.MESSAGE_STATE_CHANGE, state, -1).sendToTarget();

    Intent intent = new Intent(Constants.MESSAGE_BT_STATE_CHANGE).putExtra(Intent.EXTRA_TEXT, state);
    //mContext.sendBroadcast(intent);
    LocalBroadcastManager manager = LocalBroadcastManager.getInstance(mContext);
    manager.sendBroadcast(intent);
}

From source file:ch.luethi.skylinestracker.PositionService.java

private void sendPositionWaitStatus() {
    LocalBroadcastManager.getInstance(this).sendBroadcast(intentWaitStatus);
}

From source file:android.content.ScopedContextImpl.java

@Override
public Intent registerReceiver(BroadcastReceiver receiver, IntentFilter filter) {
    LocalBroadcastManager.getInstance(SystemConfig.getApplicationContext()).registerReceiver(receiver, filter);
    return null;/*w w w . ja va 2 s  . c  om*/
}

From source file:alaindc.crowdroid.SendIntentService.java

private void handleActionReceivedSubscriptions(String response) {
    // Update view sending a broadcast intent
    Intent intent = new Intent(Constants.INTENTVIEW_RECEIVED_SUBSCRIPTION);
    intent.putExtra(Constants.EXTRAVIEW_RECEIVED_SUBSCRIPTION, response);
    LocalBroadcastManager.getInstance(this).sendBroadcast(intent);
}

From source file:com.android.tv.settings.device.storage.FormatActivity.java

@Override
protected void onDestroy() {
    super.onDestroy();
    LocalBroadcastManager.getInstance(this).unregisterReceiver(mFormatReceiver);
}

From source file:com.android.trustagent.test.SampleTrustAgent.java

public static void sendRevokeTrust(Context context) {
    Intent intent = new Intent(ACTION_REVOKE_TRUST);
    LocalBroadcastManager.getInstance(context).sendBroadcast(intent);
}

From source file:ch.luethi.skylinestracker.PositionService.java

private void sendConnectionStatus() {
    LocalBroadcastManager.getInstance(this).sendBroadcast(intentConStatus);
}

From source file:com.android.managedprovisioning.ProfileOwnerProvisioningActivity.java

@Override
protected void onResume() {
    super.onResume();

    // Setup broadcast receiver for feedback from service.
    mServiceMessageReceiver = new ServiceMessageReceiver();
    IntentFilter filter = new IntentFilter();
    filter.addAction(ProfileOwnerProvisioningService.ACTION_PROVISIONING_SUCCESS);
    filter.addAction(ProfileOwnerProvisioningService.ACTION_PROVISIONING_ERROR);
    filter.addAction(ProfileOwnerProvisioningService.ACTION_PROVISIONING_CANCELLED);
    LocalBroadcastManager.getInstance(this).registerReceiver(mServiceMessageReceiver, filter);

    // Start service async to make sure the UI is loaded first.
    final Handler handler = new Handler(getMainLooper());
    handler.post(new Runnable() {
        @Override/*from ww w  . ja v  a  2s  .  c  om*/
        public void run() {
            Intent intent = new Intent(ProfileOwnerProvisioningActivity.this,
                    ProfileOwnerProvisioningService.class);
            intent.putExtras(getIntent());
            startService(intent);
        }
    });
}