Page tree
Skip to end of metadata
Go to start of metadata

Using push notifications in the Android platform enables you to send interactive notifications to your app users. You can modify the notification parameters, it's visualisation and much more.

  1. Setup an Android project in the Google Cloud Console
  2. Configure your app in the PushApps Admin Console
  3. Integrate the SDK into your app

Please Notice

If you are testing on an emulator - set the target of the emulator to Google APIs

Setup an Android project in the Google Cloud Console

  1. Open the Google Cloud Console.
  2. Create an API project by clicking CREATE PROJECT.



    Icon

    Notice: In order to create a new project you will need the 'is owner' permission in the Google Cloud Console. If you don't have please contact the account administrator and ask for the permission or ask him/her to create the project.

  3. Once the project that has been created. a page appears that displays your project ID and the project number. For example here,
    Project Number: 449866648164.


    Icon

    Notice: The project number generated by Google, is the is the GOOGLE_API_PROJECT_NUMBER that you need you need to supply in the SDK

     

  4. To enable the GCM service, in the sidebar on the left, select APIs & auth, and In the displayed list of APIs, turn the Google Cloud Messaging for Android toggle to ON.




  5. In  the Credentials section, you will see a list of your existing credentials.
     

  6. Under the Public API Access click on Create new key, and a 'Create a new key' dialog will appear, there select the Browser key option.

  7. In the following dialog click on Create.

  8. Now you have created a Browser key, it should appear in the Credentials sections next to  the API key as in the following screenshot. the Browser key is used as the GCM API Key in PushApps.

 

Configure your app in the PushApps admin console

  1. Login to the PushApps Admin Console, go to My Apps, choose the relevant app and go to Settings > Manage Platforms and click on Configure by the Android icon. Type your API key.



  2. After pressing the save button, the Android icon will become green.

 

Integrate the SDK into your app

  1. Download the SDK from the PushApps GITHUB repository.
  2. Add the pushapps-vx.x.x.jar file to your project's libs folder. If you use Eclipse, then you should see the pushapps-vx.x.x.jar in the project properties > java build path > Libraries > Android Private Libraries;



    If the pushapps.jar does not exists then you need to add it by clicking on Add JARs:

  3. In your main activity, inside the method onCreate(), add the PushApps init line:

    Notice

    You need to replace the GOOGLE_API_PROJECT_NUMBER, and the PUSHAPPS_APP_TOKEN with yours.

     

    For further explanation and more options regarding the sdk please refer to the Android Reference.

  4. Add the following permissions to your AndroidManifest.xml file:

     

    Notice

    Replace <your package> markup with your package name, e.g: com.pushapps.demo.

  5. Add the following receiver, service and activity, inside your application tag in the AndroidManifest.xml: