0% found this document useful (0 votes)
60 views33 pages

Push Notifications App Android

The document provides instructions for setting up and using PushNotifications with Firebase and PushAdmin. It describes how to obtain the server key and google-services.json file from the Firebase console needed to integrate push notifications. It also explains how to send push notifications from the Firebase console, through the PushAdmin dashboard, and via the PushAdmin API. Common API requests are demonstrated using PHP cURL.

Uploaded by

Abdul Amrullah
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
60 views33 pages

Push Notifications App Android

The document provides instructions for setting up and using PushNotifications with Firebase and PushAdmin. It describes how to obtain the server key and google-services.json file from the Firebase console needed to integrate push notifications. It also explains how to send push notifications from the Firebase console, through the PushAdmin dashboard, and via the PushAdmin API. Common API requests are demonstrated using PHP cURL.

Uploaded by

Abdul Amrullah
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 33

Push Notifications

Settting up Firebase to Obtain Server Key &


google-services.json

Fist of all, Login to Firebase Console


Creating a Project :
Configuring Notifications:
Adding App Details :

Downloading google-services.json File :


Obtaining FCM Server Key :
You now have server key and google-services.json file, you're ready to
integrate it!
Next Steps: Integrating Push in your App
Notification Integration
Integrating Firebase Push Notifications in your
Apps

1. Click on Enable as shown in (1)


2. Select google-services.json as shown in (2)
3. Click on "Import & Apply" as shown in (3)
This documentation is still under development, we are working to add more
things to it to make it complete. Keep yourself up to date by visiting this
page whenever you needs any help. If heaving some issues, you can
contact Support
Push Notifications
Sending Push Message from Firebase

1. Fist of all, Login to Firebase Console


2. Visit Notifications Tab
3. Click "Send your First Message"
Fill in the details :
Finally, Send it! :
This documentation is still under development, we are working to add more
things to it to make it complete. Keep yourself up to date by visiting this
page whenever you needs any help. If heaving some issues, you can
contact Support
Push Notifications
Sending via PushAdmin

1. Sign up & Login to PushAdmin


Click "My Apps" :
Click "+" Icon to Add your App :

Fill in the App Details :


Click "Send Notifications" :
Fill in the Notification Details" :
Finally, Click "Send"! :
Wow, you've done it! :

Check documentation for PushAdmin API Access


This documentation is still under development, we are working to add more
things to it to make it complete. Keep yourself up to date by visiting this
page whenever you needs any help. If heaving some issues, you can
contact Support
Product Documentation
 Getting Started
 First Steps
 Creating Keystore
 Debugging Apps
 JavaScripts APIs
 AdMob Integration
 Creating Banner Ad Unit
 Creating Interstitial Ad Unit
 Integrating with App
 Push Notifications
 Setting up Firebase
 Integrating with App
 Firebase Notifications
 Using PushAdmin
 PushAdmin API Access

PushAdmin API Access

Getting API Access Credentials:

 Login to PushAdmin -> API Credentials -> API Key & Auth Token.
Overview:

 Two authentication headers need to be sent along with every request:


X-Api-Key, X-Auth-Token
 Base API URL: https://websitetoapk.com/pushadmin/api/v1/
 Following Actions can be made using APIs:
1) Send Broadcast BASE_API_URL/send_broadcast
2) Schedule Broadcast BASE_API_URL/schedule_broadcast
3) Send Individual & Multiple Device BASE_API_URL/send_individual
4) Schedule Individual & Multiple Device BASE_API_URL/schedule_broadcast
5) List of Apps in your PushAdmin Account BASE_API_URL/list_apps
 A WordPress Plugin for Auto Notifications Coming Soon.

Retrieve List of All Apps

$curl = curl_init();

curl_setopt_array($curl, array(

CURLOPT_URL => "https://websitetoapk.com/pushadmin/api/v1/list_apps",

CURLOPT_RETURNTRANSFER => true,

CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,


CURLOPT_CUSTOMREQUEST => "POST",

CURLOPT_HTTPHEADER => array(

"content-type: application/x-www-form-urlencoded",

"X-Api-Key: api-key-here",

"X-Auth-Token: token-here"

),

));

$response = curl_exec($curl);

echo $response;

Common API Request Sample (PHP cURL):


Also, For Send Broadcast ( BASE_API_URL/send_broadcast ):

$curl = curl_init();

$payload = Array(

'packageName' => "com.test.yourpackage", //Required Parameter

'type' => "Simple", //Optional Parameter (Default: Simple, Possible Values: Simple, Image)

'title' => "Test Title", //Required Parameter

'description' => "Test Descriptioon", //Optional

'image' => "http://test.test/image.png", //Optional (Works only when type=Image)

'url' => "http://test.com", //Optional (Must be a URL if given)

'ring' => "RING", //Optional (Default: RING, Possible Values: RING, VIBE, RINGVIBE, SILENT)

// Further parameters described below for different APIs

//Above Options are common for all requests.

);

curl_setopt_array($curl, array(
CURLOPT_URL => "https://websitetoapk.com/pushadmin/api/v1/...", // As per your request

CURLOPT_RETURNTRANSFER => true,

CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,

CURLOPT_CUSTOMREQUEST => "POST",

CURLOPT_POSTFIELDS => http_build_query($payload),

CURLOPT_HTTPHEADER => array(

"content-type: application/x-www-form-urlencoded",

"X-Api-Key: api-key-here",

"X-Auth-Token: token-here"

),

));

$response = curl_exec($curl);

$err = curl_error($curl);

curl_close($curl);

if ($err) {

echo "cURL Error #:" . $err;

} else {

echo $response;

Schedule Broadcast ( BASE_API_URL/schedule_broadcast ):

//Payload in above request for send_broadcast and extras below:

$payload = Array(

...//Common
'timezone' => "Asia/Kolkata", //Your timezone (Required)

'datetime' => "2018-06-30 08:30:00", //Schedule Time (YYYY-MM-DD HH:MM:SS)(Required)

);

Send Individual & Multiple Devices ( BASE_API_URL/send_individual ):


To get device token, check 'getFirebaseDeviceToken()' JavaScript API

//Payload in above request for send_broadcast and extras below:

$payload = Array(

...//Common

'deviceToken' => "token1, token2, token3" //Required(Multiple Tokens comma seperated)

);

Schedule Individual & Multiple Devices


( BASE_API_URL/schedule_individual ):

//Payload in above request for send_broadcast and extras below:

$payload = Array(

...//Common

'deviceToken' => "token1, token2, token3" //Required(Multiple Tokens comma seperated)

'timezone' => "Asia/Kolkata", //Your timezone (Required)

'datetime' => "2018-06-30 08:30:00", //Schedule Time (YYYY-MM-DD HH:MM:SS)(Required)

);

This documentation is still under development, we are working to add more


things to it to make it complete. Keep yourself up to date by visiting this
page whenever you needs any help. If heaving some issues, you can
contact Support

You might also like