B4J Question B4J and Google Cloud Message

Mark Thorndyke

Member
Licensed User
Longtime User
Hi,

Working on a nice little personal gaming project using both B4A and B4J. Successfully talking to various Androids using Google Cloud Messaging via a command line and/or via JShell using the b4a_gcm.jar (ref: https://www.b4x.com/android/forum/t...otification-gcm-framework-and-tutorial.19226/)

I've a monitoring B4J running locally with a live GUI and acting accordingly on what various devices send data back to an online MySQL database via Php.

Wondering if there is a more efficient way to embed using the b4a_gcm.jar instead of using the following when requried (as suggested in https://www.b4x.com/android/forum/threads/jshell-library.34661/#content)

shl.Initialize("shl", "java", Array As String("-cp", "b4a_gcm.jar", "anywheresoftware.b4a.c2dm.C2DM", "send", "registered-device", "data"))
shl.WorkingDirectory = "current directory for b4a_gcm.jar"
shl.Run(10000)
Any suggestions/voices of experience/options/caveats appreciated. I will pour more water about this 'little' project as it grows but so far, looking too good.

Note: B4i once this stage running fluently
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
Wondering if there is a more efficient way to embed using the b4a_gcm.jar instead of using the following when requried
This is not a bad solution. However as you are using B4J you can use B4X push server instead of the php script: B4X Push Server
Especially if you intend to add support for iOS in the future.
 
Upvote 0

Mark Thorndyke

Member
Licensed User
Longtime User
Thanks Erel, will take a look at this very soon.
Debating whether to pursue that side quickly this weekend in readiness if a quick diversion or continue on the path of getting the app done for Android first. I suppose the question I'm asking, would it be fairly quick to adapt/put in place or does it need a little more work compared to the method in place on the the B4J to GCM side? The iOS side I'd want to move onto promptly once the droid side is in a good testing area with friends, as others eager with iOS devices to play too. (It's a unique card game we've adapted over the years being moved into the virtual arena - had working in Flash a few years back but dropped due to mobile market)
 
Upvote 0

Mark Thorndyke

Member
Licensed User
Longtime User
Cheers, will take a stroll through that during the Easter weekend and adapt with what I've currently got in place. Current method is working well and pretty satisfied with the workings, a bit to straight forward after bolting together - hats off to the code.

I doubt this is possible but is there any way for a device to push anything back to a B4J server other than B4A/i updating a MySql database via PHP which is picked up by the a B4J process?
 
Upvote 0
Top