use of androidx.localbroadcastmanager.content.LocalBroadcastManager in project sexytopo by richsmith.
the class GraphActivity method unregisterReceivers.
private void unregisterReceivers() {
LocalBroadcastManager broadcastManager = LocalBroadcastManager.getInstance(this);
broadcastManager.unregisterReceiver(updatedReceiver);
broadcastManager.unregisterReceiver(createdReceiver);
}
use of androidx.localbroadcastmanager.content.LocalBroadcastManager in project sexytopo by richsmith.
the class TableActivity method onPause.
@Override
protected void onPause() {
super.onPause();
LocalBroadcastManager broadcastManager = LocalBroadcastManager.getInstance(this);
broadcastManager.unregisterReceiver(receiver);
}
use of androidx.localbroadcastmanager.content.LocalBroadcastManager in project sexytopo by richsmith.
the class NewStationNotificationService method onStartCommand.
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
BroadcastReceiver receiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
update();
}
};
try {
LocalBroadcastManager broadcastManager = LocalBroadcastManager.getInstance(this);
broadcastManager.registerReceiver(receiver, new IntentFilter(SexyTopo.NEW_STATION_CREATED_EVENT));
} catch (Exception exception) {
FirebaseCrashlytics crashlytics = FirebaseCrashlytics.getInstance();
crashlytics.recordException(exception);
Log.e(exception);
}
return START_REDELIVER_INTENT;
}
use of androidx.localbroadcastmanager.content.LocalBroadcastManager in project sexytopo by richsmith.
the class CalibrationActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_calibration);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
BroadcastReceiver updatedCalibrationReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
syncWithReadings();
}
};
LocalBroadcastManager broadcastManager = LocalBroadcastManager.getInstance(this);
broadcastManager.registerReceiver(updatedCalibrationReceiver, new IntentFilter(SexyTopo.CALIBRATION_UPDATED_EVENT));
}
use of androidx.localbroadcastmanager.content.LocalBroadcastManager in project sexytopo by richsmith.
the class DeviceActivity method onPause.
@Override
protected void onPause() {
super.onPause();
try {
unregisterReceiver(stateChangeReceiver);
unregisterReceiver(scanReceiver);
LocalBroadcastManager broadcastManager = LocalBroadcastManager.getInstance(this);
broadcastManager.unregisterReceiver(logUpdateReceiver);
} catch (Exception exception) {
// this shouldn't ever happen
Log.e("Error unregistering receiver: " + exception.getMessage());
}
}
Aggregations