Skip to content

Instantly share code, notes, and snippets.

@yohfee
Created November 22, 2010 06:23
Show Gist options
  • Save yohfee/709602 to your computer and use it in GitHub Desktop.
Save yohfee/709602 to your computer and use it in GitHub Desktop.
require 'android'
require 'webrick'
pic = '/sdcard/snapshot.jpg'
droid = Android.new
httpd = WEBrick::HTTPServer.new(:Port => 9998)
httpd.mount_proc('/') do |req, res|
return unless req.path == '/'
droid.cameraCapturePicture(pic)
res['Content-Type'] = 'image/jpeg'
res.body = open(pic).read
end
httpd.start
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment