1

I have created a custom system service and have added in android source code.

I tested if the service has been successfully registered by flashing the system and boot image and it's successful.

So, I tried accessing the service I created from application side using the following code,

 SampleManager samplemanager = (SampleManager)  this.getSystemService(Context.SAMPLE_SERVICE); 

When I code this line , there is a error in 'Context.SAMPLE_SERVICE' . It says must be one of 'Context.Power_service,Context.Window_service etc'.

I have modified the following files under frameworks/base for service,

  Android.mk
  core/java/android/app/SystemServiceRegistry
  core/java/android/content/context.java
  preloaded-classes
  services/core/ Android.mk
  services/core/jni/ Android.mk
  services/java/com/android/server/SystemServer.java
  core/java/android/content/context.java 
  services/core/jni/ onload.cpp 

Apart from these files, I have created my own files required to create service and I have checked these links too,

How to add custom system service name
Context error in system service

As per the link, I have checked in all the files but everything seems fine. Any idea where the problem would be? Any help would be great. Thanks in advance.

Phantômaxx
  • 37,901
  • 21
  • 84
  • 115
Anusha
  • 939
  • 3
  • 13
  • 31

0 Answers0