Android Picasso Authorization header not working -
i'am trying addheader picasso request, i've searched , followed suggested do, in case adding interceptor.but it's not working , not giving error.
new picasso.builder(mcontext).downloader(restasynchttpclient.getokhttpdownloader(header)).build() .load("https://myurl.jpg").into(mmediaimageview);
and okhttpdownload:
public static okhttpdownloader getokhttpdownloader(final hashmap<string, string> headers) { okhttpclient okhttpclient = mhttpclient.clone(); okhttpclient.interceptors().add(new interceptor() { @override public response intercept(chain chain) throws ioexception { builder builder = chain.request().newbuilder(); if (!headers.isempty()) (entry<string, string> entry : headers.entryset()) builder.addheader(entry.getvalue(), entry.getkey()); request newrequest = builder.build(); return chain.proceed(newrequest); } }); return new okhttpdownloader(okhttpclient); }
i've copied header , request , tried in postman app , worked, i've implemented onimageloadfailed it's not triggered can't understand.
@override public void onimageloadfailed(picasso picasso, uri uri, exception exception) { string test = "sad"; }
the problem wasn't picasso or okhhtp @ should, problem made mistake adding header putting "my token" "authorization" instead of "authorization" "my token. not delete post because contains snippet of "how add header picasso"
Comments
Post a Comment