How to Automatically Run an App After Installation: Difference between revisions

From wizarPOS
No edit summary
No edit summary
Line 1: Line 1:
== Solutions ==
== Solutions ==
There are two way to run app automatically after installation:  
There are two way to run app automatically after installation:  
* Solution 1: Write specific information in Manifest file  
* Solution 1: Write specific information in Manifest file. If you write the apk by yourselves, please use this solution. So the apk can be installed from anywhere.
* Solution 2: Configure in TMS.
* Solution 2: Configure in TMS. If you can not update the existing apk, you have to use this solution to install the app from TMS.
If you write the apk by yourselves, please use the solution 1. So the apk can be installed from any where.
If you can not update the existing apk, you have to use solution 2 to install the app to terminal.


== Solution 1: Configure in AndroidManifest of the APP ==
== Solution 1: Configure in AndroidManifest of the APP ==

Revision as of 07:53, 28 April 2023

Solutions

There are two way to run app automatically after installation:

  • Solution 1: Write specific information in Manifest file. If you write the apk by yourselves, please use this solution. So the apk can be installed from anywhere.
  • Solution 2: Configure in TMS. If you can not update the existing apk, you have to use this solution to install the app from TMS.

Solution 1: 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>

Solution 2: 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