Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

getting cellular network status via ADB shell

Tags:

android

adb

Is it possible to check via ADB if the phone is connected to a cellular network?

I had a look at ConnectivityManager, but it is for android application development.

like image 483
Raj Avatar asked Feb 16 '15 08:02

Raj


People also ask

What are adb shell commands?

Android Shell Commands. ADB is Android Debug Bridge which is a command line utility included with Google's Android SDK. It provides a terminal interface to control your Android device connected to a computer using a USB. ADB can be used to run shell commands, transfer files, install/uninstall apps, reboot and more.

How do I know if my device is connected to adb?

Connect to your device using USB You can also use adb to issue commands, as follows: Verify that your device is connected by running the adb devices command from your android_sdk /platform-tools/ directory. If connected, you'll see the device listed. Issue any adb command with the -d flag to target your device.


1 Answers

Certainly using the command from shell :

dumpsys telephony.registry

or directly from adb :

adb shell dumpsys telephony.registry

The values of mServiceState or mDataConnectionState will help you. I tried in Plane mode mServiceState=3 / mDataConnectionState=0 and connected to the cellular network : mServiceState=0 / mDataConnectionState=2

PS: I'm using an Android 4.4 phone.

like image 90
Sirius Avatar answered Sep 20 '22 04:09

Sirius