-
Notifications
You must be signed in to change notification settings - Fork 35
Expand file tree
/
Copy pathtinywebdb.html
More file actions
220 lines (220 loc) · 7.86 KB
/
Copy pathtinywebdb.html
File metadata and controls
220 lines (220 loc) · 7.86 KB
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta content="App Inventor for Android" name="description" />
<meta content="Android, Blocks App Inventor, Mobile, Phone, IDE" name="keywords" />
<title>
TinyWebDB - App Inventor for Android
</title>
<link href="/static/images/appinventor-16.png" rel="SHORTCUT ICON" type="image/ico" />
<link href="/static/images/appinventor-16.png" rel="icon" type="image/png" />
<link href="/static/css/appinventor.css" rel="stylesheet" />
<script src="http://www.google.com/js/gweb/analytics/autotrack.js">
</script>
<script>
var tracker = new gweb.analytics.AutoTrack({
profile: 'UA-5856106-2'
});
</script>
<script language = "JavaScript" src="/static/scripts/HeaderAndFooter.js"></script>
<style>
img.c2 {border-width:0}
div.c1 {clear:both;}
</style>
</head>
<body>
<script language = "JavaScript">createHeader('<div id="navigation-breadcrumb"> <a href="/learn/">Learn</a> > <a href="/learn/reference/">Reference</a> > TinyWebDB > ');</script><br>
<div id="aiac">
<div class="main-container">
<div class="customhr customhr-gray">
</div>
<div class="content">
<div class="content-body">
<div class="learn-page">
<h1>
Creating a Custom TinyWebDB Service
</h1>
<p>
<span class="ButtonText">
TinyWebDB
</span>
is an App Inventor component that allows
you to store data persistently in a database on the web. Because the data is stored
on the web instead of a particular phone,
<span class="ButtonText">
TinyWebDB
</span>
can be used to facilitate communication between phones and apps (e.g., multi-player
games).
</p>
<p>
By default, the
<span class="ButtonText">
TinyWebDB
</span>
component stores data on
a test service provided by App Inventor,
<a href="http://appinvtinywebdb.appspot.com/">
http://appinvtinywebdb.appspot.com/
</a>
. This
service is helpful for testing, but it is shared by all App Inventor users, and it
has a limit of 1000 entries. If you use it, your data will be overwritten
eventually.
</p>
<p>
For most apps you write, you'll want to create a custom web service that isn't
shared with other App Inventor apps and programmers. You need not be a programmer
to do so-- just follow the instructions below and you'll have your own service
within minutes.
</p>
<p>
To create your own web service, follow these instructions:
</p>
<ul>
<li>
Download App Engine for Python at
<a href="http://code.google.com/appengine/">
http://code.google.com/appengine/
</a>
. After installing it, run the
GoogleAppEngineLauncher by clicking its icon.
</li>
<li>
Download this
<a href="tinywebdbassets/customtinywebdb.zip">
sample code
</a>
. It
is a zip file containg the source code for your custom tinywebdb web service
<br />
</li>
<li>
Unzip the downloaded zip file. It will create a folder named
<span class="ButtonText">
customtinywebdb
</span>
. You can rename it if you want.
<br />
</li>
<li>
In the GoogleAppEngineLauncher, choose
<span class="ButtonText">
File | Add
Existing Application
</span>
. Browse to set the Path to the
<span class="ButtonText">
customtinywebdb
</span>
folder you just unzipped. Then click the Run
button. This will launch a test web service that runs on your local machine.
</li>
<li>
You can test the service by opening a browser and entering "localhost:8080" as
the URL. You'll see the web page interface to your web service. The end-goal of
this service is to communicate with a mobile app created with App Inventor. But the
service provides a web page interface to the service to help programmers with
debugging. You can invoke the get and store operations by hand, view the existing
entries, and also delete individual entries
</li>
<li>
Your app is not yet on the web, and thus not yet accessible to an App Inventor
app. To get it there, you need to upload it to Google's App Engine servers.
<ul>
<li>
In the GoogleAppEngineLauncher, choose
<span class="ButtonText">
Dashboard
</span>
. Enter your Google account information and you'll
be taken to an App Engine dashboard.
</li>
<li>
Choose
<span class="ButtonText">
Create an Application
</span>
. You'll need
to specify a globally unique Application Identifier. Remember the Application
identifier as you'll need it later. Provide a name to your app and click
<span class="ButtonText">
Create Application
</span>
to submit. If your
Identifier was unique, you now have a new, empty app on Google's servers.
</li>
<li>
Open a text editor on your local computer and open the file
<span class="ButtonText">
app.yaml
</span>
within the
<span class="ButtonText">
customtinywebdb
</span>
folder you unzipped. Modify the first line
so that the application matches the application identifier you set at Google.
</li>
<li>
In GoogleAppEngineLauncher, choose
<span class="ButtonText">
Deploy
</span>
and follow the steps for deploying your app.
</li>
</ul>
</li>
<li>
Test to see if your app is running on the web. In a browser, enter
myapp.appspot.com, only substitute your application identifier for "myapp". The app
should look the same as when you ran it on the local test server. Only now, it's on
the web and you can access it from your App Inventor for Android app.
</li>
</ul>
<p>
Your App Inventor apps can store and retrieve data using your new service. Just do
the following:
</p>
<ul>
<li>
Drag in a TinyWebDB component into the Component Designer.
</li>
<li>
Modify the ServiceURL property from the default
<a href="http://appinvtinywebdb.appspot.com/">
http://appinvtinywebdb.appspot.com/
</a>
to
your web service.
</li>
<li>
Any StoreValue operations (blocks) will store data at your service, and any
GetValue operations will retrieve from your service.
<br />
<br />
<br />
</li>
</ul>
</div>
</div>
</div>
<div class="footer">
<script language = "JavaScript">createFooter();</script><br>
<div class="footer-lastupdate">
<script>
if (document.lastModified != '') {
var m = "Page last updated: " + document.lastModified;
var p = m.length-8;
document.writeln("<center>");
document.write(m.substring(p, 0));
document.writeln("<\/center>");
}
</script>
</div>
</div>
</div>
</div>
</body>
</html>