【问题标题】:Network state listener using broadcast receiver not working in Android 7.0?使用广播接收器的网络状态侦听器在 Android 7.0 中不起作用?
【发布时间】:2017-11-18 23:26:11
【问题描述】:

错误:

NetworkSecurityConfig: No Network Security Config specified, using platform default.

【问题讨论】:

    标签: android android-studio android-7.0-nougat


    【解决方案1】:

    是的,旧方法已被弃用,您应该使用这个:

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
       registerReceiver(new ConnectionCheck(), new IntentFilter("android.net.conn.CONNECTIVITY_CHANGE"));
    } 
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2020-09-14
      • 2018-09-14
      • 2017-07-10
      • 2017-10-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多