I have an application that among other things (which work perfectly)
I need a service that runs every three minutes, perform its function (originally was to obtain GPS data). Within a range of hours (eg 8 to 20 hours).
So many problems encountered I decided to make a small program to test the use of services.
Of course I read and read http://www.b4x.com/forum/basic4andr...-process-activities-life-cycle.html#post37980
And I found loss values Global Process Variables.
it can be seen that there is NO quotation marks in the LAST insert.
Besides the database is closed.
Any help is welcome
Regards,
Edgar
I need a service that runs every three minutes, perform its function (originally was to obtain GPS data). Within a range of hours (eg 8 to 20 hours).
So many problems encountered I decided to make a small program to test the use of services.
Of course I read and read http://www.b4x.com/forum/basic4andr...-process-activities-life-cycle.html#post37980
Process variables - These variables live as long as the process lives.
You should declare these variables inside sub Process_Globals.
This sub is called once when the process starts (this is true for all activities, not just the first activity).
These variables are the only "public" variables. Which means that they can be accessed from other modules as well.
However, not all types of objects can be declared as process variables.
And I found loss values Global Process Variables.
HTML:
LogCat connected to: B4A-Bridge: samsung GT-S5830M-359971046757729
--------- beginning of /dev/log/system
--------- beginning of /dev/log/main
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Service (service1) Create **
** Service (service1) Start **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
Connected to B4A-Bridge (Bluetooth)
Installing file.
PackageAdded: package:test.service
** Activity (main) Create, isFirst = true **
Main - FirstTime
Main.FirstTime -- Database file copied
2013-02-23 10:37:41 Before of write in the database: INSERT INTO sg_t_log (programa, fecha_hora, info) values ('Main.FirstTime','2013-02-23 10:37:41', 'First Time of the Program')
First start of the service
** Activity (main) Resume **
Main.Resume
** Activity (main) Pause, UserClosed = true **
Main.Pause
** Service (work) Create **
2013-02-23 10:37:41 Before of write in the database: INSERT INTO sg_t_log (programa, fecha_hora, info) values ('Service.Work','2013-02-23 10:37:41', 'Service_Create')
** Service (work) Start **
2013-02-23 10:37:41 Before of write in the database: INSERT INTO sg_t_log (programa, fecha_hora, info) values ('Service.Work','2013-02-23 10:37:41', 'Service_Start')
Partial wakeLock already held.
Next Schedule : 2013-02-23 10:40:42
2013-02-23 10:37:42 Before of write in the database: INSERT INTO sg_t_log (programa, fecha_hora, info) values ('Service.Work','2013-02-23 10:37:42', 'Next Schedule : 2013-02-23 10:40:42')
Service.Work.Check_Running_Programs --- Begin
Service.Work.Check_Running_Programs --- End
** Service (work) Destroy **
2013-02-23 10:37:42 Before of write in the database: INSERT INTO sg_t_log (programa, fecha_hora, info) values ('Service.Work','2013-02-23 10:37:42', 'Service_Destroy')
** Activity (showdata) Create, isFirst = true **
** Activity (showdata) Resume **
** Activity (showdata) Pause, UserClosed = false **
** Service (work) Create **
2013-02-23 10:40:42 Before of write in the database: INSERT INTO sg_t_log (programa, fecha_hora, info) values ('Service.Work','2013-02-23 10:40:42', 'Service_Create')
** Service (work) Start **
2013-02-23 10:40:42 Before of write in the database: INSERT INTO sg_t_log (programa, fecha_hora, info) values ('Service.Work','2013-02-23 10:40:42', 'Service_Start')
Partial wakeLock already held.
Next Schedule : 2013-02-23 10:43:42
2013-02-23 10:40:42 Before of write in the database: INSERT INTO sg_t_log (programa, fecha_hora, info) values ('Service.Work','2013-02-23 10:40:42', 'Next Schedule : 2013-02-23 10:43:42')
Service.Work.Check_Running_Programs --- Begin
Service.Work.Check_Running_Programs --- End
** Service (work) Destroy **
2013-02-23 10:40:42 Before of write in the database: INSERT INTO sg_t_log (programa, fecha_hora, info) values ('Service.Work','2013-02-23 10:40:42', 'Service_Destroy')
** Service (work) Create **
2013-02-23 10:43:42 Before of write in the database: INSERT INTO sg_t_log (programa, fecha_hora, info) values ('Service.Work','2013-02-23 10:43:42', 'Service_Create')
** Service (work) Start **
2013-02-23 10:43:42 Before of write in the database: INSERT INTO sg_t_log (programa, fecha_hora, info) values ('Service.Work','2013-02-23 10:43:42', 'Service_Start')
Partial wakeLock already held.
Next Schedule : 2013-02-23 10:46:42
2013-02-23 10:43:42 Before of write in the database: INSERT INTO sg_t_log (programa, fecha_hora, info) values ('Service.Work','2013-02-23 10:43:42', 'Next Schedule : 2013-02-23 10:46:42')
Service.Work.Check_Running_Programs --- Begin
Service.Work.Check_Running_Programs --- End
** Service (work) Destroy **
2013-02-23 10:43:42 Before of write in the database: INSERT INTO sg_t_log (programa, fecha_hora, info) values ('Service.Work','2013-02-23 10:43:42', 'Service_Destroy')
** Service (work) Create **
2013-02-23 10:46:42 Before of write in the database: INSERT INTO sg_t_log (programa, fecha_hora, info) values ('Service.Work','2013-02-23 10:46:42', 'Service_Create')
** Service (work) Start **
2013-02-23 10:46:42 Before of write in the database: INSERT INTO sg_t_log (programa, fecha_hora, info) values ('Service.Work','2013-02-23 10:46:42', 'Service_Start')
Partial wakeLock already held.
Next Schedule : 2013-02-23 10:49:42
2013-02-23 10:46:42 Before of write in the database: INSERT INTO sg_t_log (programa, fecha_hora, info) values ('Service.Work','2013-02-23 10:46:42', 'Next Schedule : 2013-02-23 10:49:42')
Service.Work.Check_Running_Programs --- Begin
Service.Work.Check_Running_Programs --- End
** Service (work) Destroy **
2013-02-23 10:46:42 Before of write in the database: INSERT INTO sg_t_log (programa, fecha_hora, info) values ('Service.Work','2013-02-23 10:46:42', 'Service_Destroy')
** Service (work) Create **
2013-02-23 10:49:42 Before of write in the database: INSERT INTO sg_t_log (programa, fecha_hora, info) values ('Service.Work','2013-02-23 10:49:42', 'Service_Create')
** Service (work) Start **
2013-02-23 10:49:42 Before of write in the database: INSERT INTO sg_t_log (programa, fecha_hora, info) values ('Service.Work','2013-02-23 10:49:42', 'Service_Start')
Partial wakeLock already held.
Next Schedule : 2013-02-23 10:52:42
2013-02-23 10:49:42 Before of write in the database: INSERT INTO sg_t_log (programa, fecha_hora, info) values ('Service.Work','2013-02-23 10:49:42', 'Next Schedule : 2013-02-23 10:52:42')
Service.Work.Check_Running_Programs --- Begin
Service.Work.Check_Running_Programs --- End
** Service (work) Destroy **
2013-02-23 10:49:42 Before of write in the database: INSERT INTO sg_t_log (programa, fecha_hora, info) values ('Service.Work','2013-02-23 10:49:42', 'Service_Destroy')
** Service (work) Create **
2013-02-23 10:52:42 Before of write in the database: INSERT INTO sg_t_log (programa, fecha_hora, info) values ('Service.Work','2013-02-23 10:52:42', 'Service_Create')
** Service (work) Start **
2013-02-23 10:52:42 Before of write in the database: INSERT INTO sg_t_log (programa, fecha_hora, info) values ('Service.Work','2013-02-23 10:52:42', 'Service_Start')
Partial wakeLock already held.
Next Schedule : 2013-02-23 10:55:42
2013-02-23 10:52:42 Before of write in the database: INSERT INTO sg_t_log (programa, fecha_hora, info) values ('Service.Work','2013-02-23 10:52:42', 'Next Schedule : 2013-02-23 10:55:42')
Service.Work.Check_Running_Programs --- Begin
Service.Work.Check_Running_Programs --- End
** Service (work) Destroy **
2013-02-23 10:52:42 Before of write in the database: INSERT INTO sg_t_log (programa, fecha_hora, info) values ('Service.Work','2013-02-23 10:52:42', 'Service_Destroy')
** Service (work) Create **
** Service (work) Start **
Service.Work.Check_Running_Programs --- Begin
INSERT INTO sg_t_data (fecha_hora, info) values (2013-02-23 10:55:42, USER PID PPID VSIZE RSS WCHAN PC NAME
root 1 0 372 224 ffffffff 00000000 S /init
root 2 0 0 0 ffffffff 00000000 S kthreadd
root 3 2 0 0 ffffffff 00000000 S ksoftirqd/0
root 4 2 0 0 ffffffff 00000000 S watchdog/0
root 5 2 0 0 ffffffff 00000000 S events/0
root 6 2 0 0 ffffffff 00000000 S khelper
root 9 2 0 0 ffffffff 00000000 S async/mgr
root 12 2 0 0 ffffffff 00000000 S suspend
root 226 2 0 0 ffffffff 00000000 S sync_supers
root 228 2 0 0 ffffffff 00000000 S bdi-default
root 230 2 0 0 ffffffff 00000000 S kblockd/0
root 237 2 0 0 ffffffff 00000000 S pmu_events/0
root 257 2 0 0 ffffffff 00000000 S kseriod
root 272 2 0 0 ffffffff 00000000 S kmmcd
root 278 2 0 0 ffffffff 00000000 S DevOutput_wq/0
root 381 2 0 0 ffffffff 00000000 S khungtaskd
root 382 2 0 0 ffffffff 00000000 D kswapd0
root 384 2 0 0 ffffffff 00000000 S aio/0
root 385 2 0 0 ffffffff 00000000 S crypto/0
root 404 2 0 0 ffffffff 00000000 S lcd_wq/0
root 407 2 0 0 ffffffff 00000000 S CSL_LCDC/0
root 411 2 0 0 ffffffff 00000000 S lcd_periodic_re
root 610 2 0 0 ffffffff 00000000 S taos_wq
root 611 2 0 0 ffffffff 00000000 S prox_wq
root 638 2 0 0 ffffffff 00000000 S charing_current
root 643 2 0 0 ffffffff 00000000 S rx_ether_queue
root 650 2 0 0 ffffffff 00000000 S usb_mass_storag
root 668 2 0 0 ffffffff 00000000 S check_ic_wq/0
root 675 2 0 0 ffffffff 00000000 S irq/126-melfas-
root 699 2 0 0 ffffffff 00000000 S kstriped
root 718 2 0 0 ffffffff 00000000 S binder
root 729 2 0 0 ffffffff 00000000 S ipc-wq/0
root 734 2 0 0 ffffffff 00000000 S cmd_wq/0
root 735 2 0 0 ffffffff 00000000 S rsp_wq/0
root 736 2 0 0 ffffffff 00000000 S notify_wq/0
root 751 2 0 0 ffffffff 00000000 S cmd_wq/0
root 752 2 0 0 ffffffff 00000000 S rsp_wq/0
root 753 2 0 0 ffffffff 00000000 S notify_wq/0
root 759 2 0 0 ffffffff 00000000 S v3d_thread
root 766 2 0 0 ffffffff 00000000 S AudioCtrlWq/0
root 794 1 304 148 ffffffff 00000000 S /sbin/ueventd
root 1058 2 0 0 ffffffff 00000000 S mmcqd
root 1316 1 416 260 ffffffff 00000000 S /init
system 1318 1316 848 284 ffffffff 00000000 S /system/bin/servicemanager
media 1319 1316 8008 1088 ffffffff 00000000 S /system/bin/playsound
root 1320 1316 3916 440 ffffffff 00000000 S /system/bin/vold
root 1321 1316 4244 576 ffffffff 00000000 S /system/bin/netd
root 1322 1316 712 260 ffffffff 00000000 S /system/bin/debuggerd
radio 1323 1316 9276 992 ffffffff 00000000 S /system/bin/rild
system 1324 1316 1056 312 ffffffff 00000000 S /system/bin/npsmobex
root 1325 1316 123908 15224 ffffffff 00000000 S zygote
media 1326 1316 38704 3380 ffffffff 00000000 S /system/bin/mediaserver
system 1327 1316 14032 1004 ffffffff 00000000 S /system/bin/mtvmfservice
bluetooth 1328 1316 1328 600 ffffffff 00000000 S /system/bin/dbus-daemon
root 1329 1316 864 364 ffffffff 00000000 S /system/bin/installd
keystore 1330 1316 1788 292 ffffffff 00000000 S /system/bin/keystore
compass 1331 1316 2896 320 ffffffff 00000000 S /system/bin/orientationd
compass 1332 1316 860 312 ffffffff 00000000 S /system/bin
Work.Check_Running_Programs --- Database is NOT open
Service.Work.Check_Running_Programs --- End
** Service (work) Destroy **
it can be seen that there is NO quotation marks in the LAST insert.
Besides the database is closed.
Any help is welcome
Regards,
Edgar