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.
{% tabs %} {% tab title="Android" %}
{% hint style="warning" %}
MobileCore.getApplication
may return null
if the android.app.Application
object was destroyed or if MobileCore.setApplication
was not previously called.
{% endhint %}
public static Application getApplication()
Application app = MobileCore.getApplication();
if (app != null) {
...
}
{% endtab %} {% endtabs %}