onServiceConnected never called after bindService method

后端 未结 12 665
醉话见心
醉话见心 2020-11-30 05:48

I have a particular situation: a service started by a broadcast receiver starts an activity. I want to make it possible for this activity to communicate back to the service.

12条回答
  •  死守一世寂寞
    2020-11-30 06:27

    The onServiceConnected event was never being called in my application.

    The problem was that I had the service name defined in my Application Manifest as:

    
    

    Once I changed it to the full class name it worked:

    
    

    Update: You can also have use a relative class name:

    
    

    Specify the class name using its full com.example.MyServiceClass instead of just MyServiceClass.

提交回复
热议问题