Other B4X Push Server

B4X Push Server is a B4J written back-end server for B4i and B4A apps that use push notifications (Android - GCM, iOS - APN).

Its two main features are:
- Collect device tokens - DeviceToken class.
- Send messages to the devices - Send servlet (which calls iOSPush and AndroidPush modules).


There are several settings which you need to configure. The configuration file is located under the Objects folder:


You must set the following properties:
iPushKeyStore / iPushKeystorePassword - Path and password of the push keystore created with B4i (see this tutorial: https://www.b4x.com/android/forum/threads/push-notifications.48562/).

AndroidApiKey - The GCM key from Google developer console (see this tutorial: https://www.b4x.com/android/forum/threads/19226/#content).

PushServerPassword - This value is required when sending messages.

B4A / B4i Apps

The B4A / B4i apps that receive push notifications (client apps) need to register to the push notifications service when they start and send the received token to the B4X push server. You need to configure the push server url in each of the apps.

For the B4A app you need to set the SenderId and to add the required text to the manifest editor.

For the B4i app you need to set the #ProvisionFile attribute to point to the push provision profile.

Server Code

The server code is quite simple and can be customized as needed. It depends on jNetwork library v1.10+ (for the SSLSocket).
The tokens are stored in a SQLite database.

To send a message to all devices (that were updated in the last 3 days) you need to call the Send servlet:
http://<server url>/send?password=<PushServerPassword>&text=Message to send

Apple remote notifications documentation: https://developer.apple.com/library...icationsPG/Chapters/CommunicatingWIthAPS.html
Google GCM documentation: http://developer.android.com/google/gcm/index.html

V0.96 - Fixes an issue with the feedback timer being disabled.
V0.95 - It adds support for iOS feedback service. These lines should be added to existing config files:

#change to: feedback.push.apple.com for production

The feedback service holds a list of rejected tokens. The server will call it once an hour to find rejected tokens which will then be deleted from the database.

Note that the feedback service isn't working properly in sandbox mode (the problem is in Apple servers).


  • B4i-PushClient.zip
    3.1 KB · Views: 1,526
  • B4A-PushClient.zip
    7.5 KB · Views: 1,983
  • PushServer.zip
    13.3 KB · Views: 1,562
Last edited:


B4X founder
Staff member
Licensed User
Longtime User


Well-Known Member
Licensed User
Longtime User
I know this is an old thread! BUT I write apps for Amazon devices, these don't support anything google! so I cant use firebase on on these will this work without any google services?




Licensed User
Longtime User
I am trying B4X Push Server but when the server tries to send the push notification I've got error.. In the AndroidPush.bas in the JobDone event I've got "Unauthorized"..
The GoogleApiKey seems to me correct.
What I can do ?


Licensed User
Longtime User
Thanks, after recreating the key seems working fine.
I have seen how to send the message to everyone, but how can I send a message to a specific user?