Android Tutorial Simple Push Framework

rwblinn

Well-Known Member
Licensed User
Longtime User
Hi All,

cant get the client to work. Have setup a project in GCM with project name, project id and number. also obtained a server api key.
After modifying the parameter, the desktop receives emails, but for the client when entering a name and press register nothing happens.

I read in this thread, the mention of registering the app at google. How to do that?

Appreciate any advice.
 

rwblinn

Well-Known Member
Licensed User
Longtime User
You only need to receive an API key and project ID from Google.

If the desktop app received an email from the device then the device was registered successfully.

Hi Erel,

the desktop did not receive an email from the device (but emails from my googlemail.com account).
The B4A client, used via the emulator, does not sent an email! The log states "Push service started", but then nothing happens.

Do I need to use the app on the device and can not use the emulator?
 

rwblinn

Well-Known Member
Licensed User
Longtime User
Hi Erel,

got it to work:
  • In pushexample.b4a the senderID is the Google Project Number (12 Digit) and not the Project ID
  • Real Device using Android 2.3.5 did not work - Error Message: Invalid Service
  • Real Device using Android 4.3 registration successful
  • Changed the package name to another then the default
  • In B4J POP3 an error occurs when retrieving the devices - using JavaFX 8 :
    B4X:
    java.lang.NoSuchMethodError: javafx.scene.control.CheckBoxTreeItem.setIndependent(Ljava/lang/Boolean;)V
    This happens when initializing the CheckTreeViewItem in Sub ShowDevices.
  • To test used a registered name direct and message came through
Thanks for your support --- will build further upon this.
 

rwblinn

Well-Known Member
Licensed User
Longtime User
Hi Erel,

as requested
B4X:
main._showdevices (java line: 376)
java.lang.NoSuchMethodError: javafx.scene.control.CheckBoxTreeItem.setIndependent(Ljava/lang/Boolean;)V
    at anywheresoftware.b4j.objects.TreeViewWrapper$CheckBoxTreeItemWrapper.Initialize(TreeViewWrapper.java:158)
    at b4j.example.main._showdevices(main.java:376)
    at b4j.example.main._appstart(main.java:93)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:483)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:93)
    at anywheresoftware.b4a.BA.raiseEvent(BA.java:84)
    at b4j.example.main.start(main.java:35)
    at com.sun.javafx.application.LauncherImpl$8.run(LauncherImpl.java:837)
    at com.sun.javafx.application.PlatformImpl$7.run(PlatformImpl.java:335)
    at com.sun.javafx.application.PlatformImpl$6$1.run(PlatformImpl.java:301)
    at com.sun.javafx.application.PlatformImpl$6$1.run(PlatformImpl.java:298)
    at java.security.AccessController.doPrivileged(Native Method)
    at com.sun.javafx.application.PlatformImpl$6.run(PlatformImpl.java:298)
    at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
    at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
    at com.sun.glass.ui.win.WinApplication.access$300(WinApplication.java:39)
    at com.sun.glass.ui.win.WinApplication$4$1.run(WinApplication.java:112)
    at java.lang.Thread.run(Thread.java:745)
 

rwblinn

Well-Known Member
Licensed User
Longtime User
Hi Erel,

using jFX 2.01 following error when requesting checkboxtreeitem check (... ti.Checked...)- in POP3 example.
B4X:
main._btnsend_action (java line: 123)
java.lang.NoSuchMethodError: javafx.scene.control.CheckBoxTreeItem.isSelected()Ljava/lang/Boolean;
    at anywheresoftware.b4j.objects.TreeViewWrapper$CheckBoxTreeItemWrapper.getChecked(TreeViewWrapper.java:185)
    at b4j.example.main._btnsend_action(main.java:123)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:483)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:93)
    at anywheresoftware.b4a.BA$2.run(BA.java:165)
    at com.sun.javafx.application.PlatformImpl$6$1.run(PlatformImpl.java:301)
    at com.sun.javafx.application.PlatformImpl$6$1.run(PlatformImpl.java:298)
    at java.security.AccessController.doPrivileged(Native Method)
    at com.sun.javafx.application.PlatformImpl$6.run(PlatformImpl.java:298)
    at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
    at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
    at com.sun.glass.ui.win.WinApplication.access$300(WinApplication.java:39)
    at com.sun.glass.ui.win.WinApplication$4$1.run(WinApplication.java:112)
    at java.lang.Thread.run(Thread.java:745)
 

rwblinn

Well-Known Member
Licensed User
Longtime User
Hi Erel,

found one more = when setting
B4X:
treeitem.checked = true
following error occurs:
B4X:
java.lang.NoSuchMethodError: javafx.scene.control.CheckBoxTreeItem.setSelected(Ljava/lang/Boolean;)V
 

Levisvv

Member
Licensed User
Longtime User
Erel can you explain how communications with this simple method works offline?
Is the B4J application simply connecting directly to the Android devices over TCP/IP? without needing to connect to the online GCM server? Other than the email needed to register devices, can this work on a closed/secured network that has absolutely no internet access?
 

Giacomo Cuciniello

Member
Licensed User
Longtime User
I have a strange behaviour.
The work on google api is done.
my phone send the mail to the desktop app.
desktop app receive the mail and include my phome in the device list.
when I send a message from the desktop app it seems ok
{"multicast_id":7010969338997093013,"success":1,"failure":0,"canonical_ids":0,"results":[{"message_id":"0:1408805079180448%22199a2af9fd7ecd"}]}
but nothing arrive on the phone.
the app is running on the phone, internet connection is ON but I don't receive any message.
What can I check?
the only difference that I find is that my project ID is of 13 digit and not 12 but registation is achived.
thanks for your help
 
Last edited:

Giacomo Cuciniello

Member
Licensed User
Longtime User
thank you Erel,
I don't understand why but today it is working
I noted the messages arrive even after phone rebott without starting again the app.
thanks again
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…