0

In my app a use a WebView that displays a login screen. Once the user is logged in and the token expires, I reuse the Webview with the cached credentials in order to relogin. The thing is that I want to do this relogin action in the background, without the WebView to be visible. Is it possible?

I tried to put in a transparent Activity but in this case the user can not navigate in the app until this process returns.

Fivos
  • 558
  • 8
  • 19
  • I do not know how you are implementing the `WebView` or refreshing the "logon" with the `WebView`, but as far as I know the object will still be "usable" if its `Visibility` is marked `GONE`. – Barns Jan 03 '18 at 16:12
  • you can call api with users credentials. Share your code how you use webview in app/activity. – Jigar Patel Jan 03 '18 at 16:13
  • also, you can set visibility gone by default and when you got the response from URL then update visibility – Jigar Patel Jan 03 '18 at 16:14
  • Jigar's suggestion of maintaining the credentials would be the better solution. Why keep a `WebView` around if all you need is to stay "logged on"? – Barns Jan 03 '18 at 16:15
  • 1
    I don't want to "play" with the visibility attribute of the `WebView` because during this login process I want the user to be able to navigate in different screens of the app. Also I don't want to store the password of the user locally. Finallly I created a `Service` which contains the WebView inside a `WindowManager` with zero dimensions. – Fivos Jan 04 '18 at 08:50

0 Answers0