14
I have just setup the quickstart google drive sdk application for Android available on this link
I am trying to upload images and then do OCR on them. The sample application on the Android quickstart works fine, but when I try to set the boolean for OCR as true I get the following IOException:
07-29 03:33:01.172: D/OCR_SERVICE(22602): Error 2: 400 Bad Request
07-29 03:33:01.172: D/OCR_SERVICE(22602): {
07-29 03:33:01.172: D/OCR_SERVICE(22602): "code": 400,
07-29 03:33:01.172: D/OCR_SERVICE(22602): "errors": [
07-29 03:33:01.172: D/OCR_SERVICE(22602): {
07-29 03:33:01.172: D/OCR_SERVICE(22602): "domain": "global",
07-29 03:33:01.172: D/OCR_SERVICE(22602): "message": "Bad Request",
07-29 03:33:01.172: D/OCR_SERVICE(22602): "reason": "badRequest"
07-29 03:33:01.172: D/OCR_SERVICE(22602): }
07-29 03:33:01.172: D/OCR_SERVICE(22602): ],
07-29 03:33:01.172: D/OCR_SERVICE(22602): "message": "Bad Request"
07-29 03:33:01.172: D/OCR_SERVICE(22602): }
The interesting thing is I was able to do the OCR about 2 times and then after that I might have modified the source or something and now it isnt working. But I remember the only change I had to make from the quickstart app was changing this line: File file = service.files().insert(body, mediaContent).execute(); to the following:
File file = service.files().insert(body, mediaContent).setOcr(true).execute();
Here is my code:
public class MainActivity extends Activity {
static final int REQUEST_ACCOUNT_PICKER = 1;
static final int REQUEST_AUTHORIZATION = 2;
static final int CAPTURE_IMAGE = 3;
private static Uri fileUri;
private static Drive service;
private GoogleAccountCredential credential;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
credential =