Sub Camera1_PictureTaken (Data() As Byte)
Dim dir As String = File.DirRootExternal
camEx.SavePictureToFile(Data, dir, fileName)
camEx.StartPreview 'restart preview
'send a broadcast intent to the media scanner to force it to scan the saved file.
Dim Phone As Phone
Dim i As Intent
i.Initialize("android.intent.action.MEDIA_SCANNER_SCAN_FILE", "file://" & File.Combine(dir,fileName))
Phone.SendBroadcastIntent(i)
save_and_rotate(dir, fileName)
Dim NV As Map
NV.Initialize
NV.Put("width", parameters.Get("width"))
NV.Put("height", parameters.Get("height"))
NV.Put("action", "upload")
Dim files As List
files.Initialize
Dim fd As FileData
fd.Initialize
fd.dir = File.DirRootExternal
fd.fileName = fileName
fd.KeyName = "fileUpload"
fd.ContentType = "application/octet-stream"
files.Add(fd)
hc.Initialize("hc")
Dim req As HttpRequest
' req = MultipartPost.CreatePostRequest("http://rete.condorinformatique.com/upload.php", NV, files)
req = MultipartPost.CreatePostRequest("http://ises.senioresitalia.org/upload.php", NV, files)
hc.Execute(req, 1)
End Sub
Sub hc_ResponseError (Response As HttpResponse, Reason As String, StatusCode As Int, TaskId As Int)
If Response <> Null Then
Log("error: " & Response.GetString("utf8") & " " & StatusCode)
End If
Log("error: " & Reason & " " & StatusCode)
End Sub
Sub hc_ResponseSuccess (Response As HttpResponse, TaskId As Int)
out.InitializeToBytesArray(0) ' I expect less than 2000 bytes here
Response.GetAsynchronously("Response", out, True, TaskId)
Log("response: " & Response.GetString("utf8") )
End Sub
Sub Response_StreamFinish (Success As Boolean, TaskId As Int)
Dim another_buffer () As Byte
another_buffer = out.ToBytesArray
Log (BytesToString(another_buffer, 0, another_buffer.Length, "UTF8"))
End Sub