Get the application context

In Android, you can retrieve the android.app.Application instance by using the MobileCore.getApplication() API. The returned android.app.Application represents the base class, which maintains the global application state. For more information, please read the Mobile Core API reference.

Android
Android

Android

getApplication

MobileCore.getApplication may return null if the android.app.Application object was destroyed or if MobileCore.setApplicationwas not previously called.

Syntax

public static Application getApplication()

Example

Application app = MobileCore.getApplication();
if (app != null) {
...
}
Edit on GitHub