简体   繁体   中英

Use custom system service in app (Android Studio)

First of all, thank you for your help.

Here is my problem.

  1. I have made a custom system service (it does connect through the binder, and hooks into the system server, then into the HAL, etc). One of the main commands is isBacklightOn(). I also ran the make update-api to include it in my ROM build.
  2. I am now ready to test the functionality using an app. I am using the following code:

 import android.os.BacklightManager; //My service manager name ... BacklightManager bm = (BacklightManager) getSystemService(BACKLIGHT_SERVICE); ... if(!bm.isBacklightOn()) { //Turn it on. } else { //Other Things... } 

My problem occurs because Android Studio will not build the application due to not knowing what the BacklightManager is. How can I build this application to test my code? (import something into Android Manager, force a build ignoring errors, etc.)

It looks like the solution is to build a custom SDK within the AOSP build environment. And then import that into Android Studio

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