-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PDF disappears when app is put in background on Android #9
Comments
I could also reproduce the issue in the above sample application with an URL of |
As I briefly mentioned above, I can't reproduce the problem in the demo app in this repository — but I don't at all see what the difference could be. |
For completeness, I should also note that I also experienced the same symptom when using |
Hey, I did a quick check and you are right. The issue does not appear on the demo but it does appear on the demo-vue. |
I've been back looking at this. I see that DImuthuUpe/AndroidPdfViewer#956 claims to fix a similar issue, as you mentioned. How does one implement a fix like this within the plugin? I'm fairly ignorant here, unfortunately. I'm trying to extend the native class with something like (rough code ahead): class MyPDFView extends pdfviewer.PDFView {
static constructorCalled: boolean = false;
// constructor
constructor(a, b) {
super(a, b);
MyPDFView.constructorCalled = true;
// necessary when extending TypeScript constructors
return global.__native(this);
}
public onDetachedFromWindow() {
console.log('onDetachedFromWindow');
// this.release();
super.onDetachedFromWindow();
}
public release() {
console.log('release');
this.recycle();
}
} And then changing public createNativeView() {
// tslint:disable-next-line:no-unsafe-any
return new MyPDFView(this._context, void 0);
} However, I can still reproduce the problem (in the vue demo) and — more pertinent — I was expecting my Did I extend the class incorrectly? Or, perhaps, I'm mistaken in assuming that one or both of these methods would be called. Thanks again for your help! |
There are other forks that fix the issue, but, as far as I can tell, non have been published to be usable via gradle. (Though I could be wrong about that!) elek90/AndroidPdfViewer@56618eb is another example in addition to the PR you found. |
I figured out several problems with my above implementation — requiring I did find a way to include the patched library (from DImuthuUpe/AndroidPdfViewer#956), using the following allprojects {
repositories {
maven { url 'https://jitpack.io' }
}
}
dependencies {
implementation 'com.github.Ficat:AndroidPdfViewer:ae98706064'
} But that does not seem to resolve the issue, either. (It's apparently rather finicky, as I thought I had it fixed, but a later build after clearing the gradle cache and A side note, I see that |
Fixes PDF disappearing when app backgrounded. Fixes #9.
@dahjelle Thanks a lot for this fix! I did some tests and it works just fine. |
Which platform(s) does your issue occur on?
Please, provide the following version numbers that your issue occurs with:
Please, tell us how to recreate the issue in as much detail as possible.
Is there any code involved?
main-page.xml
main-page.ts
pdf-test.zip
Possibly related?
I wonder if this is related to this upstream issue? DImuthuUpe/AndroidPdfViewer#129
The text was updated successfully, but these errors were encountered: