Android SDK quick start
Get started with the Pushwoosh Android SDK using this quick and simple example
Prerequisites
Anchor link toTo integrate the Pushwoosh Android SDK into your app, you will need the following:
Download the example project
Anchor link toClone the example project from GitHub:
git clone https://github.com/Pushwoosh/pushwoosh-android-sample
Configure the project
Anchor link toPlace your google-services.json file in the pushwoosh-demoapp/app directory.
In your build.gradle (Module: app), update the
applicationId
to match your package name.In res/values/strings.xml, replace the placeholder values with your specific details:
pushwoosh_app_id
: Use your Pushwoosh App Code.fcm_sender_id
: Use your Firebase Project Number.pushwoosh_api_token
: Use your Pushwoosh Device API Token
<resources> <string name="app_name">demoapp</string> <string name="title_home">Actions</string> <string name="title_notifications">Settings</string> <string name="pushwoosh_app_id">_YOUR_PUSHWOOSH_APP_ID_</string> <string name="fcm_sender_id">_YOUR_FIREBASE_PROJECT_ID_</string> <string name="pushwoosh_api_token">_YOUR_PUSHWOOSH_DEVICE_API_TOKEN_</string></resources>
Run the project
Anchor link to- Build and run the project.
- The app will have two tabs: “Actions” and “Settings”. Navigate to the Settings tab.
- Tap the Register for Pushes button.
- Grant permission for push notifications. The device will be registered with Pushwoosh.
You should see a log entry like this:
Log level: INFO[RequestPermissionHelper] Requesting permissionsPushwoosh SDK initialized successfullyHWID: __HWID_OF_YOUR_DEVICE__APP_CODE: __YOUR_PUSHWOOSH_APP_ID__PUSHWOOSH_SDK_VERSION: __PUSHWOOSH_SDK_VERSION_INSTALLED__FIREBASE_PROJECT_ID: __YOUR_FIREBASE_PROJECT_ID__PUSH_TOKEN:User ID "__USER_ID_OF_THE_DEVICE__" successfully set
[NotificationManager] Registered for push notifications: __DEVICE_PUSH_TOKEN__
Send a push notification
Anchor link toGo back to the Pushwoosh Control Panel and send a push notification to your registered device.
What’s next
Anchor link toTo learn more, please refer to the basic integration guide