-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathpreferences.repy
61 lines (39 loc) · 1.11 KB
/
preferences.repy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
"""
<Program>
preferences.repy
Variables are mostly from:
http://www.mithril.com.au/android/doc/PreferencesFacade.html
<Date Started>
December 19th, 2013
<Author>
Yanyan Zhuang
<Purpose>
Trying to use the SL4A JSON bridge to read preferences info
"""
dy_import_module_symbols("sensorutil")
def preferences_getall(sl4a_socket):
"""
<Purpose>
Get list of Shared Preference Values
<Arguments>
sl4a_socket - the socket that has been established for
RPC communication
<Return>
{"error":null,"id":0,"result":{"usagetracking":true,
"present_usagetracking":false}}
"""
result = json_rpc(sl4a_socket, "prefGetAll")
return result
def preferences_getvalue(sl4a_socket, key):
"""
<Purpose>
Read a value from shared preferences
<Arguments>
sl4a_socket - the socket that has been established for
RPC communication
key - (String) key of the preference
<Return>
{"error":null,"id":0,"result":true}
"""
result = json_rpc(sl4a_socket, "prefGetValue", key)
return result