Skip to content

This is a simple example for native service and app communcation via aidl on android platform.

Notifications You must be signed in to change notification settings

manishv1/nativeservice-app-aidl

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

This is a simple example for native service and app communcation via aidl on android platform. Native service server will add service nativeservice in service manager and app will connect nativeservice via ServiceManager.
When click start button, app will send start command to native service and native service will continues to return timestamps to app. Native service will stop sending data when click stop button.


How to build native service server

  1. Download AOSP code. I built the server on Oreo 8.1.0 version.
  2. Make a full build
  3. Put native-service to the root path of AOSP code.
  4. In the root path of AOSP code execute command source ./build/envsetup.sh
  5. Enter the directory native-service and execute build command mm to build native-service and generate bin native_server.

Manually start native service server on android device with the following steps:

  1. adb root
  2. adb remount
  3. adb push native_server /system/bin/
  4. adb shell setenforce 0
  5. adb shell
  6. cd /system/bin and execute chmod 777 native_server
  7. execute ./native_server to start native service

Sometimes app can not connect to native service due to selinux permission problem. The step 6 setenforce 0 above used to put selinux in permissive mode and close selinux temporarily.
When native_server is running you can install and start app to connect it.

About

This is a simple example for native service and app communcation via aidl on android platform.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 49.6%
  • Java 44.8%
  • Makefile 5.6%