I was following this tutorial from the android doc implementing IPC only for one way communication as given. I copied it exactly one to one and no mistakes or error while building or running. When I start the service using the provided sayHello
method, the Toast
doesn't appear.
After a lot of Log.e
ing I found that the overriden method onServiceConnected
of the ServiceConnection
instance wasn't being run which probably should had been done when I invoke the bindService(...)
method which I run in the Activity's onCreate
, so the onServiceConnected
should had run, but it didn't. I wonder if the mechanism has broken somehow but the IPC isn't working. Again I did copy it exactly from the docs from the activity code to service code to manifest code, but it still doesn't work. Here is the sample app. Any help would be appreciated. Thanks in advance.
It's probably not outdated, because the docs would have mentioned something like deprecated
.
I was also facing this problem, and the big mistake was I hadn't set the android:enabled
property to true
.After that I cleaned the project and then everything started turning red highlighted, e.g. the AppCompactivity
was not available. So I invalidated cache and restarted and then everything worked.