We recommend using a global Application class to initialize our SDK. If you don't have an Application class for your project, follow these steps:
- Create a class that extends
Application
.
import android.app.Application class MainApplication : Application() { override fun onCreate() { super.onCreate() // initialize Rudder SDK here } }
import android.app.Application;public class MainApplication extends Application { @Override public void onCreate() { super.onCreate(); // initialize Rudder SDK here }}
- Open
AndroidManifest.xml
file of your app and locate<application>
tag. - Add an attribute
android:name
and set it to your new application class.
<application android:name=".MainApplication" <!-- ... --></application>
Contact us
For more information on the topics covered on this page, email us or start a conversation in our Slack community.