How to Automatically Run an App After Installation
Solutions
There are two way to run app automatically after installation: Write specific information in Manifest file or configure in TMS. If you write the apk by yourselves, please use the solution of update the Manifest. So the apk can be installed from any where. If you can not update the existing apk, you have to use TMS solution to install the app to terminal.
Configure in AndroidManifest of the APP
If choose this way, the system apk, WizarViewAgentAssistant version should be 2.8.40 or larger.
metadata
Add any of the following meta-data extension element data in the <application> field of AndroidManifest to complete the declaration.
- <meta-data android:name="cloudpos_activity_auto_start" android:value="XX.XX.XX.XXXX" />
- <meta-data android:name="cloudpos_service_auto_start" android:value="XX.XX.XX.XXXX" />
- <meta-data android:name="cloudpos_receiver_auto_start" android:value="XX.XX.XX.XXXX" />
meta-data data description:
Two parts of data contained in meta-data, the first part is to specify the type of component to be started, currently only three types are supported(cloudpos_activity_auto_start, cloudpos_service_auto_start, cloudpos_receiver_auto_start);
The second part is the class name of the absolute path of the component to be started, and the class name of the relative path is supported.
action
Add an action to the component that needs to be auto-started.
<action android:name="android.intent.action.AUTO_START" />
Example of AndroidManifest
<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.wizarpos.pinpadui.test">
<application android:allowBackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme"> <meta-data android:name="cloudpos_activity_auto_start" android:value="com.wizarpos.pinpadui.test.MainActivity" /> <activity android:name=".MainActivity"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.AUTO_START" />
<category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <receiver android:name=".XXXXReceiver"> <intent-filter> <action android:name="android.intent.action.AUTO_START" /> </intent-filter> </receiver> <service android:name=".XXXXService" android:enabled="true"> <intent-filter> <action android:name="android.intent.action.AUTO_START" /> </intent-filter> </service> </application>
</manifest>
Configure in TMS
Click Applications>Application, when add an application, click Advance, there is an auto run configure, now the label name is App Restart Entry.
The input format is type:component name
type: activity, service, broadcast
for example: activity:com.smartpos.autoremoveapk.MainActivity