开发者

How to check the android mobile phone whether it turns into AP mode or not?

开发者 https://www.devze.com 2023-04-05 01:03 出处:网络
everyone~ I have a problem to solve. I wan开发者_运维问答t to use java code to check whether the android mobile phone turns into AP mode or not?

everyone~

I have a problem to solve.

I wan开发者_运维问答t to use java code to check whether the android mobile phone turns into AP mode or not?

I use google engine to search related information, but I didn't find any related issue.

I hope that this problem could be solved.

Thank you for your help:)


i found a snipped to do this

private class TetherChangeReceiver extends BroadcastReceiver {
    public void onReceive(Context content, Intent intent) {
        if (intent.getAction().equals(ConnectivityManager.ACTION_TETHER_STATE_CHANGED)) {
            // TODO - this should understand the interface types
            ArrayList<String> available = intent.getStringArrayListExtra(
                    ConnectivityManager.EXTRA_AVAILABLE_TETHER);
            ArrayList<String> active = intent.getStringArrayListExtra(
                    ConnectivityManager.EXTRA_ACTIVE_TETHER);

            ArrayList<String> errored = intent.getStringArrayListExtra(
                    ConnectivityManager.EXTRA_ERRORED_TETHER);

        }

    }

}

apparently only on Android 2.3

0

精彩评论

暂无评论...
验证码 换一张
取 消