Hi all,
I am looking for a basic sample that uses 2 activities and a service module. The activities will request the service module to:-
I don't want each activity to have individual database connection objects, because when switching from one activity to another I will have to close the connection with the database, then on the new activity I will have to create a new connection object and then connect to the database. All these will slow down the apps performance.
What I am looking for is that when my app starts the service module should also start and will connect to the database and will be ready to serve the requests from other activity modules of my app. When my app quits, the service would close the connection to the databse and the service should also be destroyed. So the connection to the database is established only once (I may have to handle connection timeout too), the database connection is closed once I quit the app.
I don't know whether the above said is the right approach or not OR whether this can be achieved using B4A.
I understand that, from the activities I should use Result = CallSubDelayed2(ServiceModuleName, SubNameToBeCalled,ParameterToBePassed). It will return the data as a list/list of Maps etc
I searched the forum but could not locate anything similar to what I need when it comes to a service module and database.
A basic skeleton of a service module would be fine. A push in the right direction will be appreciated. This will be useful for newbies like me.
Regards
Anser
I am looking for a basic sample that uses 2 activities and a service module. The activities will request the service module to:-
- return the results of queries
- do the inserts new records to the database
- updates the records in the database etc etc.
I don't want each activity to have individual database connection objects, because when switching from one activity to another I will have to close the connection with the database, then on the new activity I will have to create a new connection object and then connect to the database. All these will slow down the apps performance.
What I am looking for is that when my app starts the service module should also start and will connect to the database and will be ready to serve the requests from other activity modules of my app. When my app quits, the service would close the connection to the databse and the service should also be destroyed. So the connection to the database is established only once (I may have to handle connection timeout too), the database connection is closed once I quit the app.
I don't know whether the above said is the right approach or not OR whether this can be achieved using B4A.
I understand that, from the activities I should use Result = CallSubDelayed2(ServiceModuleName, SubNameToBeCalled,ParameterToBePassed). It will return the data as a list/list of Maps etc
I searched the forum but could not locate anything similar to what I need when it comes to a service module and database.
A basic skeleton of a service module would be fine. A push in the right direction will be appreciated. This will be useful for newbies like me.
Regards
Anser