Please don´t be too harsh to me concerning any mistakes with this question since thats my first one here.
So basically what i want to do is reading/showing a PDF document in my Android App after pressing a button. The PDF is located on a Raspberry Pi 3 and i found a code example on this thread how to read it. Before accessing it however, i call a python script on the Raspi which is (re)creating the PDF based on a database.
So the user presses the button in the App and sees a PDF which presents the current state of a database table.
Now i got the following code in my Activity to call the script and read the PDF:
new AsyncTask<Integer, Void, Void>(){
@Override
protected Void doInBackground(Integer... params) {
try {
executeRemoteCommand("user","pw","ip", port, "command to execute the python script");
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
}.execute(1);
//waiting for the PDF to be created
handler.postDelayed(new Runnable() {
@Override
public void run() {
String url = "http://IP/path/file.pdf";
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse(url));
startActivity(i);
}
}, 5000);
With this code connecting to the Raspberry, executing the python script, thus updating the database and reading the PDF file works just fine.
But i have the following problem:
When i close the PDF view in my App, add something to the database and press the executing button again the PDF file itself is being updated (i checked that on the Raspberry) but then the App still shows the old version of it. Even when i restart the App and execute this again it still shows the first version of the PDF...
Does anyone have an idea why and how to fix this?
Is there any kind of cache which stores the PDF and just shows the same every time i read from the Raspberry?