Before you start adding support for push notifications, be sure you've got the following:
- An Apigee account (it’s free). If you don't yet have an Apigee account, you can create one.
- An API BaaS organization. Organizations are top-level containers for your APIs and other resources. By default, your Apigee account will include one organization that has the same name as your username. You can view your current organizations or create a new one by visiting your account dashboard.
- An API BaaS application. An API BaaS application is where you store your data and where you schedule notifications. Data in the application represents devices, notifiers, notifications, users, and groups. For information on creating an app, see Register apps and manage API keys.
You will need to test with a mobile device running the platform you're developer for. In the case of Android, you might be able to use an emulator. It is not possible to test push notifications from a web browser.
To develop push notifications for an iOS app, you'll need:
- A Mac to generate the necessary SSL certificate.
- An iOS developer account. You'll need this to register for an App ID and get a provisioning profile. To get an account, visit the iOS Dev Center.
- An actual iOS device to test push notifications. It's not yet possible to develop push notifications with an emulator.
- An iOS provisioning profile
For iOS app testing, you need a provisioning profile that's associated with an Apple ID. You set up the provisioning profile in the Apple developer portal, download the profile, and import it into Xcode.
To set up a provisioning profile, you need to create an "iOS App Development" certificate in the Apple developer portal. For example, in the Apple APNs setup earlier in this tutorial, you created a certificate in the Apple developer portal to be used for push notifications. However, you won't be able to create a provisioning portal with just that certificate. You also need to create an "iOS App Development" certificate (the configuration settings don't matter), as shown in the following image.
After you create an iOS App Development certificate, you can create a provisioning profile that includes your App ID/certificate for push notifications.
It's generally a best practice to develop Android apps by testing and debugging with an Android device. It's also possible to use an emulator.
Before testing and debugging with an Android device, you'll need to set up your device for development. Be sure to see the Android documentation on using hardware devices.
To test with an emulator, you will need to follow these steps:
- Ensure that you have Google API 8 (or above) and Android 2.2 (or above).
- Using the Android SDK Manager, install Google Cloud Messaging for Android Library.
- Using the Android Virtual Device Manager, create an emulator whose target is Google APIs.
- Ensure that the emulator you're using includes a Google account.
- Launch the emulator.
- In the emulator, click the Menu button, then go to Settings > Accounts & Sync.
- Add a Google account.
Once you've finished these steps, you should have an emulator that can receive push notification messages.
- You'll need to test with a device or emulator. It is not possible to test push notifications with a browser alone.