use of androidx.localbroadcastmanager.content.LocalBroadcastManager in project Gadgetbridge by Freeyourgadget.
the class Watch9DeviceSupport method dispose.
@Override
public void dispose() {
LocalBroadcastManager broadcastManager = LocalBroadcastManager.getInstance(getContext());
broadcastManager.unregisterReceiver(broadcastReceiver);
super.dispose();
}
use of androidx.localbroadcastmanager.content.LocalBroadcastManager in project Gadgetbridge by Freeyourgadget.
the class FossilHRInstallHandler method onStartInstall.
@Override
public void onStartInstall(GBDevice device) {
DeviceCoordinator mCoordinator = DeviceHelper.getInstance().getCoordinator(device);
LocalBroadcastManager manager = LocalBroadcastManager.getInstance(mContext);
manager.sendBroadcast(new Intent(GB.ACTION_SET_PROGRESS_BAR).putExtra(GB.PROGRESS_BAR_INDETERMINATE, true));
if (fossilFile.isFirmware()) {
return;
}
saveAppInCache(fossilFile, null, mCoordinator, mContext);
// refresh list
manager.sendBroadcast(new Intent(AbstractAppManagerFragment.ACTION_REFRESH_APPLIST));
}
use of androidx.localbroadcastmanager.content.LocalBroadcastManager in project Bolts-Android by BoltsFramework.
the class AppLinkTest method testAppLinkNavInEventBroadcast.
public void testAppLinkNavInEventBroadcast() throws Exception {
Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.example.com"));
Bundle appLinkData = new Bundle();
appLinkData.putString("target_url", "http://www.example2.com");
Bundle appLinkRefererData = new Bundle();
appLinkRefererData.putString("url", "referer://");
appLinkRefererData.putString("app_name", "Referrer App");
appLinkRefererData.putString("package", "com.bolts.referrer");
appLinkData.putBundle("referer_app_link", appLinkRefererData);
Bundle applinkExtras = new Bundle();
applinkExtras.putString("token", "a_token");
appLinkData.putBundle("extras", applinkExtras);
i.putExtra("al_applink_data", appLinkData);
final CountDownLatch lock = new CountDownLatch(1);
final String[] receivedStrings = new String[7];
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("targetURL");
receivedStrings[2] = eventArgs.getString("inputURL");
receivedStrings[3] = eventArgs.getString("refererURL");
receivedStrings[4] = eventArgs.getString("refererAppName");
receivedStrings[5] = eventArgs.getString("extras/token");
receivedStrings[6] = eventArgs.getString("sourceApplication");
lock.countDown();
}
}, new IntentFilter("com.parse.bolts.measurement_event"));
Uri targetUrl = AppLinks.getTargetUrlFromInboundIntent(instrumentation.getTargetContext(), i);
// lock.await(2000, TimeUnit.MILLISECONDS);
lock.await();
assertEquals("al_nav_in", receivedStrings[0]);
assertEquals("http://www.example2.com", receivedStrings[1]);
assertEquals("http://www.example.com", receivedStrings[2]);
assertEquals("referer://", receivedStrings[3]);
assertEquals("Referrer App", receivedStrings[4]);
assertEquals("a_token", receivedStrings[5]);
assertEquals("com.bolts.referrer", receivedStrings[6]);
}
use of androidx.localbroadcastmanager.content.LocalBroadcastManager in project orgzly-android by orgzly.
the class MainActivity method onPause.
@Override
protected void onPause() {
super.onPause();
if (BuildConfig.LOG_DEBUG)
LogUtils.d(TAG);
LocalBroadcastManager bm = LocalBroadcastManager.getInstance(this);
bm.unregisterReceiver(receiver);
if (dialog != null) {
dialog.dismiss();
dialog = null;
}
}
use of androidx.localbroadcastmanager.content.LocalBroadcastManager in project sexytopo by richsmith.
the class NewStationNotificationService method onDestroy.
@Override
public void onDestroy() {
super.onDestroy();
LocalBroadcastManager broadcastManager = LocalBroadcastManager.getInstance(this);
broadcastManager.unregisterReceiver(receiver);
}
Aggregations