Hello team,
I have created my first chat websocket server using this example. After that i am trying this example for android client.
At PushService there is sticky service declaration that is obsolete, so i change it:
which cause a notification that always persissts. If I don't set it and kill it from recent apps then no notification will come and all messages are lost.
So the problem is that all mainstream chat apps does not have a persistent notification in order to show notifications, so what is the problem?
I searched on forum and tried to implement solution from background gps example with same luck. Persistent notification or lost messages-notifications.
Moreover, if i kill it from recent apps and send many messages from other device to that one, server throws this error:
I attach you B4A client project and three modules from jrdc2 websocket server. This websocket server files are using an online SQL instead of SQLite.
Thank you for your time.
p.s. Pixel 5 with Android 12
I have created my first chat websocket server using this example. After that i am trying this example for android client.
At PushService there is sticky service declaration that is obsolete, so i change it:
B4X:
Service.AutomaticForegroundMode = Service.AUTOMATIC_FOREGROUND_ALWAYS
So the problem is that all mainstream chat apps does not have a persistent notification in order to show notifications, so what is the problem?
I searched on forum and tried to implement solution from background gps example with same luck. Persistent notification or lost messages-notifications.
Moreover, if i kill it from recent apps and send many messages from other device to that one, server throws this error:
B4X:
java.lang.RuntimeException: java.lang.RuntimeException: java.sql.SQLException: An attempt by a client to checkout a Connection has timed out.
at anywheresoftware.b4a.keywords.Common.CallSub4(Common.java:523)
at anywheresoftware.b4a.keywords.Common.access$0(Common.java:494)
at anywheresoftware.b4a.keywords.Common$CallSubDelayedHelper.run(Common.java:568)
at anywheresoftware.b4a.keywords.SimpleMessageLoop.runMessageLoop(SimpleMessageLoop.java:47)
at anywheresoftware.b4a.StandardBA.startMessageLoop(StandardBA.java:43)
at anywheresoftware.b4a.keywords.Common.StartMessageLoop(Common.java:180)
at b4j.example.main._appstart(main.java:124)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:111)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:98)
at b4j.example.main.main(main.java:28)
Caused by: java.lang.RuntimeException: java.sql.SQLException: An attempt by a client to checkout a Connection has timed out.
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:140)
at anywheresoftware.b4a.keywords.Common.CallSub4(Common.java:514)
... 13 more
Caused by: java.sql.SQLException: An attempt by a client to checkout a Connection has timed out.
at com.mchange.v2.sql.SqlUtils.toSQLException(SqlUtils.java:118)
at com.mchange.v2.sql.SqlUtils.toSQLException(SqlUtils.java:77)
at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.checkoutPooledConnection(C3P0PooledConnectionPool.java:690)
at com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource.getConnection(AbstractPoolBackedDataSource.java:140)
at anywheresoftware.b4j.object.ConnectionPool.GetConnection(ConnectionPool.java:62)
at b4j.example.pushshared._updatebrowsers(pushshared.java:832)
at b4j.example.pushshared._newconnection(pushshared.java:151)
at jdk.internal.reflect.GeneratedMethodAccessor11.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:111)
... 14 more
Caused by: com.mchange.v2.resourcepool.TimeoutException: A client timed out while waiting to acquire a resource from com.mchange.v2.resourcepool.BasicResourcePool@702b8b12 -- timeout at awaitAvailable()
at com.mchange.v2.resourcepool.BasicResourcePool.awaitAvailable(BasicResourcePool.java:1467)
at com.mchange.v2.resourcepool.BasicResourcePool.prelimCheckoutResource(BasicResourcePool.java:644)
at com.mchange.v2.resourcepool.BasicResourcePool.checkoutResource(BasicResourcePool.java:554)
at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.checkoutAndMarkConnectionInUse(C3P0PooledConnectionPool.java:758)
at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.checkoutPooledConnection(C3P0PooledConnectionPool.java:685)
... 22 more
main.main (java line: 28)
java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: java.sql.SQLException: An attempt by a client to checkout a Connection has timed out.
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:140)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:98)
at b4j.example.main.main(main.java:28)
Caused by: java.lang.RuntimeException: java.lang.RuntimeException: java.sql.SQLException: An attempt by a client to checkout a Connection has timed out.
at anywheresoftware.b4a.keywords.Common.CallSub4(Common.java:523)
at anywheresoftware.b4a.keywords.Common.access$0(Common.java:494)
at anywheresoftware.b4a.keywords.Common$CallSubDelayedHelper.run(Common.java:568)
at anywheresoftware.b4a.keywords.SimpleMessageLoop.runMessageLoop(SimpleMessageLoop.java:47)
at anywheresoftware.b4a.StandardBA.startMessageLoop(StandardBA.java:43)
at anywheresoftware.b4a.keywords.Common.StartMessageLoop(Common.java:180)
at b4j.example.main._appstart(main.java:124)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:111)
... 2 more
Caused by: java.lang.RuntimeException: java.sql.SQLException: An attempt by a client to checkout a Connection has timed out.
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:140)
at anywheresoftware.b4a.keywords.Common.CallSub4(Common.java:514)
... 13 more
Caused by: java.sql.SQLException: An attempt by a client to checkout a Connection has timed out.
at com.mchange.v2.sql.SqlUtils.toSQLException(SqlUtils.java:118)
at com.mchange.v2.sql.SqlUtils.toSQLException(SqlUtils.java:77)
at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.checkoutPooledConnection(C3P0PooledConnectionPool.java:690)
at com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource.getConnection(AbstractPoolBackedDataSource.java:140)
at anywheresoftware.b4j.object.ConnectionPool.GetConnection(ConnectionPool.java:62)
at b4j.example.pushshared._updatebrowsers(pushshared.java:832)
at b4j.example.pushshared._newconnection(pushshared.java:151)
at jdk.internal.reflect.GeneratedMethodAccessor11.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:111)
... 14 more
Caused by: com.mchange.v2.resourcepool.TimeoutException: A client timed out while waiting to acquire a resource from com.mchange.v2.resourcepool.BasicResourcePool@702b8b12 -- timeout at awaitAvailable()
at com.mchange.v2.resourcepool.BasicResourcePool.awaitAvailable(BasicResourcePool.java:1467)
at com.mchange.v2.resourcepool.BasicResourcePool.prelimCheckoutResource(BasicResourcePool.java:644)
at com.mchange.v2.resourcepool.BasicResourcePool.checkoutResource(BasicResourcePool.java:554)
at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.checkoutAndMarkConnectionInUse(C3P0PooledConnectionPool.java:758)
at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.checkoutPooledConnection(C3P0PooledConnectionPool.java:685)
... 22 more
I attach you B4A client project and three modules from jrdc2 websocket server. This websocket server files are using an online SQL instead of SQLite.
project - Google Drive
drive.google.com
Thank you for your time.
p.s. Pixel 5 with Android 12
Last edited: