use of android.support.v4.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 android.support.v4.content.LocalBroadcastManager in project facebook-android-sdk by facebook.
the class BoltsMeasurementEventListener method open.
private void open() {
LocalBroadcastManager broadcastManager = LocalBroadcastManager.getInstance(applicationContext);
broadcastManager.registerReceiver(this, new IntentFilter(MEASUREMENT_EVENT_NOTIFICATION_NAME));
}
use of android.support.v4.content.LocalBroadcastManager in project facebook-android-sdk by facebook.
the class LikeView method associateWithLikeActionController.
private void associateWithLikeActionController(LikeActionController likeActionController) {
this.likeActionController = likeActionController;
this.broadcastReceiver = new LikeControllerBroadcastReceiver();
LocalBroadcastManager localBroadcastManager = LocalBroadcastManager.getInstance(getContext());
// add the broadcast receiver
IntentFilter filter = new IntentFilter();
filter.addAction(LikeActionController.ACTION_LIKE_ACTION_CONTROLLER_UPDATED);
filter.addAction(LikeActionController.ACTION_LIKE_ACTION_CONTROLLER_DID_ERROR);
filter.addAction(LikeActionController.ACTION_LIKE_ACTION_CONTROLLER_DID_RESET);
localBroadcastManager.registerReceiver(broadcastReceiver, filter);
}
use of android.support.v4.content.LocalBroadcastManager in project facebook-android-sdk by facebook.
the class ProfileManagerTest method testLoadCurrentProfileWithCache.
@Test
public void testLoadCurrentProfileWithCache() {
ProfileCache profileCache = mock(ProfileCache.class);
Profile profile = ProfileTest.createDefaultProfile();
when(profileCache.load()).thenReturn(profile);
LocalBroadcastManager localBroadcastManager = mock(LocalBroadcastManager.class);
ProfileManager profileManager = new ProfileManager(localBroadcastManager, profileCache);
assertTrue(profileManager.loadCurrentProfile());
verify(profileCache, times(1)).load();
// Verify that we don't save it back
verify(profileCache, never()).save(any(Profile.class));
// Verify that we broadcast
verify(localBroadcastManager).sendBroadcast(any(Intent.class));
// Verify that if we set the same (semantically) profile there is no additional broadcast.
profileManager.setCurrentProfile(ProfileTest.createDefaultProfile());
verify(localBroadcastManager, times(1)).sendBroadcast(any(Intent.class));
// Verify that if we unset the profile there is a broadcast
profileManager.setCurrentProfile(null);
verify(localBroadcastManager, times(2)).sendBroadcast(any(Intent.class));
}
use of android.support.v4.content.LocalBroadcastManager in project facebook-android-sdk by facebook.
the class AccessTokenManager method getInstance.
static AccessTokenManager getInstance() {
if (instance == null) {
synchronized (AccessTokenManager.class) {
if (instance == null) {
Context applicationContext = FacebookSdk.getApplicationContext();
LocalBroadcastManager localBroadcastManager = LocalBroadcastManager.getInstance(applicationContext);
AccessTokenCache accessTokenCache = new AccessTokenCache();
instance = new AccessTokenManager(localBroadcastManager, accessTokenCache);
}
}
}
return instance;
}
Aggregations