Android Tutorial Simple Push Framework

It is recommended to use Firebase for new projects: FirebaseNotifications - Push messages / Firebase Cloud Messaging (FCM)

This solution allows you to use the standard GCM push framework without an online server.

SS-2013-12-12_15.48.10.png


You should first be familiar with GCM and get an API Key and Project id as explained here:
Android push notification (GCM) framework and tutorial

The desktop solution is based on this B4J project: Building a mini "Email based server"

When a user registers the device, an email is sent to the desktop tool. The desktop tool then adds the device to an internal store. If the desktop tool is not online then nothing bad happens. The mail will wait until it the tool is started.

The emails are only used for the registration process.

Note that you can send to multiple targets at once with this solution (unlike the other solution).
As it is written in B4J it should be simple to extend it as needed.

In order to use it you should set the ApiKey variable in the B4J project as well as the mailbox parameters.

You also need to set the mailbox parameters on the device (PushService) and set the SenderId in the Main module.

Tips / Notes

- The B4J project depends on jMsgboxes library (and other internal libraries). It also requires B4J v1.05+.
- If you plan to distribute your app on many devices then you should probably not use a free mail service such as Gmail for the devices. You can use the default email client instead. However in that case it is better to "obfuscate" the message before sending it as the user will see the mail content.
 

Attachments

  • PushDevice.zip
    8.6 KB · Views: 3,092
  • PushDesktop.zip
    6.3 KB · Views: 2,791
Last edited:

tufanv

Expert
Licensed User
Longtime User
1) how can i obfuscate the mail messages or if i dont obfuscate them what can happen ?
2) If i register the device with every app run , is it a problem or it will just overwrite the old one ?

ty
 
Last edited:

tufanv

Expert
Licensed User
Longtime User
I get : 12/18/2015 15:01:08: Error sending message: Bad Request

I could send the messages yesterday. What may be the problem
 
Top