Tag value of the installation location
The Android SDK has an open interface to obtain the APP installation location. The system APP and the common APP return different values, so that you can determine whether the APP is a system APP or a common APP.
How to obtain the installation location
/***** Determine whether the current App is a system APP **/public static boolean isSystemApp (Context context) {boolean isSystem = false; if (context! = Null) {String packageName = context. getPackageName (); try {PackageInfo packageInfo = context. getPackageManager (). getPackageInfo (packageName, 0); if (packageInfo. applicationInfo. flags & ApplicationInfo. FLAG_SYST )! = 0) {isSystem = false;} else {isSystem = true;} catch (NameNotFoundException e) {isSystem = false;} return isSystem ;}}
System App Creation
How can we turn our APP into a system APP because of the many benefits of the system APP? The following two methods are described:
1. Create a ROM
This is troublesome, and the workload is relatively large. The advantage is that after the production is completed, there is no need to change it. Now we will introduce you to an opportunistic method. It is also possible to use the official ROM test on Huawei u8950D.
A. Download the ROM card pack suitable for mobile phones
B. Open the ROM file in the form of a compressed package, open the/system/app directory in sequence, and then you will see many system apk files.
C. Drag our own apk directly. This shows that our APP is under the system/app directory. If there are apps you don't like, drag them out.
In this way, the Rom compression file is modified. The ROM signature information is not modified, and can still be flushed to the mobile phone for normal use.
For in-depth custom modifications, mobile phones and systems are not tested, such as Xiaomi and meizu. Passed the test at Huawei u8950D.
2. Move the apk File Location
By default, common apps are installed in the data/APP directory or SD card of the memory. You can use third-party software to move the APk location. In this way, our APP also has the attributes and functions of the system APP.
Prerequisites
A. Install the APP to be moved
B. the mobile phone has the root permission.
C. Install a third-party file browser. We recommend that you use the ES file browser.
To meet these conditions, the specific operation is very simple.
- Use the ES file browser to find the installation location of our APP. Generally, under the root directory/data/app, click the selected long press, select cut --> switch to the system/app directory, select and paste
- Restart your phone.
Use Cases:
Ordinary users or general apps do not have such requirements. Under what circumstances will we use the mobile APP installation location?
Requirement Description: to promote your own apps through third-party flash channels, we need to count the number of promotion users in this channel, and the total time these users stay on their mobile phones.
Requirement Analysis: calculates the number of users for promotion. After a user refreshes the ROM, the user sends the arrival statistics to the server at the first startup to identify the user as a promotion user. During the first boot, our APP was not started. If it was not a system APP, it would not receive broadcast events from the system.
If the first method is used for testing this requirement, the workload and time will be long. If the second method is used, the efficiency will be improved and a lot of work will be reduced.
This is the introduction of system apps and common apps. If you have any questions, please contact us.