To display the PDF on Android, we use an Android-specific mechanism called intents (check the specific recipe to know more about Android intents). The file is actually shown by an external app already installed on the device; if such an app is not present, the PDF cannot be shown and a message is shown to the user. You can install Adobe PDF Reader or another app that is able to display PDFs, which is intent-compatible with the one from Adobe. In accordance with Android I/O security, to let another app read the PDF file bounded in our assets/internal folder, we have to copy the file from the private documents folder, which is private to the app and not accessible from other apps, to the shared documents folder (readable from all the other apps installed on the device).
Just after the copying the file, we create an intent and configure it to launch an app able to show that PDF. The configuration is simple enough, as shown in the following code:
//create the Intent directly from the Android SDK
Intent := TJIntent.Create;
//We need to show the PDF, so ACTION_VIEW is ok
Intent.setAction(TJIntent.JavaClass.ACTION_VIEW);
//Where is the file? Which mime type?
Intent.setDataAndType(
StrToJURI('file://' + SharedFilePath),
StringToJString('application/pdf'));
try
//ask to the OS to find a proper app to handle the intent
SharedActivity.startActivity(Intent);
except
//TODO: there aren't apps able to show the PDF. Inform the user!
end;