Issue
Recently I got informed that my hybrid Android application doesn't work properly.
The complaint is that when they press the back button on the device, It should go back to a previous webview url.
But It goes back to a url which is like the user pressed back button twice.
So When I took a look at logs
@Override
public void onBackPressed() {
WebBackForwardList URL = webView.copyBackForwardList();
for(int i = 0;i < URL.getSize(); i++){
Log.d("URL list : " + i, URL.getItemAtIndex(i).getUrl());
}
}
And with a simulator, It shows all the list of URL that I've entered.
Which is working properly
D/URL list : 0: //https://www.blabla.com/ //First webview
D/URL list : 1: //https://www.blabla.com/catalog/category/view/id/999/ //Second webview
D/URL list : 2: //https://www.blabla.com/brand/bla.html //Third webview
D/URL list : 3: //https://www.blabla.com/44444444.html //Fourth webview
But with a real device like Samsung Galaxy S6, The third and first Urls are missing.
URL list : 0: //https://www.blabla.com/catalog/category/view/id/999/ //Second webview
URL list : 1: //https://www.blabla.com/44444444.html //Fourth webview
It used to work fine several weeks ago.
Is there anything I missed?
Solution
If the Android device has Chrome version 63.0.3239.111 installed, webview's back-forward-list doesn't work properly. Disable or revert to earlier version of Chrome did the trick for me. However, that solution may not be suitable for everyone. In that case, wait for the next release of Chrome and retest. Good luck either way.
Answered By - New Android Dev
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.