android


Send message to custom service via adb


I create simple android application which contains one activity and service. The service is defined by aidl file and can receive calls from the activity via Binder. Everything works as expected.
Now I deploy the application on device (also I've tried an emulator) and I want to send message to the service via adb:
$ adb shell service call \
com.example.gluttton.dummyandroid/.DummyService 0 STR "Bingo!"
and got message that such service doesn't exist:
service: Service com.example.gluttton.dummyandroid/.DummyService does
not exist
I try to check is my service launched:
$ adb shell service list
or
$ adb shell service check com.example.gluttton.dummyandroid/.DummyService
and got similar result.
But at the same time I cat see my service using dumpsys:
$ adb shell dumpsys activity services Dummy
ACTIVITY MANAGER SERVICES (dumpsys activity services)
User 0 active services:
* ServiceRecord{a1627b5 u0 com.example.gluttton.dummyandroid/.DummyService}
intent={act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.example.gluttton.dummyandroid/.DummyService}
packageName=com.example.gluttton.dummyandroid
processName=com.example.gluttton.dummyandroid
baseDir=/data/app/com.example.gluttton.dummyandroid-1/base.apk
dataDir=/data/data/com.example.gluttton.dummyandroid
app=ProcessRecord{114da04c 20168:com.example.gluttton.dummyandroid/u0a126}
createTime=-21m40s817ms startingBgTimeout=--
lastActivity=-21m40s816ms restartTime=-21m40s816ms createdFromFg=true
startRequested=true delayedStop=false stopIfKilled=false callStart=true lastStartId=1
Also I can start my service:
$ adb shell am startservice com.example.gluttton.dummyandroid/.DummyService
Starting service: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.example.gluttton.dummyandroid/.DummyService }
and stop it:
$ adb shell am stopservice com.example.gluttton.dummyandroid/.DummyService
Stopping service: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.example.gluttton.dummyandroid/.DummyService }
Service stopped
So my question is where is my mistake and how to send message to my service via adb?
I think system/bin/service is only for working with android system services. If you do a adb -s emulator-5554 shell service list for example you will see only a list of services such as
Found 100 services:
0 carrier_config: [com.android.internal.telephony.ICarrierConfigLoader]
1 phone: [com.android.internal.telephony.ITelephony]
2 isms: [com.android.internal.telephony.ISms]
3 iphonesubinfo: [com.android.internal.telephony.IPhoneSubInfo]
If you wish to send a message to your service you can do so via
adb shell am startservice [options] intent
Start the Service specified by intent.
See the Specification for intent arguments.
Options are:
--user user_id | current: Specify which user to run as; if not specified, then run as the current user.
see this link for how to set up the intent as an argument

Related Links

How do I remove this rectangular of image button
Android: Google Maps move camera error
Auto Complete text view does not show suggestions
How to get all purchases from Google in app billing?
android buttons and seekbar look older
Eclipse is not recognizing android phone
Route selector icon not showing all of a sudden
Camera app does not return to my activity
Add github library as dependency to Android-Studio project
Kill an app when a CheckBox is checked
How to save a picture in app?
Pass data between ListFragment and GoogleMapsFragment
Android Button properties change everytime the app runs
Why Update contacts methods does nothing in android
Failed to add the android platform
Database error using new version on upgrade

Categories

HOME
assembly
google-cloud-platform
jmeter
alexa-skills-kit
rsa
yahoo-finance
mstest
pclxl
appcelerator
3d-reconstruction
syntaxnet
jquery-ui-sortable
distribution
text-mining
mautic
line
opengl-es-3.0
naivebayes
zerobrane
android-7.0-nougat
asp.net-mvc-viewmodel
foreign-keys
cfml
sencha-touch
asp.net-core-webapi
drive
question2answer
gulp-watch
react-toolbox
dynamically-generated
xcode-ui-testing
shared
subclass
custom-controls
hibernate-validator
classcastexception
navigator
wurfl
dm-script
sessionstorage
node-mssql
urlsession
vmware-fusion
importerror
jide
ovf
opennms
jquery-ui-draggable
java-bytecode-asm
spring-data-couchbase
donations
docpad
actor-platform
seek
latin
nikeplus-api
beamer
project-organization
phpgrid
state-restoration
r-package
ess
canalyzer
eoferror
airbrake
snoop
typeconverter
snackbar
matlab-deployment
zend-currency
umlgraph
openbabel
exceldatareader
android-vibration
easyrtc
teaspoon
winginx
ray
renderer
clickbank
bin
artemis
code-duplication
gpars
joomla-template
mantle
asplinkbutton
pstack
httponly
denied
android-holo-everywhere
rmdir
mbeans
event-receiver
squishit
unmanagedresources
appliance
netbeans6.1

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App