retrofit

i am getting “getTextBeforeCursor on inactive InputConnection” and other warnings and not getting respone from elastic search

血红的双手。 提交于 2019-12-13 05:42:27
问题 I made queries using Retrofit to the elasticsearch server for getting the posts but i am not able to see response in the logcat. I was learning from youtube tutoarial and in the video he gets the response and the post details but i'm getting warnings. I am new to this can anyone help. this is snapshot of my logcat screen And this is my code. public class SearchFragment extends Fragment { private static final String TAG = "SearchFragment"; private static final String BASE_URL = "http://35.232

Robospice retry policy custom implementation

╄→尐↘猪︶ㄣ 提交于 2019-12-13 05:13:45
问题 I need to implement such behaviour. Something like polling remote web server for the some period of time, checking for the condition in response from the server, for example variable condition. To be more specific, consider an example. I need to poll server every 5 secodns during 5 minutes and than fail. There is great feature in Robospice library - RetryPolicy, nearly what I need. I has getRetryCount, getDelayBeforeRetry methods. Exactly what I need to implement my task. But I need to

Header not getting set properly in android-Retrofit

懵懂的女人 提交于 2019-12-13 04:55:57
问题 I'm building an app for sending access-token to the server using Retrofit in android. I don't get any error what I think should set the header correctly is not working so. The header that I want: "Authorization: Bearer facebook <user_access_token>" is the token that I get. Not written here for security purposes. I am using android Retrofit for the purpose with the files as follows: MainActivity.java package com.example.apurva.myapplication; import android.support.v7.app.ActionBarActivity;

Retrofit OutOfMemory exception while loading a files in BASE64 to server

安稳与你 提交于 2019-12-13 04:26:48
问题 I had an OOM exception when tried to load a pdf file in base64 as a field in a model throw Retrofit. I know, than this is not a normal way to upload files, but it's not a third party realisation. How I can fix this kind of a problem? An application crached when I switching off my network connection Failed to allocate a 30544558 byte allocation with 2085152 free bytes and 26MB until OOM @Streaming @POST("/api/order/") fun makeOrder(@Header("Authorization") token: String, @Body order:

HashMap of Retrofit Classes with Dagger

旧巷老猫 提交于 2019-12-13 04:19:23
问题 I'm kinda new to Dependency Injection and I have a doubt. In my app I have a HashMap to store built classes (like a cache) for RetroFit, but now I'm moving to DI with Dagger and I'd like to know how can I achieve the same behaviour. My code: private Map<String, Object> restInstances; public <T> T getRestClient(Class<T> clazz) { T client = null; if ((client = (T) restInstances.get(clazz.getCanonicalName())) != null) { return client; } client = restAdapter.create(clazz); restInstances.put(clazz

Adding authorization header interface android retrofit

烈酒焚心 提交于 2019-12-13 04:01:23
问题 I'm using retrofit library for solving my tasks connected with requests to server. I have got parameters from server developers: URL https://server/v1/message/list Edit this section Method GET Edit this section HTTP Headers Authorization:Bearer $access_token Edit this section URL Params type 0 - for received messages 1 - for sent messages Optional: offset In normal case you should not pass this parameter manually. It uses in previous/next urls, nevertheless it can takes values > 1 for getting

Rxjava retrofit parse api error for user

拥有回忆 提交于 2019-12-13 03:54:24
问题 I'm using RxJava with retrofit in a library project. Everything is working fine, I get the expected result when I request data. @GET(Routes.ME) fun getUserObservable(): Observable<User> From the API class: fun getUser(): Observable<User> { return usersService.getUserObservable() } From the main project which use this library, I get the user like this: api.getUser().observeOn(AndroidSchedulers.mainThread()) .subscribeOn(Schedulers.io()) .subscribe({ user -> println("Get user success : $user")

Retrofit v2.4.0 is not sending the If-Modified-Since header

匆匆过客 提交于 2019-12-13 03:52:22
问题 This may be a very basic question, but I've ran out of ideas. Retrofit v2.4.0 is not sending the If-Modified-Since header, as a result caching is not working. I'm polling the server several times a day to see if is there any updated data, hence the need for If-Modified-Since header. (push notifications may be implemented in a new release) Based on this article, the setup is extremely easy: https://futurestud.io/tutorials/retrofit-2-activate-response-caching-etag-last-modified I've read

Android Retrofit Not working with Laravel API endpoints

♀尐吖头ヾ 提交于 2019-12-13 03:06:55
问题 I've been losing my mind trying to figure out why the end android retrofit is not sending the POST . Here is what I've done. In Laravel I've set up the model, controller, changed the VerifyCsrfToken to allow api. I then set the routes web and api. All was tested through postmen and it works, yet when I try to post through android the code fails. Here are my routs for Laravel Web.php Route::get('/', function () { return view('welcome'); }); Route::resource('/api/student',

How to add TLS v 1.0 and TLS v.1.1 with Retrofit

余生颓废 提交于 2019-12-13 02:55:44
问题 I am using retrofit for data transfer, but few days ago i got problem with ssl certificates: SSL handshake aborted ssl=0x7b93fcc0 error during system call. Connection reset by peer as I understand I need to add tlsv1 certificate inside retrofit... any suggestions how to do it? 回答1: If you are using OkHttp client for Retrofit, you should set up cipher suites like here, just change the TLS version and suits accordingly to your connection type: ConnectionSpec spec = new ConnectionSpec.Builder