I have a Phonegap packaged application that opens a PDF Viewer when a button is pressed. I did it with the FileOpener2 plugin.
When I go back to the application from the PDF Viewer, the result differs depending on Android versions.
In Android 4.* the application stays where it should be before leaving the application. However, in Android 2.3.7 the WebView reloads the application, which is the behaviour I don′t expect.
I already tried changing android:launchmode to singleTask or singleInstance with no success.
How can I avoid page reload when I came back to the Phonegap application?
Thanks in advance!
Update 1
I have modified the Cordova or Phonegap class CordovaWebViewClient which extends WebViewClient with:
@Override
public void onLoadResource(WebView view, String url) {
if (url.equals("file:///android_asset/www/index.html")) {
if (this.firstLoad) {
this.firstLoad = false;
} else {
view.stopLoading();
}
}
However the onLoadResource only gets fired when the application started and not when it resumes from another application.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…