Frameworks
React Native
Flutter
Package samples
Cookbook
Version 11
Version 10
Version 9
Version 8
Version 7
Version 6
Version 5
android.useAndroidX=true
and android.enableJetifier=true
in your gradle.properties
file. Learn more about requirements in our AndroidX FAQ.The trial of Apryse Mobile SDK does not require a trial key. A commercial license key is required for use in a production environment. Please contact sales to purchase a commercial key or if you need any other license key assistance.
License keys are uniquely generated. Please make sure that it is not publicly available (e.g. in your public GitHub).
In this quick start tutorial you will create a simple Android app that will open a PDF document stored in your Android project by using DocumentActivity
. The sample code for this tutorial is available at our GitHub repository.
Gradle
. You can learn more about how Gradle is used in Android Studio at the Gradle guides.Find your gradle.properties
file in the root folder of your project and add your license key to this file:The trial of Apryse Mobile SDK does not require a trial key. A commercial license key is required for use in a production environment. Please contact sales to purchase a commercial key or if you need any other license key assistance.
License keys are uniquely generated. Please make sure that it is not publicly available (e.g. in your public GitHub).
settings.gradle
file located in your project's root directory and add the Apryse Maven repository:build.gradle
file (usually app/build.gradle
) add the following:You should also sync your project when you make changes in your Gradle files.DocumentActivity
, we need to include the Android permissions listed in the table below. However if you would like to disable certain features and customize your document viewer, you should leave out unnecessary permissions. You can learn more about Android Mobile SDK permissions.In this sample we'll add all the permissions to AndroidManifest.xml
so we can support all the features in the viewer. In this file, we'll also need to add a reference to our Apryse license key. The resulting AndroidManifest.xml
file should look something like this:Feature | Relevant permission |
---|---|
|
|
|
|
Please follow the latest Android best practices and guidelines outlined here
PDFTronAppTheme
(referenced by DocumentActivity
in AndroidManifest.xml
) in res/values/styles.xml
:You can learn more about this in the customize the viewer's theme guide.res/raw
folder of your project (you can use our sample file) and call it sample.pdf, we are going to reference this file in the next step.onCreate
of your launcher activity, call DocumentActivity.openDocument(Context, int)
to open this PDF file with the document reader:This launches DocumentActivity
with our sample PDF document with default viewer configurations, and you should see the following: You can also view your document in DocumentActivity
by specifiying a local file path, an HTTP/HTTPS url, or a Content Uri:Please note that any changes made to files opened from res/raw
will not be saved on the disk.The source code for this tutorial can be found on our GitHub repository.Did you find this helpful?
Trial setup questions?
Ask experts on DiscordNeed other help?
Contact SupportPricing or product questions?
Contact Sales