Step 1. Requirements
- A OneSignal Account.
- Your OneSignal App ID, available in Settings > Keys & IDs.
- Android Studio
- An Android 4.0.3+ device or emulator with "Google Play Store (Services)" installed.
- A Google/Firebase Server API Key
- Project is using AndroidX. See Google's AndroidX migration guide to update from the Android Support Library if you are still using this.
Step 2. Add OneSignal Gradle Plugin and SDK
2.1 Open your root build.gradle (Project: name) file, add the following.
- Under
buildscript>repositoriesadd (before jcenter)mavenCentral()gradlePluginPortal()
- Under
buildscript>dependenciesaddclasspath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:[0.12.10, 0.99.99]'
- Under
allprojects>repositoriesadd (before jcenter)mavenCentral()
buildscript {
repositories {
google()
mavenCentral()
gradlePluginPortal()
jcenter()
}
dependencies {
classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:[0.12.10, 0.99.99]'
}
}
allprojects {
repositories {
google()
mavenCentral()
jcenter()
}
}

2.2 Open your App build.gradle (Module: app) file, add the following under buildscript {...} and above 'com.android.application'.
plugins {
id 'com.onesignal.androidsdk.onesignal-gradle-plugin'
// Other plugins here if pre-existing
}
2.3 Add the following to your dependencies section.
dependencies {
implementation 'com.onesignal:OneSignal:[4.0.0, 4.99.99]'
}

Sync Gradle
Make sure to press "Sync Now" on the banner that pops up after saving!
Step 3. Add Required Code
3.1 Add the following to the onCreate method in your Application class.
If you don't have an Application class follow our Create Application Class Guide.
Note: The ONESIGNAL_APP_ID can be found in the dashboard Settings > Keys & IDs
import com.onesignal.OneSignal;
public class MainApplication extends Application {
private static final String ONESIGNAL_APP_ID = "########-####-####-####-############";
@Override
public void onCreate() {
super.onCreate();
// Enable verbose OneSignal logging to debug issues if needed.
OneSignal.setLogLevel(OneSignal.LOG_LEVEL.VERBOSE, OneSignal.LOG_LEVEL.NONE);
// OneSignal Initialization
OneSignal.initWithContext(this);
OneSignal.setAppId(ONESIGNAL_APP_ID);
}
}
import com.onesignal.OneSignal
const val ONESIGNAL_APP_ID = "########-####-####-####-############"
class MainApplication : Application() {
override fun onCreate() {
super.onCreate()
// Logging set to help debug issues, remove before releasing your app.
OneSignal.setLogLevel(OneSignal.LOG_LEVEL.VERBOSE, OneSignal.LOG_LEVEL.NONE)
// OneSignal Initialization
OneSignal.initWithContext(this)
OneSignal.setAppId(ONESIGNAL_APP_ID)
}
}
Step 4. Customize the default notification icons ( strongly recommended )
By default, notifications will be shown with a small bell icon in the notification shade. Follow the Customize Notification Icons guide to create your own small and large notification icons for your app.

Step 5. Run Your App and Send Yourself a Notification
Run your app on a physical device to make sure it builds correctly.
Your Android device should already be subscribed to push notifications. Check your OneSignal Dashboard Audience > All Users to see your Device Record.
Then head over to Messages > New Push to Send your first Push Notification from OneSignal.
Troubleshooting
If running into issues, see our Android troubleshooting guide.
Try the example project on Github.
If stuck, contact support directly or email [email protected] for help.
For faster assistance, please provide:
- Your OneSignal App Id
- Details, logs, and/or screenshots of the issue.
- Steps to reproduce
Setup Complete!
Visit Mobile Push Tutorials for next steps.
Updated about a month ago
What's Next
| Mobile Push Tutorials |


