Android 10(Q)中的Wifi网络请求Api连接问题 [英] Wifi Network Request Api connection issue in android 10 (Q)

查看:107
本文介绍了Android 10(Q)中的Wifi网络请求Api连接问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用android Wifi网络请求Api 一切正常,它的显示对话框用于连接到我的给定网络,然后单击连接回调

i am trying to add network using android Wifi Network Request Api every thing is going fine its showing dialog for connect to my given network and click on connect callback onAvailable() method also called but it waits for some time and then after its switch back to last connected network which having internet

应用视频链接

推荐答案

我知道答案已经很晚了,但也许有人会帮忙.

I know it is very late to answer but maybe someone helps.

您必须将网络绑定到连接.

You have to bind your network to the connection.

@Override
 public void onAvailable(Network network)
 {
    try
    {
        super.onAvailable(network);
        if (SDK_INT >= VERSION_CODES.M)
        { manager.bindProcessToNetwork(network);
        }
        else
        { ConnectivityManager.setProcessDefaultNetwork(network);
        }
        ...

这篇关于Android 10(Q)中的Wifi网络请求Api连接问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆