use of android.support.v4.content.LocalBroadcastManager in project facebook-android-sdk by facebook.
the class BoltsMeasurementEventListener method close.
private void close() {
LocalBroadcastManager broadcastManager = LocalBroadcastManager.getInstance(applicationContext);
broadcastManager.unregisterReceiver(this);
}
use of android.support.v4.content.LocalBroadcastManager in project facebook-android-sdk by facebook.
the class ProfileManager method getInstance.
static ProfileManager getInstance() {
if (instance == null) {
synchronized (ProfileManager.class) {
if (instance == null) {
Context applicationContext = FacebookSdk.getApplicationContext();
LocalBroadcastManager localBroadcastManager = LocalBroadcastManager.getInstance(applicationContext);
instance = new ProfileManager(localBroadcastManager, new ProfileCache());
}
}
}
return instance;
}
use of android.support.v4.content.LocalBroadcastManager in project easy by MehdiBenmesa.
the class BaseActivity method registerReceiver.
protected void registerReceiver() {
LocalBroadcastManager bManager = LocalBroadcastManager.getInstance(this);
IntentFilter intentFilter = new IntentFilter();
intentFilter.addAction(App.REGISTRATION_PROCESS);
intentFilter.addAction(App.MESSAGE_RECEIVED);
bManager.registerReceiver(broadcastReceiver, intentFilter);
}
use of android.support.v4.content.LocalBroadcastManager in project Bolts-Android by BoltsFramework.
the class AppLinkTest method testGeneralMeasurementEventsBroadcast.
public void testGeneralMeasurementEventsBroadcast() throws Exception {
Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.example.com"));
i.putExtra("foo", "bar");
ArrayList<String> arr = new ArrayList<>();
arr.add("foo2");
arr.add("bar2");
i.putExtra("foobar", arr);
Map<String, String> other = new HashMap<>();
other.put("yetAnotherFoo", "yetAnotherBar");
final CountDownLatch lock = new CountDownLatch(1);
final String[] receivedStrings = new String[5];
LocalBroadcastManager manager = LocalBroadcastManager.getInstance(getInstrumentation().getTargetContext());
manager.registerReceiver(new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
String eventName = intent.getStringExtra("event_name");
Bundle eventArgs = intent.getBundleExtra("event_args");
receivedStrings[0] = eventName;
receivedStrings[1] = eventArgs.getString("foo");
receivedStrings[2] = eventArgs.getString("foobar");
receivedStrings[3] = eventArgs.getString("yetAnotherFoo");
receivedStrings[4] = eventArgs.getString("intentData");
lock.countDown();
}
}, new IntentFilter("com.parse.bolts.measurement_event"));
MeasurementEvent.sendBroadcastEvent(getInstrumentation().getTargetContext(), "myEventName", i, other);
lock.await(2000, TimeUnit.MILLISECONDS);
assertEquals("myEventName", receivedStrings[0]);
assertEquals("bar", receivedStrings[1]);
assertEquals((new JSONArray(arr)).toString(), receivedStrings[2]);
assertEquals("yetAnotherBar", receivedStrings[3]);
assertEquals("http://www.example.com", receivedStrings[4]);
}
use of android.support.v4.content.LocalBroadcastManager in project Gadgetbridge by Freeyourgadget.
the class MiBand2Support method dispose.
@Override
public void dispose() {
LocalBroadcastManager broadcastManager = LocalBroadcastManager.getInstance(getContext());
broadcastManager.unregisterReceiver(mReceiver);
super.dispose();
}
Aggregations