Top

Android SDK 2.2.1 IRainbowContact.photo is always null

Commentaires

3 commentaires

  • Commentaire officiel
    Jordan HIERTZ

    Hi,

    Since version 2.1.0, we no longer automatically download the contact photo for two reasons:

    • to minimise the impact of a cold start
    • to let the developer choose his caching strategy

    Currently, there are two ways to retrieve the contact photo:

    • You can use the method 
    RainbowSdk.instance().contacts().getAvatarUrl(IRainbowContact, int)

    with this url you can download and save the file or use any library like Glide, Picasso etc to display the photo.

    • You can try and use our rainbow avatar library to display a photo of an IRainbowContact in a simple way.
    // Add dependency

    implementation "com.ale.rainbowx:rainbowavatar:0.2.7"

    // Use the AvatarCardView

    <com.ale.rainbowx.rainbowavatar.AvatarCardView
    android:id="@+id/avatar"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    app:avatarDimension="small"/>

    // Display the contact avatar in the AvatarCardView

    findViewById(R.id.avatar).displayContact(IRainbowContact)

    The library will try to display an avatar if it exists on the server side. Or display the initials of that contact if there is none.

    If you only need to display the photos, I encourage you to use the rainbow avatar library as this is its purpose.

    Jordan.

    Actions pour les commentaires Permalien
  • Hiro TAKAHASHI

    The issue did NOT occur when I downgraded the SDK version to 1.72.0 for test purpose.
    I did not try upgrade the SDK as some of fields/methods I'm using have been deleted/replaced.

    0
    Actions pour les commentaires Permalien
  • Hiro TAKAHASHI

    Hello Jordan, thank you for your prompt comment. I will try using the avatar library.

    Thanks,

     

    Hiro

    0
    Actions pour les commentaires Permalien

Vous devez vous connecter pour laisser un commentaire.

  • Demandez à la Communauté

    Vous avez besoin d'aide? Posez vos questions à la Communauté et obtenez des réponses d'autres utilisateurs Rainbow.

    Poster un message