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

Check Bluetooth version in Android
Delphi Video freezes
Create Surface View With Child View
Trouble integrating FB login into my android app
How to make search widget larger in actionbar?
Android Layout Design Specific Custom
Generic Asynctask for multiple activities
ListView OnItemClickListener doesn't fire
Get access to particular item's layout in list view
Android: OTG Storage notification conflicts with radio c
Layout looks different on devices
Check android device density in html
Is that possible to connect two phones with adb connect?
App using Mobile Android GNSK crashes when identifyAlbumAsync() is called before audioProcessStart()
Get values from multiple RadioGroups
Can't Initialize Google Play Services

Categories

HOME
android
shell
django
jpa
checkstyle
gdb
redux-form
oracle-apex-5
requirements
interpolation
hpc
missing-data
webix
opengl-3
boto3
computer-science
p2p
categorical-data
enthought
opengl-es-3.0
automatic-ref-counting
favicon
comsol
symmetricds
firefox-addon
intershop
asp.net-mvc-viewmodel
smartclient
selinux
poedit
dpdk
parcelable
draft-js-plugins
definitelytyped
soot
subclass
google-earth
corenlp-server
angularjs-material
papaparse
mailkit
gnat-gps
least-squares
processwire
numpy-broadcasting
engine.io
reason
docfx
node-mssql
typesafe-config
apollostack
openresty
chai-as-promised
appdomain
ngmaterial
excel-dna
oozie-coordinator
cd-burning
testrail
google-cloud-console
android-dateutils
query-by-example
yajsw
contentcontrol
phpgrid
sapi
dynatree
qt5.2
computer-architecture
binomial-theorem
finalbuilder
ocra
node-serialport
zxspectrum
mmwormhole
adehabitathr
document-repository
post-commit-hook
rickshaw
imagefilter
trdion2011
file-not-found
mvc-editor-templates
windows-98
chart-director
booksleeve
azman
infobright
automationelement
tournament
rmdir
svk
objective-j
delimited-text
murmurhash
silverlight-oob

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