简体   繁体   中英

How to create a system service in Android with a custom permission?

I want to create a system service. My requirements:

  1. The service should be protected by permission. If possible, it should not be accessible to the user (accessible only inside Android system).

  2. Service should be able to return some values. All the tutorials available on the internet give same example of setting int value.

I want to add this service to SystemServer.java so that it will be automatically started. Some of solutions on stackoverflow suggest to create a system app/service, but I will be modifying Android source code to create a custom ROM.

First, i would suggest you to read the official documentation about Services ,

you can't protect service with permission, you can do some logic and protect your data with passwords with MD5 encryption, and with simple search i found for you nice question of starting a service and returning data

EDIT: Please note that it's uncommon for most application, READ THIS BEFORE IMPLEMENTING , EXAMPLE OF HOW TO USE CUSTOM PERMISSION

Good luck

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM