What is the use of Backendless.initApp in Android?

Hello Team,

I just wanted to know what to know what is the use of Backendless.initApp for Android?

If I do the Backendless.initApp once, then will I be able to call Backendless.Persistence.of(.Class).findfirst() in an IntentService even long after I have closed the app or will I have to do a Backendless.initApp in the service too?

Thanks in advance.
Puneet

initApp must be called in the context of a “process” which uses Backendless APIs. If the service runs separately from the app (and it does), then yes, you need to call it there too.

Thanks for the quick reply Mark. I think the service runs in the same process(unless specified in the manifest) as the app but in a different thread. So in case i do an initApp twice, i think it will crash.

no, calling initApp twice does not cause any crashes.

Ohk. I guess I will try it out then. :slight_smile:

Thanks for the help Mark.

can I call initapp in all activity starting ?

Hi Harriesh,

As Mark said, calling initApp twice (or multiple times) does not cause any crashes. So yes, you can call it in all activity starting.