<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>Hi Danny,</div><div><br></div><div>thanks a lot for the explanation,- it worked fine, and this is very cool!</div><div>But &nbsp;you know, the reason I wanted to look into the source was that as a new and proud I-never-thought-I'd-buy-something-like-that-in-my-life owner of an Android smartphone, I wanted to look into how Moby interfaces with Android and what one could do using racket to create an Android app.</div><div><br></div><div>Specifically, I wanted to see if there'd be some way to configure how (from what provider) and how often etc. to retrieve location updates (as described in the Android docs on the "obtaining user location" page,&nbsp;<a href="http://developer.android.com/guide/topics/location/obtaining-user-location.html">http://developer.android.com/guide/topics/location/obtaining-user-location.html</a>).</div><div>I saw Moby has an&nbsp;<span class="Apple-style-span" style="color: rgb(38, 38, 128); font-family: monospace; "><a href="http://planet.racket-lang.org/#(def._((planet._moby-lang..rkt._(dyoo._moby..plt._2._36)._src)._on-location-change))" class="RktValLink" pltdoc="x" style="text-decoration: none; color: blue; ">on-location-change</a>&nbsp;</span>handler, but I was wondering whether it was possible to access the underlying Android methods somehow (or for starters, to find out with what parameters Moby might "call" them), if only for the purpose of saving battery...</div><div>Could you perhaps explain a little bit?</div><div><br></div><div>From your reply, I'm also not sure that you are going to keep / develop further the Android-related code? And just as an aside, if Android remained a main target... would there (still, or again, or whatever :-) ) help be welcome for Android-specific stuff (like the location thing)?</div><div><br></div><div>Ciao,</div><div>Sigrid</div><div><br></div><br><div><div>Am 25.10.2010 um 22:23 schrieb Danny Yoo:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div>Hi Sigrid,<br><br>I'm revamping Moby; it's being mostly subsumed by my js-vm PLaneT package.<br><br><br>To install, evaluate the following at your DrRacket REPL:<br><br> &nbsp;&nbsp;(require (planet dyoo/js-vm:1:2/info))<br><br>This will install js-vm and the tools.<br><br>Once that's installed, restart DrRacket.<br><br>There should now be the following menu options under the Racket submenu:<br><br> &nbsp;&nbsp;* Create Javascript Package<br> &nbsp;&nbsp;* Run Javascript in Browser<br><br><br>The first will create a .zip package at a specified place, and the<br>latter will start up a web server and serve a page that runs the<br>currently-edited program.<br><br>As an example, enter the following as "test.rkt":<br><br>;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;<br>#lang planet dyoo/js-vm:1:2<br><br>(printf "hello world\n")<br>(check-expect (* 3 4 5) 60)<br>(current-seconds)<br>(image-url "<a href="http://racket-lang.org/logo.png">http://racket-lang.org/logo.png</a>")<br>(check-expect<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(big-bang 0<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(on-tick add1 1)<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(stop-when (lambda (x) (= x 10))))<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;10)<br>"last line"<br>;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;<br><br>Save the file, and then press Run. &nbsp;The interactions should evaluate<br>up to the image-url expression, after which case the repl will error<br>out with "Must be evaluated within Javascript". &nbsp;As long as your<br>program is not accessing anything Javascript-specific, you should<br>still be able to run and test your programs under DrRacket. &nbsp;(big-bang<br>is currently a Javascript-specific function.)<br><br>Next, choose "Run Javascript in Browser". DrRacket should bring up a<br>status window, as well as opening up a web browser with the currently<br>running program.<br><br>Finally, choose "Create Javascript Package". &nbsp;DrRacket will prompt for<br>a place to put the zip file, and then generate a .zip archive; its<br>contents will be the files that were served under "Run Javascript in<br>Browser."<br><br><br><br>The falling ball example will be this:<br><br>;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;<br><br>#lang planet dyoo/js-vm:1:2<br><br>(define-struct world (radius y))<br><br>;; The dimensions of the screen:<br>(define WIDTH 320)<br>(define HEIGHT 480)<br><br>;; The radius of the red circle.<br>(define RADIUS 15)<br><br>;; The world is the distance from the top of the screen.<br>(define INITIAL-WORLD (make-world RADIUS 0))<br><br>;; tick: world -&gt; world<br>;; Moves the ball down.<br>(define (tick w)<br> &nbsp;(make-world RADIUS (+ (world-y w) 5)))<br><br><br>;; hits-floor?: world -&gt; boolean<br>;; Returns true when the distance reaches the screen height.<br>(define (hits-floor? w)<br> &nbsp;(&gt;= (world-y w) HEIGHT))<br><br>;; We have some simple test cases.<br>(check-expect (hits-floor? (make-world RADIUS 0)) false)<br>(check-expect (hits-floor? (make-world RADIUS HEIGHT)) true)<br><br>;; render: world -&gt; scene<br>;; Produces a scene with the circle at a height described by the world.<br>(define (render w)<br> &nbsp;(place-image (circle RADIUS "solid" "red") (/ WIDTH 2) (world-y w)<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(empty-scene WIDTH HEIGHT)))<br><br>;; Start up a big bang, 15 frames a second.<br>(check-expect (big-bang INITIAL-WORLD<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(on-tick tick 1/15)<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(to-draw render)<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(stop-when hits-floor?))<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(make-world 15 480))<br><br><br>;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;<br><br><br>As you might notice, some of the names of symbols have changed from<br>Moby 2. &nbsp;I'll be releasing documentation for the new system shortly.<br></div></blockquote></div><br></body></html>