How to preset Android phone APK

Source: Internet
Author: User

There are 4 types of pre-fabricated apk:

1, how to put the source APK preset into the system?
2, how to put the non-source APK preset into the system?
3, how to preset apk so that users can uninstall, restore factory settings can not be restored?
4, how to preset apk so that users can uninstall, and restore the factory settings can be restored?


The method of prefabricated APK implementation is as follows;

First, how to put the source APK preset into the system? 1) under Packages/apps, create a new folder under the name of the apk that needs to be preset to preset a apk named test as an example
2) Copy the source code of the test apk to the test folder and delete the/bin and/gen directories
3) in the Test directory, create a file named Android.mk with the following content:

4) Open File Build/target/product/${project}.mk (where ${project} indicates project name)
Add Test to Product_packages.
5) Re-build the entire project

Second, how to put the APK into the system without source code? 1) under Packages/apps, create a folder with the APK name you want to preset to preset a apk named test for example
2) put the test.apk under the Packages/apps/test
3) Create the file android.mk below the Packages/apps/test file with the following contents:

Local_path: = $ (call My-dir) include $ (clear_vars) # Module name should match apk name to be installedlocal_module: = Testlo Cal_module_tags: = optionallocal_src_files: = $ (local_module). Apklocal_module_class: = Appslocal_module_suffix: = $ ( Common_android_package_suffix) Local_certificate: = Presignedinclude $ (build_prebuilt)

4) Open File Build/target/product/${project}.mk (where ${project} indicates project name)
Add Test to Product_packages.
5) Copy the so library extracted from test.apk to the alps/vendor/mediatek/${project}/artifacts/out/target/product/${project}/system/lib/directory, If there is no so library, then remove this step;
6) Re-build the entire project
Note: Google modifies the permission control mechanism of the protection level system on KK
If the app uses the system level permission, it needs to be placed under/system/priv-app (formerly in/system/app).
For example:
For the case of obtaining write permission for the secondary SD card, the app needs to Androidmanifest.xml announce Write_media_storage permission to get the write permission of the secondary card.


(Ref:kk/alps/frameworks/base/core/res/androidmanifest.xml)
Known Android.permission.WRITE_MEDIA_STORAGE belong to the Systemorsignature level permission, defined as follows:


KK, you need to obtain the permission in the following ways:
Modify Android.mk, add Local_privileged_module: = True to declare that the app needs to be placed under/system/priv-app.

Third, how to preset apk so that users can uninstall, restore factory settings can not be restored? 1) under Packages/apps, create a folder with the APK name you want to preset to preset a apk named test for example
2) put the test.apk under the packages/apps/test;
3) Create the file android.mk below packages/apps/test, the file content is as follows

Local_path: = $ (call My-dir) include $ (clear_vars) # Module name should match apk name to be installedlocal_module: = Testlo Cal_module_tags: = optionallocal_src_files: = $ (local_module). Apklocal_module_class: = Appslocal_module_suffix: = $ ( Common_android_package_suffix) Local_certificate: = Presigned<span style= "color: #ff0000;" >local_module_path: = $ (Target_out_data_apps) </span>include $ (build_prebuilt)

4) Open File Build/target/product/${project}.mk (where ${project} indicates project name)
Add Test to Product_packages.
5) Re-build the entire project
Note: This is more than the one that can't be uninstalled.
Local_module_path: = $ (Target_out_data_apps)

How to preset apk so that users can uninstall, and restore the factory settings can be restored? Method One: Preset apk to system/vendor/operator the following practices:
Under Packages/apps, create a folder with the APK name that you want to preset to preset a apk named test for example:
1) put the test.apk under the packages/apps/test;
2) Create the file android.mk below the Packages/apps/test file with the following contents:
3) Open the file Build/target/product/${project}.mk (where ${project} represents the project name), add Test to Product_packages
4) re-build the entire project


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.