Skip to main content
Answered

Initialize Android Mobile SDK

  • 23 July 2024
  • 4 replies
  • 48 views

Hi,

In our product we want to start using the Android Mobile SDK, but for only a set of users. When the app opens we don’t know if the user needs Intercom, we only have that information later in the process.

In the iOS Mobile SDK we used the SDK without any issue but in Android we found a warning: 

Intercom must be initialized inside the application onCreate() method. Initializing anywhere else will result in Intercom not behaving as expected and could even result in the host app crashing.

 

Calling the initialize in the onCreate will add this user to the pricing plan? It’s safe to call this method and later when we are sure that this user has intercom enabled call loginIdentifiedUser?

Intercom.initialize(this, "your api key", "your app id")

Thanks

4 replies

Userlevel 3
Badge +5

Hi, Diogo Alves, It’s Mat from the Support Engineering Team 😀

I’d say it's a feature, not a bug. You can identify the user and then restrict Messenger's visibility in your app if it does not have a sufficient plan.

To answer your question, it will add it to the plan that you’ve specified in your database. Providing that you send this data to Intercom.

Hi, Mat
By calling Intercom.initialize(this, "your api key", "your app id") without calling loginIdentifiedUser and loginUnidentifiedUser it will count for to our pricing plan? 

Thanks

Userlevel 3
Badge +5

Diogo Alves can you elaborate what do you mean by: will count for to our pricing plan? 

 

Hi, Mat

Already got my answer from support thanks
I will leave the answer for future reference

 

Hi Diogo, Jacques here from the Support Engineering Team in Dublin 👋 ☘️ Happy to jump in here and offer some clarity on this!

Initializing Intercom in the onCreate() method of your application class is, in fact, necessary for the proper functioning of the Android Mobile SDK. If you initialize Intercom later in the process, it could cause things to break.

However, initializing Intercom does not automatically add a user to the pricing plan. You can safely call

Intercom.initialize(this, "your api key", "your app id")

in the onCreate() method and then later, when you have determined that a user should have Intercom enabled, you can call loginIdentifiedUser to register the user with Intercom.

Reply