use of androidx.localbroadcastmanager.content.LocalBroadcastManager in project orgzly-android by orgzly.
the class MainActivity method onResumeFragments.
@Override
protected void onResumeFragments() {
super.onResumeFragments();
if (BuildConfig.LOG_DEBUG)
LogUtils.d(TAG);
/* Showing dialog in onResume() fails with:
* Can not perform this action after onSaveInstanceState
*/
if (runnableOnResumeFragments != null) {
runnableOnResumeFragments.run();
runnableOnResumeFragments = null;
}
LocalBroadcastManager bm = LocalBroadcastManager.getInstance(this);
bm.registerReceiver(receiver, new IntentFilter(AppIntent.ACTION_OPEN_NOTE));
bm.registerReceiver(receiver, new IntentFilter(AppIntent.ACTION_FOLLOW_LINK_TO_NOTE_WITH_PROPERTY));
bm.registerReceiver(receiver, new IntentFilter(AppIntent.ACTION_FOLLOW_LINK_TO_FILE));
bm.registerReceiver(receiver, new IntentFilter(AppIntent.ACTION_OPEN_SAVED_SEARCHES));
bm.registerReceiver(receiver, new IntentFilter(AppIntent.ACTION_OPEN_QUERY));
bm.registerReceiver(receiver, new IntentFilter(AppIntent.ACTION_OPEN_BOOKS));
bm.registerReceiver(receiver, new IntentFilter(AppIntent.ACTION_OPEN_BOOK));
bm.registerReceiver(receiver, new IntentFilter(AppIntent.ACTION_OPEN_SETTINGS));
}
use of androidx.localbroadcastmanager.content.LocalBroadcastManager in project orgzly-android by orgzly.
the class Notifications method ensureSyncNotificationSetup.
public static void ensureSyncNotificationSetup(Context context) {
LocalBroadcastManager bm = LocalBroadcastManager.getInstance(context);
bm.unregisterReceiver(syncServiceReceiver);
bm.registerReceiver(syncServiceReceiver, new IntentFilter(AppIntent.ACTION_SYNC_STATUS));
}
use of androidx.localbroadcastmanager.content.LocalBroadcastManager in project quickstart-android by firebase.
the class MainActivity method onStart.
@Override
public void onStart() {
super.onStart();
updateUI(mAuth.getCurrentUser());
// Register receiver for uploads and downloads
LocalBroadcastManager manager = LocalBroadcastManager.getInstance(this);
manager.registerReceiver(mBroadcastReceiver, MyDownloadService.getIntentFilter());
manager.registerReceiver(mBroadcastReceiver, MyUploadService.getIntentFilter());
}
use of androidx.localbroadcastmanager.content.LocalBroadcastManager in project Gadgetbridge by Freeyourgadget.
the class VescDeviceSupport method initBroadcast.
private void initBroadcast() {
LocalBroadcastManager broadcastManager = LocalBroadcastManager.getInstance(getContext());
IntentFilter filter = new IntentFilter();
filter.addAction(COMMAND_SET_RPM);
filter.addAction(COMMAND_SET_CURRENT);
filter.addAction(COMMAND_SET_BREAK_CURRENT);
broadcastManager.registerReceiver(commandReceiver, filter);
}
use of androidx.localbroadcastmanager.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(instrumentation.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(instrumentation.getTargetContext(), "myEventName", i, other);
lock.await(20000, 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]);
}
Aggregations