Submit to Google Form from Android? -


i submit string google form android app. seems achieved in this thread since apache http client removed android 6.0.

it suggested use okhttp in this thread okhttp has since been updated , formencodingbuilder class gone. up-to-date way submit google form?

you can use : okhttp3.formbody instead of formencodingbuilder.

edit : this

okhttpclient client = new okhttpclient(); formbody body = new formbody.builder()      .add("your_param_1", "your_value_1")      .add("your_param_2", "your_value_2")      .build(); request request = new request.builder()      .url("http://my.wonderfull.url/to/post")      .post(body)      .build(); response response = client.newcall(request).execute(); 

if want post json content replace frombody requestbody:

requestbody body = requestbody.create( json, json ); 

edit 2:

the url use (this 1 mine):

https://docs.google.com/forms/d/1k96scctc_24b6jo9fs4h_ml-fvkhcmelgjuzowskwu4/formresponse 

and have find name of form inputs looking @ source code of form, name starts entry. following number:

<input name="entry.361168075" value="" class="ss ...... 

so formbody looks this:

formbody body = new formbody.builder()           .add( "entry.361168075", "red" )           .build(); 

i made full workable example there : http://blog.quidquid.fr/2016/01/post-from-java-to-a-google-docs-form/


Comments

Popular posts from this blog

authentication - Mongodb revoke acccess to connect test database -

r - Update two sets of radiobuttons reactively - shiny -

ios - Realm over CoreData should I use NSFetchedResultController or a Dictionary? -