Android Framework - Create System Service in Android

Поделиться
HTML-код
  • Опубликовано: 16 сен 2024
  • This video demonstrates steps to create our own custom System Service in Android
    Here is link to my next tutorial which explains how to create a system application : • Android Framework -Cre...

Комментарии • 43

  • @rajatgupta-ld1wg
    @rajatgupta-ld1wg 4 года назад +2

    great tutorial! Wasn't able to find any tutorial regarding AOSP but your whole playlist made it a little easy to understand. Thanks :)

  • @hrishikeshkotian
    @hrishikeshkotian 2 года назад +1

    Thank you @Dimple . This is one of the most concise explanations of the topic 👍I'm going to share this far and wide

  • @shobhittrivedi435
    @shobhittrivedi435 2 года назад +1

    Very informative... Thanks

  • @venkatraman8179
    @venkatraman8179 Год назад

    Hi dimple thanks for your tutorial
    One doubt in final slides you mentioned that our custom service won’t work on normal android app and we need system app but my doubt is how come we’re accessing location service from our normal app itself is that we need to add entry in any of the source that our service is visible for all level of applications?

  • @shivarajus7244
    @shivarajus7244 4 года назад +1

    Super

  • @alexbv678
    @alexbv678 5 месяцев назад

    Great job. Thank you!

  • @moontenzin118
    @moontenzin118 3 года назад +1

    great video dimple! :)
    can you please suggest how do I build it and push it onto my device? thanks

    • @dimples_android_geek
      @dimples_android_geek  3 года назад +1

      Hi Moon, Please watch this video : ruclips.net/video/VUnV8iSShMo/видео.html
      System service and system app will be inbuilt when we build the entire android build and when we flash our device

  • @mahalerahulm
    @mahalerahulm 3 года назад +1

    Thank you !

  • @My_Name_Is_Prashant
    @My_Name_Is_Prashant 5 лет назад +1

    why we need to register in SystemServerRegistry.java ?
    can you please explain ..

    • @dimples_android_geek
      @dimples_android_geek  5 лет назад +4

      Hi Prashant ,
      I have given an example to create Custom System Service in this video . If I do not have my service registered in
      SystemServiceRegistry.java , getSystemService() function will not work as there is no context of my service .
      You can build the source code successfully , but your Service will not be working as expected i.e; service will not be called from your application when you use getSystemService() function .
      All the core services are registered in SystemServiceRegistry.java file which will be started on boot up .

  • @anishpuranik
    @anishpuranik Год назад

    Does this work the same for android 13? I tried it on android 11 with the latest android studio version. The system service does show up when you code for compilesdk and targetsdk 30, but the execution fails and it complains that android studio dependencies need a minimum compileSDK version to be 33, but when the compileSDK and targetSDK of 33 is chosen, which is what is required for the latest android studio version, it just gives an error saying 'Symbol not found'. Android studio for some reason does not let me execute the code with API 30. And the system service is only found on API 30 and not 33.

  • @cid007007
    @cid007007 4 года назад +1

    You told... "Our custom system service will not work with dummy application, it will give an error. So, it should always invoke through System Application" ... Here my doubt why other system services like LOCATION_SERVICE, NOTIFICATION_SERVICE, POWER_SERVICE etc... able to invoke through dummy applications running on Android Emulator ? Kindly reply asap. Thanks :)

    • @dimples_android_geek
      @dimples_android_geek  4 года назад +1

      Hi ohri, yes the system service i hav written shd b accessed via system app... Because this is customized and APIs related to this service are not generalized... In other cases of power manager or alarm manager or any such manager for tat case, the APIs provided by them are standardized and hence we can access via dummy app. Remember here we hav written customized system service and this service is not exposed to outer world

    • @cid007007
      @cid007007 4 года назад +1

      @@dimples_android_geek You mean something extra has done for those system services (like LOCATION_SERVICE, ALARM_SERVICE etc) to expose and can used outside from dummy application running on Emulator ?Correct me if I am wrong..
      Can u kindly tell what is that extra step taken care by google to expose those system services outside and utilize from any dummy application ?

    • @dimples_android_geek
      @dimples_android_geek  4 года назад

      @@cid007007 , Actually there are multiple parameters to be taken care of when we try to expose system service to dummy applications. We have to follow the Proxy design pattern used by google and we have to define contexts clearly. Also, SELinux policy comes into the picture if we try to use Android N and above. So carefully we have to design the system service by following each and every step what google does for other system services. Since that would be very difficult process, I have written customer system service which works like system service except for the fact that it has to be invoked from system application.

  • @amitchaturvedi2246
    @amitchaturvedi2246 2 года назад

    Android.mk under framework/base, that step i am not able to follow. I am using Android 11 , i dont see AIDl files for other system service in Android.mk.

    • @dimples_android_geek
      @dimples_android_geek  2 года назад +1

      Sorry this was done on older versions.. there will be changes in newer android versions

    • @amitchaturvedi2246
      @amitchaturvedi2246 2 года назад +2

      @@dimples_android_geek yes i found the changes.. now we have android.bp ...android.mk is replaced by android.bp in the latest version

  • @koushikdeb7874
    @koushikdeb7874 3 года назад

    Hi unable to add service in system server
    Error:: SystemServer: Failure starting MyService Service

  • @chathurakarunanayaka4519
    @chathurakarunanayaka4519 2 года назад +1

    is there a github source ?

  • @fsnd7954
    @fsnd7954 4 года назад

    does only root can create system service ?

    • @dimples_android_geek
      @dimples_android_geek  4 года назад

      If you hav access to a build system you can create system service. You shd have keys to flash the image once the build is complete. Nothing like root user and all

    • @fsnd7954
      @fsnd7954 4 года назад

      @@dimples_android_geek if the app got uninstalled , does the System service you created still run ?

    • @dimples_android_geek
      @dimples_android_geek  4 года назад

      @@fsnd7954 yes

    • @fsnd7954
      @fsnd7954 4 года назад

      @@dimples_android_geek i still do not understand from your video, do you have any links or resources to "System service" so i can learn it. thank you

    • @dimples_android_geek
      @dimples_android_geek  4 года назад +1

      @@fsnd7954 , Functionality exposed by application framework APIs communicate with system services to access the underlying hardware. These are the services that provide application interfaces as part of the Android framework.
      Besides these services, there are also native services supporting these system services, such as
      SurfaceFlinger
      , netd, logcatd, rild and so on.
      Services that run in system context are system services. Ex: Audio Manager is a system service, notification manager, package manager, all kinds of managers are system services. If system service is killed, then system server is restarted( system server is the first component to be started, it is system server which starts all the other components of the device) when system server is restarted, the device will be rebooted
      You need not be the root user to access system service, you can write your own service and build the android source again and then when you flash the device you will get your system service up and running