Setup
Android Configuration
The AppConfig extension requires a few additions to the manifest to specify the restrictions configuration for your application.
To define your app's remote configuration options, put the following element in your manifest's <application>
element:
<meta-data android:name="android.content.APP_RESTRICTIONS"
android:resource="@xml/app_restrictions" />
You will need to define some custom resources and ensure they are packaged with your applicaiton.
Generally we suggest creating a directory named res
and adding that to your application package,
and ensure you add the following resdir
tag to your application descriptor (ideally right after the android
tag):
<android>
</android>
<resdir>res</resdir>
In this res
directory create two files as below:
res
|_ values
|_ app_restrictions_strings.xml
|_ xml
|_ app_restrictions.xml
The app_restrictions.xml
file contains the predefined values for your app configuration:
<?xml version="1.0" encoding="utf-8"?>
<restrictions xmlns:android="http://schemas.android.com/apk/res/android">
<restriction
android:key="url"
android:title="@string/restriction_url_title"
android:restrictionType="string"
android:description="@string/restriction_url_description"
android:defaultValue="https://airnativeextensions.com" />
</restrictions>
The app_restrictions_strings.xml
file contains any string constants used in the app_restrictions.xml
file.
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="restriction_url_title">Url endpoint</string>
<string name="restriction_url_description">Url endpoint description</string>
</resources>
Change these files as required for your application. More information on the format can be found in the documentation on Android Managed Configuration