java - No HTTP request is send from retrofit /Android/ -
i'm trying send data api android project using retrofit. seems work without errors no http request leaves application. can confirm wireshark screening , api console log. here example pseudo code of parts of application:
// sample code findviewbyid(r.id.submit_btn).setonclicklistener(this); @override public void onclick(view v) { int = v.getid(); if (i == r.id.submit_btn){ intent intent = new intent(currentactivity.this, homeactivity.class); // myobj class storing several values , defined in separate class myobj obj = new myobj(** attributes here **); retrofit retrofit = new retrofit.builder() .baseurl("http://api.address") .client(new okhttpclient()) .addconverterfactory(gsonconverterfactory.create()) .build(); myapi api = retrofit.create(myapi.class); call<void> upload = api.newobj(obj); startactivity(intent); finish(); }
not sure i'm missing. ideas?
p.s. here dependencies used app part:
compile 'com.squareup.retrofit2:retrofit:2.1.0' compile 'com.google.code.gson:gson:2.6.2' compile 'com.squareup.retrofit2:converter-gson:2.1.0' compile 'com.squareup.okhttp3:okhttp:3.0.1'
this prepares request, not sends it.
call<void> upload = api.newobj(obj);
try making upload.enqueue()
Comments
Post a Comment