Android: start service with parameter

前端 未结 2 2036
情话喂你
情话喂你 2021-01-01 13:43

To start my service from an Activiy I use startService(MyService.class). This works great, but in a special case the service should be started differently. I wa

2条回答
  •  孤独总比滥情好
    2021-01-01 13:57

    Step #1: Delete your BroadcastReceiver implementation.

    Step #2: Examine the Intent your service gets in onStartCommand() and look at the action via getAction().

提交回复
热议问题