HTTP Volley headers in Android 8.0

元气小坏坏 提交于 2019-12-24 00:48:30

问题


Since Android 8.0 has been released, I have problem with authorization header.

Is there any other way to add header into Volley request?

This doesn't work properly on the last Android version.

@override
public Map<String, String> getHeaders() throws AuthFailureError {
    Map<String, String> params = new HashMap<String, String>();
    params.put("x-api-key", App.apiAuth);
    return params;
}

Update:

It's work fine on all devices but Android 8.0. In Android studio simulator for 8.0 it works too.

So, problem is just with Android Oreo. It's using compile 'com.android.volley:volley:1.1.0-rc1' Device is Pixel 1.

App works fine when I disable authorization from API, but with authorization on the API side I have to add authorization header in the app, and app isn't able to download anything from the API. That's the problem, and it occurs only on Android 8.0.

Thanks in advance

来源:https://stackoverflow.com/questions/47137308/http-volley-headers-in-android-8-0

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!