How to start and stop android service from a adb shell?

前端 未结 11 1027
别跟我提以往
别跟我提以往 2020-12-07 16:32

I need to write a shell script to start and stop an android service .

11条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-07 17:21

    For anyone still confused about how to define the service name parameter, the forward slash goes immediately after the application package name in the fully qualified class name.

    So given an application package name of: app.package.name

    And a full path to the service of: app.package.name.example.package.path.MyServiceClass

    Then the command would look like this:

    adb shell am startservice app.package.name/.example.package.path.MyServiceClass
    

提交回复
热议问题