Signin/Signup with: 
Welcome, Guest
Username: Password: Remember me
Questions about Android development and PDF
  • Page:
  • 1
  • 2

TOPIC:

Unable to save document in release mode 2 weeks 4 days ago #15498

  • Torkaman
  • Torkaman's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 11
  • Thank you received: 0
Hi, when I run my application in debug mode , application works ok and I am able to save document , but when I release the apk , save doesn't work anymore. 
(I activated SDK correctly )

Please Log in or Create an account to join the conversation.

Unable to save document in release mode 2 weeks 3 days ago #15499

  • radaee
  • radaee's Avatar
  • Offline
  • Moderator
  • Moderator
  • Posts: 1050
  • Thank you received: 64
dear user:
if you are writing on sdcard for specify path, after Android X, you shall add:
android:requestLegacyExternalStorage="true"
to your application tag in AndroidManifest.xml
and
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
shall add begin of AndroidManifest.xml

Please Log in or Create an account to join the conversation.

Unable to save document in release mode 2 weeks 3 days ago #15500

  • Torkaman
  • Torkaman's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 11
  • Thank you received: 0
It has nothing to do with permission, I already have the permission, and android:requestLegacyExternalStorage="true" is in the manifest.
The application works in Debug mode ( if it was for permission, it didn't work even in debug mode) but when I release it, the app doesn't save documents.

Please Log in or Create an account to join the conversation.

Unable to save document in release mode 2 weeks 3 days ago #15501

  • Torkaman
  • Torkaman's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 11
  • Thank you received: 0
finally, I found the problem. It was a little bit weird but It was because of the closing document on the "OnBackPress" event. I closed the pdf on "OnStop" and it's working now!
(anyway I didn't find out why it's working on debug mode and not working on release mode!)
It's working now.
Thank you.

Please Log in or Create an account to join the conversation.

Last edit: by Torkaman.

Unable to save document in release mode 2 weeks 3 days ago #15502

  • support
  • support's Avatar
  • Offline
  • Administrator
  • Administrator
  • Posts: 627
  • Thank you received: 52
If you like... may you give some more detail?
 

Please Log in or Create an account to join the conversation.

Unable to save document in release mode 2 weeks 3 days ago #15503

  • Torkaman
  • Torkaman's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 11
  • Thank you received: 0
Sure. I was closing my document on the "OnBackPress" event of the activity, then call the "document.Save();" on "OnStop".
So when the user press, the document would close, and when the activity stops, the document would save.
I think closing the document before saving it was the problem, but It was working in debug mode and that's a weird thing !
here is the example
 @Override
public void onBackPressed() {
super.onBackPressed();
closeDoc();

}


@Override
protected void onStop() {
if (document != null) {
//save doc if user wanted to save
if (userSave) {
     document.Save();
    }
}
super.onStop();
}


Change it to this:

@Override
public void onBackPressed() {
super.onBackPressed();


}


@Override
protected void onStop() {
if (document != null) {
//save doc if user wanted to save
if (userSave) {
     document.Save();
    }
}
closeDoc();
super.onStop();
}
 

Please Log in or Create an account to join the conversation.

Last edit: by Torkaman.
  • Page:
  • 1
  • 2
Powered by Kunena Forum