Android Tutorials : Pushwoosh Integration On Android For Sending Push Notifications

Yes! your applications can Talk! Pushwoosh makes your application talk. Pushwoosh supports 21 platforms. Using few easy steps, your android application can send push notifications. Push notifications are important as to make all users involve in the application. As parse has announced its shut down, parse users need to migrate to Pushwoosh which will allow applications to send push notifications and offers many mores services. Pushwoosh service is available for iOS, Android, Windows Phone, Blackberry, Amazon, Windows 8, OS X and Safari web sites.

 

The steps to create your first Push are described in 3 parts :

Part ! : Includes account creation and getting your project number

1. Sign up on Pushwoosh by using this link : SignUp. A 14 days trial Platinum period will start right after you activate your account. After 14 days you can either upgrade or use free account with which you can send up to 1 million pushes every month.

2. Activate your Pushwoosh account by clicking on a link which is sent to your email by Pushwoosh team. You should be able to login to your Pushwoosh dashboard (Pushwoosh control panel) after activating your account.

3. Click on Add New button in your Pushwoosh dashboard and enter your application name and add an icon for your application. Click on Save Application button.

Click on Add New button

4. Application code gets generated and can be seen just below your application name. You will be requiring this application code in later steps.

Project Code gets generated

5. Login your Google Developer Console . Select an existing project or create a new project in case if you do not have created any project yet.

Create a new Project

6. Now, in your Google Developer Console dashboard, click on Enable and Manage APIs.

Click on Enable and Manage APIs

7. Under Mobile APIs category you need to click on Google Cloud Messaging option.

Click on Google Cloud Messaging

8. In the next page you need to click on Enable API button.

Click on Enable API

9. Now you are supposed to add credentials to your project for which you need to click on Credentials Tab which is on the left pane of your dashboard.

Credentials

10. Click on Create credentials option.Now select API key from the menu displayed.

Click on API key

11. Now select Server Key from the options displayed.

Click on Server Key

12. After this you need to click on create button.You “need not” enter any IP address as it is optional to accept requests from specific server IP addresses.By the end of this step you should have created a Server key.

PushwooshTwentySix

13. Your credentials will be displayed as shown below in your Credentials Tab.Copy this server key and come back to your Pushwoosh dashboard.

Your credentials

14. Now you need to configure the platform on which your application is running. In our case it’s Android. So click on configure button which can be found just beside Android option displayed in your Pushwoosh application control panel.

PushwooshThree

15. Once you click on configure option you need to paste the Server key(API key) which you had created during the last step. Select Native framework or any other framework as applicable. Save this information.

Pushwoosh17

16. If you see “MismatchSenderID” errors in your Push History, please try the following:

  • Use “Browser Key” instead of the “Server key”;
  • Check that the Google Project Number in your app matches the one in your Google Developers Console.

17. You will also need the Project Number which is automatically assigned by the Google Developers Console when you create a project. You can find the Project Number in the “Dashboard” tab of the Google API consoleDon’t confuse it with Project ID, which is a completely different identifier & is used only within Developers Console!

Pushwoosh18

 

Part !! : Includes changes to your MainActivity.java

1. Add following dependencies to your build.gradle(Module:app) file. Sync the project.

2. In onCreate() method of your MainActivity.java you have add following lines of code to start PushManager.

3. In MainActivity.java you will have to add following receivers :

4. In onResume() and onPause() methods of MainActivity.java manage the receivers

5. You need to create the following methods in your MainActivity.java: The method checkMessage() will check PushWoosh extras in this intent, and fire actual method.The method resetIntentValues() will check main Activity intent and if it contains any PushWoosh data, will clear it. The method showMessage() is to print Log messages. Also add onNewIntent() method to call checkMessage() method from it.

6. You can also have a look at the sample Pushwoosh project on Github  : Android Sample Project

 

Part !!! : Includes changes to AndroidManifest.xml

1. In AndroidManifest.xml manifest add the following lines under application tag:

Where:PW_APPID is your Pushwoosh Application Code
PW_PROJECT_ID is the Project Number you received from Google (Locate your Project Number) prefixed with letter A.
Replace XXXX-XXXXX with your Pushwoosh Application code which was obtained in the 4th step of Part One of this tutorial.
Also replace “A12345678910” with your “Project Number prefixed with A”.The Project number was obtained in the 17th step of Part One of this tutorial.
For example, if your project number is 45678912345 then you need to write “A45678912345”.

2. Add the following changes in your AndroidManifest.xml under manifest tag. Replace YOUR_PACKAGE_NAME with the package name for your application.

3. Add the following changes in your AndroidManifest.xml under application tag. Replace PACKAGE_NAME with the package name for your application.

4. Wooosh! All Done. Build your project and run your application. As soon as your application runs for the first time on an Android device, the device gets registered if internet connection is available. On successful registration of a device, number of subscribers for your application in Pushwoosh control panel will increase by one.

5. For sending Push notifications Log In to your Pushwoosh account and click on your application. In the control panel for sending a Push you can write your own message, add an image under Banner option, add badges etc before sending a Push notification.

Pushwoosh28

6. Once you enter required details you can Click on Woosh! button to send your Push.

Pushwoosh29
Pushwoosh30

7. You can find features, configuration & programming guides for all supported platforms and frameworks here – Features and Configurations. You can join Pushwoosh Questions and Answers Community, where Pushwoosh users share their knowledge and experience.

8. If you are successful to send a Push notification please do comment and say you could Woosh!.

 

Download Project

Here is the Video Demo to show the working of this application.


 

 

 

 

 

Pushwoosh integration on Android to send push notifications

4 thoughts on “Pushwoosh integration on Android to send push notifications

  • May 9, 2016 at 6:39 am
    Permalink

    Thanks a Lot. I could Woosh!

    Reply
    • May 10, 2016 at 7:43 pm
      Permalink

      Glad you could do it 🙂

      Reply
  • October 2, 2016 at 4:50 pm
    Permalink

    I could woosh! Thanks for the tutorial!

    Reply
    • October 4, 2016 at 2:45 am
      Permalink

      Glad you could Woosh:)

      Reply

Leave a Reply

Your email address will not be published. Required fields are marked *