R rworner Member Licensed User Longtime User Aug 9, 2013 #1 Does anyone have a code snippet that they can share that shows how to set the time zone? I am using a rooted Android mini PC connected to a TV as a kiosk. The app pulls data from a local server and displays real-time information based on that location. However the clock in the lower corner only matches if it was set to the same time zone that the server is in. I can get the time zone, time zone offset and DST indicator from the server and determine what I need to change the time zone to, however I have not been successful in getting it to change on the device and display the proper time on the system clock. Any help would be greatly appreciated.
Does anyone have a code snippet that they can share that shows how to set the time zone? I am using a rooted Android mini PC connected to a TV as a kiosk. The app pulls data from a local server and displays real-time information based on that location. However the clock in the lower corner only matches if it was set to the same time zone that the server is in. I can get the time zone, time zone offset and DST indicator from the server and determine what I need to change the time zone to, however I have not been successful in getting it to change on the device and display the proper time on the system clock. Any help would be greatly appreciated.
Erel B4X founder Staff member Licensed User Longtime User Aug 11, 2013 #2 Setting the time (or time zone) cannot be done on unrooted devices. I'm not sure that it can be done on rooted devices as well unless you are able to sign your app with the system key. Upvote 0
Setting the time (or time zone) cannot be done on unrooted devices. I'm not sure that it can be done on rooted devices as well unless you are able to sign your app with the system key.
R rworner Member Licensed User Longtime User Aug 11, 2013 #3 Erel said: Setting the time (or time zone) cannot be done on unrooted devices. I'm not sure that it can be done on rooted devices as well unless you are able to sign your app with the system key. Click to expand... I was thinking that the system setting would be held in a database table somewhere - and that I could use sqlite to access the table and update the setting as an option. Would that be possible on a rooted device without knowing the system key? Upvote 0
Erel said: Setting the time (or time zone) cannot be done on unrooted devices. I'm not sure that it can be done on rooted devices as well unless you are able to sign your app with the system key. Click to expand... I was thinking that the system setting would be held in a database table somewhere - and that I could use sqlite to access the table and update the setting as an option. Would that be possible on a rooted device without knowing the system key?
Erel B4X founder Staff member Licensed User Longtime User Aug 11, 2013 #4 Not that I'm familiar with. Upvote 0
warwound Expert Licensed User Longtime User Aug 12, 2013 #5 rworner said: I was thinking that the system setting would be held in a database table somewhere - and that I could use sqlite to access the table and update the setting as an option. Would that be possible on a rooted device without knowing the system key? Click to expand... Have a look here: http://stackoverflow.com/questions/12175647/change-timezone-in-android-device. That post suggests that editing one or two text files can set the timezone on a rooted device. Martin. Upvote 0
rworner said: I was thinking that the system setting would be held in a database table somewhere - and that I could use sqlite to access the table and update the setting as an option. Would that be possible on a rooted device without knowing the system key? Click to expand... Have a look here: http://stackoverflow.com/questions/12175647/change-timezone-in-android-device. That post suggests that editing one or two text files can set the timezone on a rooted device. Martin.
R rworner Member Licensed User Longtime User Aug 12, 2013 #6 warwound said: Have a look here: http://stackoverflow.com/questions/12175647/change-timezone-in-android-device. That post suggests that editing one or two text files can set the timezone on a rooted device. Martin. Click to expand... Thanks, but the post at the bottom says that it is for a unix device not Android. I am still trying different things and am trying getprop/setprop. With getprop I found:[persist.sys.timezone]: America/New_York I tried to use setprop: P.Shell("setprop","persist.sys.timezone","America/Chicago") but got this error message: Parsing code. 0.02 Compiling code. Error Error compiling program. Error description: Cannot cast type: {Type=String,Rank=0} to: {Type=String,Rank=1} Occurred on line: 56 P.Shell("setprop","persist.sys.timezone","America/Chicago") Word: persist.sys.timezone Any suggestions? Upvote 0
warwound said: Have a look here: http://stackoverflow.com/questions/12175647/change-timezone-in-android-device. That post suggests that editing one or two text files can set the timezone on a rooted device. Martin. Click to expand... Thanks, but the post at the bottom says that it is for a unix device not Android. I am still trying different things and am trying getprop/setprop. With getprop I found:[persist.sys.timezone]: America/New_York I tried to use setprop: P.Shell("setprop","persist.sys.timezone","America/Chicago") but got this error message: Parsing code. 0.02 Compiling code. Error Error compiling program. Error description: Cannot cast type: {Type=String,Rank=0} to: {Type=String,Rank=1} Occurred on line: 56 P.Shell("setprop","persist.sys.timezone","America/Chicago") Word: persist.sys.timezone Any suggestions?
R rworner Member Licensed User Longtime User Aug 13, 2013 #7 Erel said: Not that I'm familiar with. Click to expand... I am still trying different things and am trying getprop/setprop. With getprop I found:[persist.sys.timezone]: America/New_York I tried to use setprop: P.Shell("setprop","persist.sys.timezone","America/Chicago") but got this error message: Parsing code. 0.02 Compiling code. Error Error compiling program. Error description: Cannot cast type: {Type=String,Rank=0} to: {Type=String,Rank=1} Occurred on line: 56 P.Shell("setprop","persist.sys.timezone","America/Chicago") Word: persist.sys.timezone Any suggestions? Upvote 0
Erel said: Not that I'm familiar with. Click to expand... I am still trying different things and am trying getprop/setprop. With getprop I found:[persist.sys.timezone]: America/New_York I tried to use setprop: P.Shell("setprop","persist.sys.timezone","America/Chicago") but got this error message: Parsing code. 0.02 Compiling code. Error Error compiling program. Error description: Cannot cast type: {Type=String,Rank=0} to: {Type=String,Rank=1} Occurred on line: 56 P.Shell("setprop","persist.sys.timezone","America/Chicago") Word: persist.sys.timezone Any suggestions?
Erel B4X founder Staff member Licensed User Longtime User Aug 13, 2013 #8 The second parameter should be an array: Code: P.Shell("setprop",Array As String("persist.sys.timezone","America/Chicago"), null, null) Upvote 0
The second parameter should be an array: Code: P.Shell("setprop",Array As String("persist.sys.timezone","America/Chicago"), null, null)