Android: adb.exe problems with calling # - android

I try to call *100# with the adb.exe program. I type the following in the command line:
adb.exe shell service call phone 2 s16 "*100#"
...but the telephone calls number *100, without # in the end, but I surely need it. How can I fix this?

You need to URL encode your phone number. So try this:
adb.exe shell service call phone 2 s16 "*100%23"

Related

Reading sms from android device using ADB shell commands

i am working on a project to read the sms of my android mobile,but on internet didn't find much about it. in my search i found following points
You can access android mobile phone through ADB shell commands ,but
only certain limited features.
ADB is a best method to communicate, as it do not require user to add any extension on android device
I use the shell command (found on internet) to send
message ,but it also didn't work
adb shell service call isms 5 s16 "com.android.mms" s16 "+01234567890" s16 "+01000000000" s16 "Hello world !" i32 0 i32 0
Moreover i found that if i want to
use AT commands to do so i have to root the mobile phone
even i tried accessing
com.android.internal.telephony
it shows result permission denied
above are my search results related to reading sms from my android device,
so i just want know,how can i read the sms from my android device
using adb shell commands?
if there is any other way to do so please suggest.
You can Read sms from android mobile using sqlite3, i m also working on the same project. but for this you have to do few things:
1) You must root your mobile (using any root app e.g Kingoroot app)
2) You should know the exact path for sms database of your mobile and you must install sqlite3 (simply google it and you will find it)
3) Only Super User can access that database
4) You must put sqlite.exe file into device/system/xbin (root directory)
5) how to accomplish step 4 ,you need (Titanium backup, root browser )
if done every thing written above all u need is
C:\Users\Ray>cd appdata/local/android/sdk/platform-tools
adb
adb shell
shell#htc_v02_dug:/ $ su
root#htc_v02_dug:/ # cd /data/data/com.android.providers.telephony/databases
root#htc_v02_dug:/data/data/com.android.providers.telephony/databases # sqlite3 mmssms.db
SQLite version 3.7.6.3-Titanium
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> select body from sms where read=0;
hi
i m using htc mobile. And the sms i just read hi.

Getting android cell phone number using command line

I would like to get the cell phone number of any android device using the command line.
I have tried using:
adb shell service call iphonesubinfo 4
and
adb shell service call iphonesubinfo 5/6/7/8
and it returns Permission denied.
I was wondering if anyone has another solution?
Ps: phones are android 4.1 and above
Thanks you in advance.
You have to obtain root access by using :
adb root
Then you'll find those command work. Usually the phone number will be returned by :
adb shell service call iphonesubinfo 5
or by :
adb shell service call iphonesubinfo 6
It depends on the device is single or dual sim. You'll need to do some string parsing work if you need this result to be recognized by machine.

ADB shell script to send AT commands to a modem-cannot return control to a shell and capture output

I already posted similar question, but still could not get my job done, so this a a second attempt, where
I would like to more clearly state my stumbling block.
So basically I am in Android phone's adb shell, communicating with the GPRS modem by sending AT commands.
I am able to do it by redirecting at command to the device file representing the modem; and I can read back
the response using cat utility running on the background (started earlier). I implemented it in a script
which can send a single AT command and read back the response. For example, here is the script to
send at+cops? to get the name of the operator the mobile is camping on:
#SendATCommand script
cat /dev/pts/7 &
echo -e at+cops?\\r > /dev/pts/7
The output looks as follows:
# ./sendATCommand
./sendATCommand
#
+COPS: 0,0,"AT&T",6
OK
/dev/pts/7: invalid length
Now here are two problems which I cannot resolve:
I still need to manually press ENTER button to get back adb shell prompt "#". Is there a way to return
to "#" prompt programmatically? Again, I am in adb shell.
The displayed response cannot be captured, neither in a variable, nor in file, (such as(#./sendATCommand > output.txt) Output.txt file will be empty. I tried various redirections, but still did not get it to work.
Can anyone please help me resolve those two problems (if ever possible)? Ultimately I want this little script to be
called from a "super" script (e.g. Perl or Powershell) running on PC to which my Android device is
connected, but there is no way to do it until those two problems resolved. Thanks a lot in advance!
I suggest that you try out my atinout program which should be exactly what you are asking for: a program to send AT commands from the command line and capture the output.
In your case the result should be like
$ echo 'at+cops?' | atinout - /dev/pts/7 -
+COPS: 0,0,"AT&T",6
OK
$
and to capture the output just put a file name instead of the last -.
I had similar problems with redirecting output to file. I resolved my problem by adding CMD /c in front of the echo command. I.e. if I understand correctly you need to tell the system that it needs to wait until command finishes executing and only then redirect output to a file. I was doing it in DOS.
Since you are running on ANDROID try adding sh -c in front of your command. Hope it helps.

how do i change timezone using adb

I want to change the timezone using adb shell command.
I went through some posts which allow changing it in linux, but they are not valid for android.
For the list of tzdata values I go to http://en.wikipedia.org/wiki/List_of_tz_database_time_zones
To set the timezone use setprop persist.sys.timezone <TZ> command:
setprop persist.sys.timezone "America/Chicago"
adb shell service call alarm 3 s16 America/Phoenix, which will be effective immediately.
"setprop with persist.sys.timezone" only works after reboot.
adb shell service call alarm 4 s16 America/Chicago
4 - stands for the fourth function in alarm service implementation.
s16 - stands for string argument type.
https://android.stackexchange.com/questions/34625/where-to-find-description-of-all-system-bin-service-calls
In my (very) limited experience I have been able to edit the /system/build.prop file. I change the line in there that says persist.sys.timezone=America/Sao_Pao or some such drival to persist.sys.timezone=America/Chicago for my timezone CDT. I also changed the lines persist.sys.language=bt and persist.sys.country=AR to persist.sys.language=en and persist.sys.country=US respectively.
There are a few other things you can tweak in the file that will persist after a system restore. You might want to make sure that the build.prop file in a flash image or directory has the correct lines in it.
The /system/property directory seems to hold several text files with a single value. These seem to show up after using setprop but the OS doesn't seem to reflect the changes.
Editing these files usually does require root access either with a term program or the ADB.exe shell. (ADB = Android Device Bridge available in the Android SDK) I found ADB.exe while looking through the firmware downloads at JXD.HK for the S18 MiniPad. In the files.rar dl there is also the SuperUser.apk and a rooted version of busybox and su.
Best of Luck !!!
Please see this https://gist.github.com/jpkrause/6b7e576894a800d451bf for answer to your question.
So in your case it would be:
adb shell setprop persist.sys.timezone America/Chicago
This works with ADB
Get current global time zone:
adb shell settings get global time_zone
Set a time zone:
adb shell settings put global time_zone Europe/Madrid
Time zones list:
https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
I changed 2 files to change my timezone.
the one that i don't entire know if it's necessary, but it keeps things in sync:
/etc/timezone
the more one you for sure need to change:
/etc/localtime
from http://www.cyberciti.biz/faq/linux-unix-set-tz-environment-variable/ you can determine the name of the timezone you want with tzselect.
I took inspiration from http://www.cyberciti.biz/faq/howto-set-date-and-time-timezone-in-freebsd/
and copied my timezone file from /usr/share/zoneinfo/ to /etc/localtime.
/etc/timezone is a text file with the name of the timezone. so i just updated it to match the value provided by tzselect.

How do I send an SMS from a shell?

I would like to be able to send an actual SMS message from a shell using just the command line and not relying on any apk to do so. I am interested in sending this message between phones, not from the emulator to the phone. For example, by running the command:
service call phone 2 s16 "1234567890"
I can place a call from phone to phone using the command line. The 'service list' command shows an isms service, which I can't seem to provide the correct arguments for. I would assume that one of the args should be a PDU string but haven't had any luck so far.
In fact, this can be done but requires adb to be installed (Part of the android SDK)
adb shell am start -a android.intent.action.SENDTO -d sms:CCXXXXXXXXXX --es sms_body "SMS BODY GOES HERE" --ez exit_on_sent true
adb shell input keyevent 22
adb shell input keyevent 66
Where CCXXXXXXXXXX is country-code followed by phone number. This may not work correctly on non-standard android installations, you will need to find the correct keyevent values to pass.
How about this?
service call isms 5 s16 "+??????????" i32 0 i32 0 s16 "SMS TEXT HERE"
You can telnet to the emulator doing something similar to "telnet localhost 5554", where 5554 is the port the emulator is listening on. After that, you can send an sms message by doing the following:
sms send 1234 "Hello"
The 1234 can be any string of digits. Enclose the message in quotes if you are including spaces.
edit:
an sms command doesn't exist in Android on real devices, it's an emulator-only feature to fake an SMS receiving not sending.
It's just a convenience for emulated devices that don't have access to any actual cellular network.
cf. http://developer.android.com/guide/developing/devices/emulator.html#sms
I don't have enough reputation points up upvote the answer given by Dmitry, but that IS the answer that works with one minor modification: At least for a US number, instead of putting a plus-sign (+) it worked for me with a "1" e.g. 17079876543 ...
service call isms 5 s16 "17079876543" i32 0 i32 0 s16 "SMS TEXT HERE"
Oh boy oh boy oh boy ... now if I can figure out how to receive SMS over the command line and combine that with emacs (in an emacs shell say - he begins to rub his hands together and crack a slanted grin ... and think about all the other command line levers we can pull!)
You can send any intent you want from the command line, so it's merely a matter of figuring out what intent can be used to send an sms, or if one doesn't exist, then writing an apk which provides such intent-to-sms capability and sending the intent to trigger that from the command line.
If you end up writing an apk to do that, think a little bit about permissions. Which user will the command line be running as - the adb shell user? any old ordinary app user? Your apk will presumably have sms permissions, but do you want to extent that to everything on the phone, or implement some security mechanism in your intent?

Categories

Resources