Top

Android SDK 2.2.1 IRainbowContact.photo is always null

Comments

3 comments

  • Official comment
    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.

    Comment actions Permalink
  • 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
    Comment actions Permalink
  • Hiro TAKAHASHI

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

    Thanks,

     

    Hiro

    0
    Comment actions Permalink

Please sign in to leave a comment.

Still can't find what you need?

  • Contact Us

    Do you have any question about Rainbow? Leave us a message to get more information.

    Contact
  • Ask the Community

    Do you need help? Ask your questions to the Community and get answers from other Rainbow users.

    Post message