Uninstall Tracking - (APNS) Apple Push Notification Service

To enable sending Push Notifications through APNs, you need:

  • An SSL certificate associated with an App ID configured for Push Notifications.
  • A provisioning profile for that App ID.

You create both in the Apple Developer Member Center.

Creating the SSL Certificate

This section describes how to generate an SSL certificate for an App ID enabled for Push Notifications. GCM will use this certificate to send Push Notifications to the application identified by the App ID.

Generating a Certificate Signing Request File

To authenticate the creation of the SSL certificate, you need a certificate signing request file.

Note: You create the certificate signing request file on your Mac.
  1. Open Keychain Access on your Mac (you can get to it by choosing Utilities from the Go menu in the Finder).
  2. On the Keychain Access app menu, navigate to Keychain Access > Certificate Assistant > Request a Certificate From a Certificate Authority...
  3. Input your email address and name.
  4. For Request is select Saved to disk, then click Continue to save the file  ".certSigningRequest" to your Mac.

a1.png

Creating an App ID

An App ID is an identifier that uniquely identifies an app. As a convention, it is represented by a reversed domain (e.g., com.google.samples.gcmexample).

Note: If you already have an App ID that you would like to use, make sure that it is an explicit App ID (it does not contain a wildcard) and skip this section.
  1. Navigate to the Apple Developer Member Center and sign in.
  2. Navigate to Certificates, Identifiers, and Profiles.
  3. In the drop-down menu on the top left corner, select iOS Apps, then navigate to Identifiers.
  4. Click the + button to create a new App ID.

    a2.png
  5. To create the new App ID:
    • Input a Name for your App ID (e.g., GCM Sample App)
    • Choose an App ID Prefix (the default selection should be fine)
    • In the App ID Suffix section, select Explicit App ID, then input your Bundle ID (e.g., com.google.samples.gcmexample). The value of the Bundle ID should match the value that you are using in your app's Info.plist and the value that you are using to get a configuration for GCM.

      a3.png
    • In the App Services section, make sure that Push Notifications is checked.

      a4.png
  6. Click Continue and check that your input is correct:
    • The value of Identifier should match the concatenation of the values of the App ID Prefix and the Bundle ID.
    • Push Notifications should be Configurable.
  7. Click Submit to create the App ID.

Configuring an App ID for Push Notifications

To send Push Notifications to an iOS App, you must configure its App ID to do so.

  1. In the list of iOS App IDs, select the one you want to use, then click Edit.

    a5.png

  2. In the Push Notifications section, you can create a Client SSL certificate for the development or production environment. Create one for development by clicking Create Certificate... in the Development SSL Certificate section.

    a6.png

  3. You should now see a section called About Creating a Certificate Signing Request (CSR) that contains information about creating a CSR. Click Continue.
  4. You should now be in the Generate section of the flow. Click Choose File... and select the .certSigningRequest file that you created before, then click Generate when it becomes active.

    a7.png

  5. When the SSL certificate is ready, click Download to save it to your Mac, and click Done to close the certificate creation flow.
  6. On your Mac, locate the downloaded SSL certificate and double-click it to install it in your keychain.
  7. On your Mac, open Keychain Access. Under My Certificates, locate the certificate that you have just added; it should be called Apple Development IOS Push Services: your.bundle.id.
  8. Right-click on the certificate, select Export Apple Development IOS Push Services: your.bundle.id, and save it as a .pl2 file. Enter a password to protect the exported certificate if you want.

The app is now enabled to use the Push Notification development environment. When you are ready to release your application, you need to enable the app to use the Push Notification production environment: repeat these steps, but click Create Certificate under the Production SSL Certificate section instead of Development SSL Certificate.

Note: In your code, make sure that the value of the kGGLInstanceIDAPNSServerTypeSandboxOption option that you are passing to GGLInstanceID.tokenWithAuthorizedEntity:scope:options:handler: is correctly set for the environment that you are using: true for development, false for production. If you are not using the correct environment, messages will not be delivered to your app.

Creating the Provisioning Profile

To test your app while under development, you need a Provisioning Profile for development to authorize your devices to run an app that is not yet published on the App Store.

  1. Navigate to the Apple Developer Member Center and sign in.
  2. Navigate to Certificates, Identifiers, and Profiles.
  3. In the drop-down menu on the top left corner, select iOS Apps, then navigate to Provisioning Profiles.
  4. Click the + button to create a new Provisioning Profile.
  5. Select iOS App Development as a provisioning profile type, then click Continue.
  6. In the drop-down menu, select the App ID you want to use, then click Continue.
  7. Select the iOS Development certificate of the App ID you have chosen in the previous step, then click Continue.
  8. Select the iOS devices that you want to include in the Provisioning Profile, then click Continue. Make sure to select all the devices you want to use for your testing.
  9. Input a name for this provisioning profile (e.g., GCM Sample App Development Profile), then click Generate.
  10. Click Download to save the Provisioning Profile to your Mac.
  11. Double-click the Provisioning Profile file to install it.