Skip to content

Quick start

Get started with the Pushwoosh Android SDK using this quick and simple example

Prerequisites

To integrate the Pushwoosh Android SDK into your app, you will need the following:

Download the example project

Clone the example project from GitHub:

Terminal window
git clone https://github.com/Pushwoosh/pushwoosh-android-sample

Configure the project

  1. Place your google-services.json file in the demoapp/app directory.

  2. In your module-level (app) build.gradle, update the applicationId to match your package name.

  3. In res/values/strings.xml, set your project number as the value for fcm_sender_id.

  4. In the AndroidManifest.xml, set your Pushwoosh App Code as the value for the com.pushwoosh.appid metadata tag:

    <meta-data android:name="com.pushwoosh.appid" android:value="__APP_CODE__" />

Run the project

  1. Build and run the project.
  2. The app will have two tabs: “Actions” and “Settings”. Navigate to the Settings tab.
  3. Tap the Register for Pushes button.
  4. Grant permission for push notifications. The device will be registered with Pushwoosh.

You should see a log entry like this:

Terminal window
[FcmRegistrarWorker] FCM token is cjdyW...Brk0Q
[RequestManager]
x
| Pushwoosh request:
| Url: https://XXXXX-XXXXX.api.pushwoosh.com/json/1.3/registerDevice
Payload: {"request":{"application":"XXXXX-XXXXX","hwid":"acf11f23-170d-4e65-8575-319b2795f8c3","v":"6.7.16","device_type":3,"userId":"acf11f23-170d-4e65-8575-319b2795f8c3","language":"en","timezone":14400,"android_package":"com.xxxxx.xxxx","device_model":"Google sdk_gphone64_arm64","device_name":"Phone","os_version":"15","app_version":"1.1","notificationTypes":6,"push_token":"cjdyW...Brk0Q","sounds":[]}}
| Response: {"status_code":200,"status_message":"OK","response":{}}
x
[NotificationManager] Registered for push notifications: cjdyW...Brk0Q

Send a push notification

Go back to the Pushwoosh Control Panel and send a push notification to your registered device.

What’s next

To learn more, please refer to the basic integration guide