Skip to content
This repository has been archived by the owner on Mar 26, 2021. It is now read-only.
PC Chin edited this page Jun 21, 2020 · 10 revisions

Welcome to the auto-app-updater wiki!

Usage

To start, you would need the following in your AndroidManifest.xml:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    package="com.pcchin.sampleapp">
    <!-- You should have this 3 permissions in your app manifest -->
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />

    <application>
        <!-- Something like this should be present in your app -->
        <provider
            android:name="androidx.core.content.FileProvider"
            android:authorities="com.pcchin.sampleapp.ContentProvider"
            android:exported="false"
            android:grantUriPermissions="true">
            <meta-data
                android:name="android.support.FILE_PROVIDER_PATHS"
                android:resource="@xml/provider_paths"/>
        </provider>
        ...
    </application>
</manifest>

In your app/src/main/res/xml/provider_paths.xml, you would need to specify the following:

<!-- Insert your required paths here based on the path that the APK will be downloaded to,
     but by default the files-path option should be sufficient if the output file path remains unchanged. -->
<paths>
    <files-path name="internal-files" path="."/>
    <cache-path name="cache-files" path="./cache" />
    <external-path name="external-files" path="/" />
    <external-cache-path name="external-cache" path="." />
    <external-media-path name="external-media" path="." />
</paths>

Then when creating the Builder, specify the content provider variable as your content provider above (aka com.pcchin.sampleapp.ContentProvider).

AutoAppUpdater.Builder Diagram

To run the updater, you would need to create an AutoAppUpdater.Builder instance based on the diagram above. Only the setUpdateType, setUpdateVersion and build() function is required. Then, after you had built the AutoAppUpdater, just call updater.run() and the updater will do its job.

The endpoint usages can be found in their respective pages below.

The addEndpoint, addEndpointList and addEndpoints should be called after the other optional functions as shown in the diagram above.

Docs:

Endpoints: