Integrate Pushwoosh Android SDK
Follow the steps below to get your Android application ready to receive pushes
Watch this video where our dedicated Customer Success team will guide you through the onboarding process at Pushwoosh, from setting up projects to sending your first communications.
Requirements
A configured Pushwoosh Application's Code available in Pushwoosh Control Panel in format XXXXX-XXXXX
A Firebase project and its Sender ID
An Android device or emulator with "Google Play Store (Services)" installed
Integration
For Gradle Versions less than 6.8
Include the following Maven repository URL in project's build.gradle:
Add pushwoosh library dependencies into your application's build.gradle:
Replace "+" with the current version of Pushwoosh and Android Support libraries.
For Gradle Versions 6.8 or Higher
Locate the Settings.gradle file in the root directory of your project.
![Settings.gradle file in the root directory of a project](https://docs.pushwoosh.com/~gitbook/image?url=https%3A%2F%2F1722045706-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F-LZcP-aO1PEwwePSSaCB-1260461824%252Fuploads%252FaLArH75IL4wOP7taUqtv%252Fimage3.png%3Falt%3Dmedia%26token%3D0d844dbc-80dc-4691-8d45-c3984dbba8ec&width=768&dpr=4&quality=100&sign=a95a9186&sv=1)
Open the Settings.gradle file and declare the repositories like this:
Then, save the changes.
![Settings.gradle file](https://docs.pushwoosh.com/~gitbook/image?url=https%3A%2F%2F1722045706-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F-LZcP-aO1PEwwePSSaCB-1260461824%252Fuploads%252Fso41u3RSqrYno7hqNheP%252Fimage.png%3Falt%3Dmedia%26token%3De9e172ef-ef7f-4df0-a8a5-4c1a14d0e9cd&width=768&dpr=4&quality=100&sign=60f13767&sv=1)
Next, open your project in Android Studio. Go Tools > Firebase > Cloud Messaging and click "Set up Firebase Cloud Messaging":
![](https://docs.pushwoosh.com/~gitbook/image?url=https%3A%2F%2F1722045706-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F-LZcP-aO1PEwwePSSaCB-1260461824%252Fuploads%252FcpX9LFJPpFw2MtxAjC2M%252FScreenshot%25202021-11-16%2520at%252016.30.16.png%3Falt%3Dmedia%26token%3Df4cdf10c-7712-4296-984b-0ba7addddc36&width=768&dpr=4&quality=100&sign=1c15147&sv=1)
Connect your app with Firebase, grant Android Studio access to your Google account (if needed), and choose your Firebase project.
Then add FCM to your application and accept changes:
![](https://docs.pushwoosh.com/~gitbook/image?url=https%3A%2F%2F1722045706-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F-LZcP-aO1PEwwePSSaCB-1260461824%252Fuploads%252F1swocepXko2MejgqJvhE%252FScreenshot%25202021-11-16%2520at%252016.34.03.png%3Falt%3Dmedia%26token%3De3015495-d7e9-497b-ad7c-630026dbbf3f&width=768&dpr=4&quality=100&sign=702fa36&sv=1)
Add the following metadata to AndroidManifest.xml:
Where:
com.pushwoosh.appid
is your Pushwoosh Application Code located below the name of your application.com.pushwoosh.senderid
is the Sender ID you received from Firebase Console.com.pushwoosh.apitoken
requires an API Access Token, which you can generate by navigating to Settings > API Access inyour Pushwoosh account and copying the generated token.
Please note that you must add meta-data inside the <application> tag
![](https://docs.pushwoosh.com/~gitbook/image?url=https%3A%2F%2F1722045706-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F-LZcP-aO1PEwwePSSaCB-1260461824%252Fuploads%252FYnmpd2xmdLh7wxIsLjLw%252FScreenshot%25202024-08-08%2520at%252019.38.09.png%3Falt%3Dmedia%26token%3D9bac69ff-a1ef-4f81-b17b-4d4ca90320d3&width=768&dpr=4&quality=100&sign=4aa2869&sv=1)
Please note that you need to add fcm_sender_id to res/values/strings.xml of your Android project:
![](https://docs.pushwoosh.com/~gitbook/image?url=https%3A%2F%2F1722045706-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F-LZcP-aO1PEwwePSSaCB-1260461824%252Fuploads%252FS03BG5tMrgMQ9u0VzX8a%252FScreenshot%25202021-11-18%2520at%252017.35.37.png%3Falt%3Dmedia%26token%3Dd8fbfc90-b7f8-4654-96bc-156a2abbe581&width=768&dpr=4&quality=100&sign=2142b950&sv=1)
Finally, register for push notifications:
Testing push notifications on test devices
If you want to test push notifications on test devices without affecting the production environment, follow the steps below. If you do not need to use this functionality, skip this section.
Add DeepLinkActivity to your AndroidManifest.xml:
Don't forget to replace YOUR_PUSHWOOSH_APP_ID in the xml above with your Pushwoosh App ID. Example: <data android:scheme="pushwoosh-ABCDE-EDCBA" />
Launch the application to subscribe for push notifications.
Scan the QR Code in Test Devices form using any appropriate QR Code scanner app*. A toast message will appear indicating the status of the test device registration.
* – most of the QR code scanning apps handle such deep links properly, here are just a few of them:
Next steps
Customize Android SDKShare your feedback with us
Your feedback helps us create a better experience, so we would love to hear from you if you have any issues during the SDK integration process. If you face any difficulties, please do not hesitate to share your thoughts with us via this form.
Last updated