6
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

AndroidエミュレータにtelnetでSMSメッセージ送る方法っていつから変わったのかな?

Posted at

最近SMSメッセージをアレコレするアプリを作った。
テストのためにSMS送りたくなったので android emulator sms で検索すると、大体みんなこれでOKって言う。

$telnet localhost 5554
$sms send 00000000000 message

みんなが言うんだからやってみよう

$telnet localhost 5554
Trying ::1...
telnet: connect to address ::1: Connection refused
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
Android Console: Authentication required
Android Console: type 'auth <auth_token>' to authenticate
Android Console: you can find your <auth_token> in 
'/Users/shitake/.emulator_console_auth_token'
OK

$sms send 00000000000 message
KO: unknown command, try 'help'

おいおいunknownだってよ。

確かにsmsコマンドなんて無い。

$help
Android console command help:

    help|h|?         print a list of commands
    auth             use 'auth <auth_token>' to get extended functionality
    avd              control virtual device execution
    quit|exit        quit control session

try 'help <command>' for command-specific help
OK

そこでよーく見返すとtelnetで接続したときに何か言われている。

Android Console: Authentication required
Android Console: type 'auth <auth_token>' to authenticate
Android Console: you can find your <auth_token> in 
'/Users/shitake/.emulator_console_auth_token'

つまりこのエミュレータのいろんな機能使うにはauthコマンドでの認証が必須だってよ。
親切にも認証に必要なトークンの在り処まで教えてくれていました。ちゃんと読まなくてごめんね。

~/.emulator_console_auth_tokenを覗く

$vi ~/.emulator_console_auth_token

それっぽいトークンがいたのでそれをコピってauthコマンド実行

$auth コピーしたトークン
Android Console: type 'help' for a list of commands
OK

$help
Android console command help:

    help|h|?         print a list of commands
    crash            crash the emulator instance
    kill             kill the emulator instance
    quit|exit        quit control session
    redir            manage port redirections
    power            power related commands
    event            simulate hardware events
    avd              control virtual device execution
    finger           manage emulator fingerprint
    geo              Geo-location commands
    sms              SMS related commands
    cdma             CDMA related commands
    gsm              GSM related commands
    rotate           rotate the screen by 90 degrees

try 'help <command>' for command-specific help
OK

コマンド増えた!smsコマンドも出た!

Androidのバージョンの問題?エミュレータの問題?

6
5
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?