How to Implement "extends Application"?

Rajni Tandon :

I have build an android application, for certain reasons I have to integrate my application with a additional SDK (for the purpose of Install Tracking) for which I have to implement below kind of class which uses "extends Application". And this kind of file I have not implemented earlier, and my application is working fine.

I am using firebase as my backend. How to implement the below kind of class in the code of android? I am using Java in android. I have created the file, libraries are also implemented.

public class MyApp extends Application {

    @Override
    public void onCreate() {
        super.onCreate();
       //code for SDK Integration

    }
}
jeprubio :

You have to create the class extending Application as you did and then you should set it on the manifest as the application name:

<application
        android:name="com.whatever.MyApp"

More info in the description of Application class here:

https://developer.android.com/reference/android/app/Application

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=217202&siteId=1