Was this helpful?

When you request that a push notification be sent to your app on devices, an API BaaS notifier carries the request to the notification service (Google GCM or Apple APNs).

A notifier is represented by an entity in your API BaaS application (see Default Data Entities for reference information). It carries the credentials that authorize your request. Once a notification service has verified that your notifier contains valid credentials, it will forward your push notification to your app on devices.

You can create a notifier in two ways: using the admin portal and programmatically.

For an overview of how to set up push notifications, including troubleshooting tips, see Adding push notifications support.

Requirements

To create a notifier, you must first register your app with the appropriate notification service, as described in Registering with a notification service.

Creating notifiers with the admin portal

To create a notifier with the admin portal, do the following:

  1. Log in to the admin portal.
  2. In the left nav, select Push > Configuration.
  3. Click the Apple or Android tab.
  4. If you have not already done so, retrieve your .p12 certificate (iOS apps) or API key (Android apps) by following the steps in the Registering with a notification service.
  5. In the admin portal's Configuration page, enter values for the platform on which your mobile app will be installed.
    Name this notifier Enter a unique name that can be used to identify this notifiers.
    Certificate Click Choose File to select the .p12 certificate you generated and saved to your desktop earlier in this tutorial.
    Environment Select the environment appropriate to your app. You may select development or production. Note that for the environment you select, you should have a separate .p12 certificate -- different certificates for development and production.
    Certificate Password

    Enter a certificate password if one was specified when you created your .p12 certificate.

    Name this notifier Enter a unique name that can be used to identify this notifiers.
    API Key

    Enter the API key that was generated when you registered your app with GCM. To retrieve your API key, go to the Google API developer web site, then select APIs & Auth > Credentials.

  6. Click Create Notifier. The API BaaS will create a notifier entity in the /notifiers collection. The notifier will also appear in the list of notifiers in the notifications console. 

Creating notifiers programmatically

You can create an App BaaS notifier programmatically by sending requests to the API BaaS API.

curl -X POST -i -H "Accept: application/json" -H "Accept-Encoding: gzip, deflate" -H "Authorization: Bearer YWMtFeeWEMyNEeKtbNX3o4PU0QAAAT8vzK3xz3utVZat0CosiYm75C2qpiGT79c" -F "name=applenotifier" -F "provider=apple" -F "environment=development" -F "p12Certificate=@/Users/me/dev/pushtest_dev.p12" 'https://api.usergrid.com/my-org/my-app/notifiers'
curl -X POST "https://api.usergrid.com/my-org/my-app/notifiers" -d '{"name":"androiddev", "provider":"google", "apiKey":"AIzaSyCkXOtBQ7A9GoJsSLqZlod_YjEfxxxxxxx"}'

Notifier endpoints

The following are the available notifier endpoints. For details on notifier properties, see Notifier, Receipt, and Notification.

Base URL: https://api.usergrid.com/my-org/my-app/

    Working with one or more notifiers:

    /notifiers

    Working with notifiers associated with specific devices:

    /devices/{device-id}/notifier

    Comments

    The "Creating notifiers programmatically" section is missing detail on the "certificatePassword" form field which must be passed if the Apple notifier certificate (the "p12Certificate" file) is password protected.

    Thanks for the note! We'll update the docs.

    I tried creating a push notifier but it give me error message "error creating notifiertrue" although I`m sure I provided the correct API key

    Hey Mahmoud -- It seems to be working fine on our end. May I ask what you're doing to create the notifier? Are you using an SDK API, HTTP API, or the portal? Thanks!

    Hi Straut -- I'm using App Services portal > Push > Configuratrion > Android tab, I set notifier name to "arabia-android-notifier" and set the API key to the Android API Key I got from my application on google Developers Console. When I click Create Notifier it gives me the error message above. Any suggestions what could be wrong? thank you.

    Hi Mahmoud

    This could have potentially been due to a bug in the console at the time, or an invalid API key. I have just tested the same method and successfully created a new notifier using the new Apigee admin console. Can you please give it another try and let me know if you continue to experience the issue?

    I am having the same problem. I am not able to create notifier.

    This could have been due to our change to the new Apigee admin console. Can you please give it another try and let me know what error you see?

    i have error in creating notifier....

    Hey agustu -- What error are you seeing? Are you using the admin portal, creating from an API call, or using one of the SDKs?

    I want to make app for push notification and for that i follow your tutorial and in that i have to create notifier using my api key...i give androidProj name to my notifier and my api key but this give me error... " error in creating notiferture".. i m trying this for 2 days but facing the same problem...plz help me to solve this issue..

    Hey agustu - Docs have been updated to reflect a change in Google's way to get an API key. You need to request a server key rather than an Android key.

    http://apigee.com/docs/app-services/content/registering-notification-service

    You need to set the status of the API Google Cloud Messaging for Android to ON inside the APIs&Auth->APIs section after you set your project and get your API Key

    hi i found a way to get free xbox live code gifts.free xbox live gold codes

    hey frinds i love gaming. and if you want free xbox live gold codes then click here and i will give you xbox live gold codes without any cost xbox live gold free

    Hi,

    I am also having the same issue :( Unable to create notifier.

    Hi Omama - Docs have been updated to reflect a change in Google's way to get an API key. You need to request a server key rather than an Android key. See if that works for you.

    http://apigee.com/docs/app-services/content/registering-notification-service

    Apigee, I am having the same issue - "cannot create notifier". This is for the Android notifier via the console. Attempting this programmatically give me a permission error (UnauthorizedExceptio).

    Please advise.

    Hey Enrique -- Glad you got this working!

    In the admin panel, I tried creating a notifier for the sandbox app. The "create notifier" is clickable but doesn't do anything. All other fields are valid.

    Hey Twiddler - Docs have been updated to reflect a change in Google's way to get an API key. You need to request a server key rather than an Android key. See if that solves your problem.

    http://apigee.com/docs/app-services/content/registering-notification-service

    I have same experience when I click on Create Notifier it says 'error creating notifier" is there an ETA for fix or any work around

    Hey Chris -- Docs have been updated to reflect a change in Google's way to get an API key. You need to request a server key rather than an Android key.

    http://apigee.com/docs/app-services/content/registering-notification-service

    Hi, same problem for me. Here is the error message provided when i loggued out and loggued in :
    error getting notifiers : Could not find application for null/null from URI: null/null/notifiers

    Please can you help us ?

    Thx.

    OK ... we need to create a SERVER KEY on Google developers console for any ip address, not an Android key. And it works !

    Yep. Docs were updated this morning. Glad you got it working!

    Apigee, please help, I'm having a problem after running the sample application and going through all the steps, I got the following error in the console, although I already added the permission wakelock inside the AndroidManifest.xml

    03-05 17:50:23.961: V/GCMBaseIntentService(8888): Acquiring wakelock
    03-05 17:50:23.961: D/AndroidRuntime(8888): Shutting down VM
    03-05 17:50:23.961: W/dalvikvm(8888): threadid=1: thread exiting with uncaught exception (group=0x40df5438)
    03-05 17:50:23.971: E/AndroidRuntime(8888): FATAL EXCEPTION: main
    03-05 17:50:23.971: E/AndroidRuntime(8888): java.lang.RuntimeException: Unable to start receiver com.plugin.gcm.CordovaGCMBroadcastReceiver: java.lang.SecurityException: Neither user 10136 nor current process has android.permission.WAKE_LOCK.
    03-05 17:50:23.971: E/AndroidRuntime(8888): at android.app.ActivityThread.handleReceiver(ActivityThread.java:2291)
    03-05 17:50:23.971: E/AndroidRuntime(8888): at android.app.ActivityThread.access$1600(ActivityThread.java:143)
    03-05 17:50:23.971: E/AndroidRuntime(8888): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1317)
    03-05 17:50:23.971: E/AndroidRuntime(8888): at android.os.Handler.dispatchMessage(Handler.java:99)
    03-05 17:50:23.971: E/AndroidRuntime(8888): at android.os.Looper.loop(Looper.java:137)
    03-05 17:50:23.971: E/AndroidRuntime(8888): at android.app.ActivityThread.main(ActivityThread.java:4960)
    03-05 17:50:23.971: E/AndroidRuntime(8888): at java.lang.reflect.Method.invokeNative(Native Method)
    03-05 17:50:23.971: E/AndroidRuntime(8888): at java.lang.reflect.Method.invoke(Method.java:511)
    03-05 17:50:23.971: E/AndroidRuntime(8888): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1038)
    03-05 17:50:23.971: E/AndroidRuntime(8888): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:805)
    03-05 17:50:23.971: E/AndroidRuntime(8888): at dalvik.system.NativeStart.main(Native Method)
    03-05 17:50:23.971: E/AndroidRuntime(8888): Caused by: java.lang.SecurityException: Neither user 10136 nor current process has android.permission.WAKE_LOCK.
    03-05 17:50:23.971: E/AndroidRuntime(8888): at android.os.Parcel.readException(Parcel.java:1425)
    03-05 17:50:23.971: E/AndroidRuntime(8888): at android.os.Parcel.readException(Parcel.java:1379)
    03-05 17:50:23.971: E/AndroidRuntime(8888): at android.os.IPowerManager$Stub$Proxy.acquireWakeLock(IPowerManager.java:421)
    03-05 17:50:23.971: E/AndroidRuntime(8888): at android.os.PowerManager$WakeLock.acquireLocked(PowerManager.java:323)
    03-05 17:50:23.971: E/AndroidRuntime(8888): at android.os.PowerManager$WakeLock.acquire(PowerManager.java:302)
    03-05 17:50:23.971: E/AndroidRuntime(8888): at com.google.android.gcm.GCMBaseIntentService.runIntentInService(GCMBaseIntentService.java:280)
    03-05 17:50:23.971: E/AndroidRuntime(8888): at com.google.android.gcm.GCMBroadcastReceiver.onReceive(GCMBroadcastReceiver.java:55)
    03-05 17:50:23.971: E/AndroidRuntime(8888): at android.app.ActivityThread.handleReceiver(ActivityThread.java:2284)

    Hi Neamat -- Just to confirm, you have the following in your AndroidManifest.xml (no spelling errors, etc)?

    <uses-permission android:name="android.permission.WAKE_LOCK" />

    Thanks,
    Steve

    Hi Sir,
    I am using Server key and want to create notifier through Admin portals. I gave the name tbgDev and entered the server key from google. But Still i got the error "error creating notifier". Please can you help me to solve this problem.
    Thanks
    Dhiraj

    Add new comment

    Provide your email address if you wish to be contacted offline about your comment.
    We will not display your email address as part of your comment.

    We'd love your feedback and perspective! Please be as specific as possible.
    Type the characters you see in this picture. (verify using audio)

    Type the characters you see in the picture above; if you can't read them, submit the form and a new image will be generated. Not case sensitive.