In this tutorial:
AppPresser has released push notifications for their excellent WordPress mobile app platform using the AppPush extension. With this release, AppPresser is further solidifying itself as an authority in native Android and iPhone application development. In this article, we will show you how to enable push notifications in your Android app.
What are push notifications?
Push notifications are messages that can be sent directly to your users directly from your mobile app, so that you can update them on things like specials or any other new information. Push notifications are extremely effective in keeping your users in the loop as to what is going on within your app.
Downloading the AppPush extension
First, log into your AppPresser account. You should already have an account if you have been using AppPresser. If you are not already using AppPresser for your mobile app, you may want to follow our guide on creating an app with AppPresser.
From within your AppPresser account, click on View Details and Downloads for the AppPush extension. If you do not see the AppPush extension there, you will need to purchase it from AppPresser first.
Next, scroll down to the Products section of the page and download the AppPush extension. You will then need to manually install this plugin on your WordPress site.
Getting your Google API key
To enable Android push notifications, you’ll need to connect to the Google API. In this section, we’ll show you how to do so.
First, you’ll need to visit the Google API Developer’s Console.
Once inside your developer’s console, create a new project by clicking the Create Project button. If you already have a project associated with the app that you are enabling push notifications on, you may click on that project to edit it.
Next, click on APIs. On this page, you will scroll down to Google Cloud Messaging for Android and click the button that says Off to change it to On.
Now that you have Android cloud messaging enabled, you’ll just need an API key to access it. To do so, click on Credentials then click Create New Key under Public API access to generate your API key.
- Be sure to keep this window open as you will need information from your Google developer’s console in later steps.
To send any messages through the AppPresser AppPush extension, you will need to use the Pushwoosh service. In this section, we will show you how to configure Pushwoosh to connect using to your Google API key.
First, you will need a Pushwoosh account. You can obtain a free account on the Pushwoosh website. Once you have created your account, log into it.
From the Pushwoosh Applications tab, click the big green Add new to create a new push notification app.
A box will open up when creating your application asking for some information. First, enter your title and a custom icon that will be displayed on your push notifications.
- In the bottom, you will see a few radio buttons to select your SDK. Under Android SDK, select PhoneGap Build (Generic). Once it is selected, click Save.
Next, click on Configure on the left side navigation menu, then click Configure next to the Android section.
You will then be prompted to enter your API key that you got in the previous steps from the Google developers console. Just in case you don’t still have that window open, you will log into the Google developers console, click on your app, then click on Credentials. Enter your API key from this page, then click Save.
<gap:plugin name=”com.phonegap.plugins.pushplugin” />
Just as any other typical PhoneGap build, create a zip file out of your PhoneGap files, then visit your app on the PhoneGap website and click the Update code button to begin rebuilding your app. If you are not familiar with building your app in PhoneGap, take a look at the Building your Android or iPhone app with AppPresser article.
Sending push notifications
Sending push notifications from WordPress
If you have a premium Pushwoosh account, you can set WordPress to automatically send push notifications, or manually send them directly from your WordPress admin dashboard. Depending on your settings in place for AppPush, you push notifications will automatically be sent when a new post or page is created. Push notifications may also be sent by hovering over AppPresser, then clicking on Notifications on the left side menu bar.
Sending push notifications from Pushwoosh
If you have a free account, your only option to send push notifications is to do so from the Pushwoosh dashboard. To do so, log into your Pushwoosh dashboard, and click on the application that you created earlier. Here, you will see a text box. Enter your text to send within your push notification, then scroll down to the bottom of the page and click on Woosh!. Your push notification will then be sent to all users of your app.