Subscribing to Mesibo Profile Update

Subscribing to a Profile

You can subscribe to a user's profile so your app can be notified when that profile is changed.

When you first call getProfile() for a user, if their profile doesn't exist locally, your app will automatically be subscribed to receive updates for that profile. You can also manually subscribe or unsubscribe anytime:

profile.subscribe(false); 

Once subscribed to a profile, your app will be notified of any updates through listeners. There are two types of listeners that you can implement:

  • Global Profile Listener - This listener handles updates for all subscribed profiles.
  • Per Profile Listener - This listener is specific to individual profiles.

Global Profile Listener

The global listener is called for all profiles you are subscribed to.

You implement it like:

void Mesibo_onProfileUpdated(MesiboProfile profile){
    // profile updated
}

You can then add the listener to your Mesibo instance as follows:

Mesibo.addListener(listener);

Per Profile Listener

You can also set up listeners for specific profiles.

You implement it like:

void MesiboProfile_onUpdate(MesiboProfile profile){
  // This profile has been updated
}

And set it on the profile:

profile.addListener(profileListener);

Now this listener will be called only when this particular profile is updated.

By implementing these listeners, your app gets notified in real-time when profiles are changed. The global listener catches all updates. Per-profile listeners target specific profiles.

This allows you to instantly reflect profile changes in your app, like showing an updated profile photo. The listeners provide real-time updates.