Android ConnectionManager.NetworkCallback从未获得可用的回调

Android ConnectionManager.NetworkCallback从未获得可用的回调,android,network-programming,android-connectivitymanager,Android,Network Programming,Android Connectivitymanager,我正试图通过蜂窝网络强制执行网络请求。为此,我请求ConnectionManager进行移动网络回调,如下所示: private static final String LOG_TAG = "Main"; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main);

我正试图通过蜂窝网络强制执行网络请求。为此,我请求ConnectionManager进行移动网络回调,如下所示:

private static final String LOG_TAG = "Main";

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    final ConnectivityManager cm = (ConnectivityManager) getSystemService(
            Context.CONNECTIVITY_SERVICE);
    // Request the mobile network. This doesn't turn on the mobile network, it just gives the app a handle to it.
    NetworkRequest.Builder req = new NetworkRequest.Builder();
    req.addTransportType(NetworkCapabilities.TRANSPORT_CELLULAR);
    req.addCapability(NetworkCapabilities.NET_CAPABILITY_INTERNET);
    cm.requestNetwork(req.build(), new MobileNetworkCallback(cm), 60_000);
}

/**
 * Listens for the requested network on API 21+. When the network is available, the network request is done.
 */
private static class MobileNetworkCallback extends ConnectivityManager.NetworkCallback {
    ConnectivityManager connectivityManager;

    private MobileNetworkCallback(ConnectivityManager connectivityManager) {
        this.connectivityManager = connectivityManager;
    }

    @Override
    public void onAvailable(Network network) {
        Log.v(LOG_TAG, "got mobile network");
        connectivityManager.unregisterNetworkCallback(this);
    }

    @Override
    public void onUnavailable() {
        Log.v(LOG_TAG, "network unavailable");
        connectivityManager.unregisterNetworkCallback(this);
    }

}
即使当前已连接Wifi,这通常也有效。但是,有时即使存在有效的移动连接,我也会收到“不可用”回调

我记录了以下日志:

11-08 11:28:07.219   801  6062 I ActivityManager: START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com..mobiledatatester/.MainActivity (has extras)} from uid 10035
11-08 11:28:07.221   801  6062 I wm_task_created: [1538,1]
11-08 11:28:07.222   801  6062 I wm_task_moved: [1538,1,3]
11-08 11:28:07.222   801  6062 I am_focused_stack: [0,1,0,reuseOrNewTask]
11-08 11:28:07.222   801  6062 I wm_task_moved: [1538,1,3]
11-08 11:28:07.223   801  6062 I am_create_task: [0,1538]
11-08 11:28:07.223   801  6062 I am_create_activity: [0,199959326,1538,com..mobiledatatester/.MainActivity,android.intent.action.MAIN,NULL,NULL,270532608]
11-08 11:28:07.223   801  6062 I wm_task_moved: [1538,1,3]
11-08 11:28:07.224   801  6062 I am_pause_activity: [0,232275752,com.google.android.googlequicksearchbox/com.google.android.launcher.GEL]
11-08 11:28:07.234   586  8784 D audio_hw_primary: enable_snd_device: snd_device(2: speaker)
11-08 11:28:07.236   586  8784 D audio_hw_primary: enable_audio_route: usecase(1) apply and update mixer path: low-latency-playback speaker
11-08 11:28:07.242  4093  4093 I am_on_paused_called: [0,com.google.android.launcher.GEL,handlePauseActivity]
11-08 11:28:07.245   801  7491 I am_uid_running: 10189
11-08 11:28:07.262   801  7491 I am_proc_start: [0,25634,10189,com..mobiledatatester,activity,com..mobiledatatester/.MainActivity]
11-08 11:28:07.262   801  7491 I ActivityManager: Start proc 25634:com..mobiledatatester/u0a189 for activity com..mobiledatatester/.MainActivity
11-08 11:28:07.265 25634 25634 I zygote64: Late-enabling -Xcheck:jni
11-08 11:28:07.266   801   818 I sysui_count: [window_time_0,4]
11-08 11:28:07.266   801   818 I sysui_multi_action: [757,803,799,window_time_0,802,4]
11-08 11:28:07.314   801  6065 I am_proc_bound: [0,25634,com..mobiledatatester]
11-08 11:28:07.314 25634 25643 I zygote64: Debugger is no longer active
11-08 11:28:07.320   801  6065 I am_uid_active: 10189
11-08 11:28:07.320   801  6065 I am_restart_activity: [0,199959326,1538,com..mobiledatatester/.MainActivity]
11-08 11:28:07.321   801  6065 I am_set_resumed_activity: [0,com..mobiledatatester/.MainActivity,minimalResumeActivityLocked]
11-08 11:28:07.434   801  4175 D ConnectivityService: requestNetwork for uid/pid:10189/25634 NetworkRequest [ REQUEST id=72, [ Transports: CELLULAR Capabilities: INTERNET&NOT_RESTRICTED&TRUSTED&NOT_VPN] ]
11-08 11:28:07.435   801  1179 D Ethernet: got request NetworkRequest [ REQUEST id=72, [ Transports: CELLULAR Capabilities: INTERNET&NOT_RESTRICTED&TRUSTED&NOT_VPN] ] with score 0
11-08 11:28:07.435   801  1053 D WIFI    : got request NetworkRequest [ REQUEST id=72, [ Transports: CELLULAR Capabilities: INTERNET&NOT_RESTRICTED&TRUSTED&NOT_VPN] ] with score 0
11-08 11:28:07.435   801  1053 D WIFI_UT : got request NetworkRequest [ REQUEST id=72, [ Transports: CELLULAR Capabilities: INTERNET&NOT_RESTRICTED&TRUSTED&NOT_VPN] ] with score 0
11-08 11:28:07.435  1952  1952 D TelephonyNetworkFactory[0]: got request NetworkRequest [ REQUEST id=72, [ Transports: CELLULAR Capabilities: INTERNET&NOT_RESTRICTED&TRUSTED&NOT_VPN] ] with score 0
11-08 11:28:07.435  1952  1952 D PhoneSwitcherNetworkRequstListener: got request NetworkRequest [ REQUEST id=72, [ Transports: CELLULAR Capabilities: INTERNET&NOT_RESTRICTED&TRUSTED&NOT_VPN] ] with score 0
11-08 11:28:07.436  1952  1952 D TelephonyNetworkFactory[0]: onNeedNetworkFor NetworkRequest [ REQUEST id=72, [ Transports: CELLULAR Capabilities: INTERNET&NOT_RESTRICTED&TRUSTED&NOT_VPN] ]
11-08 11:28:07.436  1952  1952 D PhoneSwitcher: evaluating due to netRequest
11-08 11:28:07.437  1952  1952 D DCT     : [0]onEnableApn: apnContext={mApnType=default mState=IDLE mWaitingApns={[[ApnSettingV3] T-Mobile GPRS, 794, 310260, fast.t-mobile.com, , , , , , -1, default | supl, IPV6, IP, true, 0, 0, 0, false, 0, 0, 0, 1440, , , false]} mApnSetting={null} mReason=dataEnabled mDataEnabled=true mDependencyMet=true} call applyNewState
11-08 11:28:07.437  1952  1952 D DCT     : [0]applyNewState(default, true(true), true(true))
11-08 11:28:07.437  1952  1952 D DCT     : [0]cleanUpConnection: X tearDown=true reason=dataEnabled apnContext={mApnType=default mState=IDLE mWaitingApns={[[ApnSettingV3] T-Mobile GPRS, 794, 310260, fast.t-mobile.com, , , , , , -1, default | supl, IPV6, IP, true, 0, 0, 0, false, 0, 0, 0, 1440, , , false]} mApnSetting={null} mReason=dataEnabled mDataEnabled=true mDependencyMet=true} dcac=null
11-08 11:28:07.438  1952  1952 D DCT     : [0]trySetupData for type:default due to dataEnabled, mIsPsRestricted=false
11-08 11:28:07.440 25634 25634 I am_on_resume_called: [0,com..mobiledatatester.MainActivity,LAUNCH_ACTIVITY]
11-08 11:28:07.442  1952  1952 D DCT     : [0]Default data call activation not allowed in iwlan.
11-08 11:28:07.451 25634 25653 D OpenGLRenderer: HWUI GL Pipeline
11-08 11:28:07.460  1952  1952 D DCT     : [0]Default data call activation not possible in iwlan.
11-08 11:28:07.471  1952  1952 D DCT     : [0]Default data call activation not allowed in iwlan.
11-08 11:28:07.471  1952  1952 D DCT     : [0]isEmergency: result=false
11-08 11:28:07.471  1952  1952 D DCT     : [0]trySetupData failed. apnContext = [type=default, mState=IDLE, mDataEnabled=true, mDependencyMet=true]. isDataAllowedForApn = false. RAT = 18.
11-08 11:28:07.493 25634 25653 I Adreno  : QUALCOMM build                   : 7142022, Ib5823dd10c
11-08 11:28:07.493 25634 25653 I Adreno  : Build Date                       : 06/23/17
11-08 11:28:07.493 25634 25653 I Adreno  : OpenGL ES Shader Compiler Version: EV031.18.00.00
11-08 11:28:07.493 25634 25653 I Adreno  : Local Branch                     : O11A
11-08 11:28:07.493 25634 25653 I Adreno  : Remote Branch                    :
11-08 11:28:07.493 25634 25653 I Adreno  : Remote Branch                    :
11-08 11:28:07.493 25634 25653 I Adreno  : Reconstruct Branch               :
11-08 11:28:07.493 25634 25653 I vndksupport: sphal namespace is not configured for this process. Loading /vendor/lib64/hw/gralloc.msm8994.so from the current namespace instead.
11-08 11:28:07.498 25634 25653 I Adreno  : PFP: 0x00000000, ME: 0x00000000
11-08 11:28:07.501 25634 25653 I OpenGLRenderer: Initialized EGL, version 1.4
11-08 11:28:07.501 25634 25653 D OpenGLRenderer: Swap behavior 2
11-08 11:28:07.521   369   369 W /system/bin/hwservicemanager: getTransportFromManifest: Cannot find entry android.hardware.graphics.mapper@2.0::IMapper in either framework or device manifest, using default transport.
11-08 11:28:07.523 25634 25653 I vndksupport: sphal namespace is not configured for this process. Loading /vendor/lib64/hw/gralloc.msm8994.so from the current namespace instead.
11-08 11:28:07.543   801   826 I sysui_multi_action: [319,106,321,64,322,321,325,11519,757,761,758,7,759,1,806,com..mobiledatatester,871,com..mobiledatatester.MainActivity,905,0,945,98]
11-08 11:28:07.543   801   826 I am_activity_launch_time: [0,199959326,com..mobiledatatester/.MainActivity,294,294]
11-08 11:28:07.543   801   826 I ActivityManager: Displayed com..mobiledatatester/.MainActivity: +294ms
11-08 11:28:07.716   801   818 I am_stop_activity: [0,232275752,com.google.android.googlequicksearchbox/com.google.android.launcher.GEL]
11-08 11:28:07.743  4093  4093 I am_on_stop_called: [0,com.google.android.launcher.GEL,handleStopActivity]
11-08 11:28:07.756   586   747 D audio_hw_primary: disable_audio_route: usecase(1) reset and update mixer path: low-latency-playback speaker
11-08 11:28:07.760 13786 13786 I PBSessionCacheImpl: Deleted sessionId[4344428655197] from persistence.
11-08 11:28:07.762   586   747 D audio_hw_primary: disable_snd_device: snd_device(2: speaker)
11-08 11:28:09.339 25634 25643 I zygote64: Ignoring second debugger -- accepting and dropping
11-08 11:28:09.365   576   874 E QC-QMI  : linux_qmi_qmux_io_wake_lock: Err in writing wakelock=qmuxd_port_wl_0, error [1:Operation not permitted]
11-08 11:28:09.366   576   874 E QC-QMI  : linux_qmi_qmux_io_wake_unlock: Err in writing wakelock=qmuxd_port_wl_0, error [1:Operation not permitted]
11-08 11:28:09.373  5346  5346 I CarrierServices: [2] n.a: CellServiceUtils.getRegisteredCellInfo, no coarse location permission.
11-08 11:28:09.389  5346  5346 D ConnectivityManager: getMobileDataEnabled()+ subId=8
11-08 11:28:09.390  5346  5346 D ConnectivityManager: getMobileDataEnabled()- subId=8 retVal=true
11-08 11:28:12.825  3986 25622 I PlaceInferenceEngine: [anon] Changed inference mode: 105
11-08 11:28:12.838  3986  3986 I GeofencerStateMachine: removeGeofences: removeRequest=RemoveGeofencingRequest[REMOVE_BY_PENDING_INTENT pendingIntent=PendingIntent[creatorPackage=com.google.android.gms], packageName=null]
11-08 11:28:12.862  3986  3986 I chatty  : uid=10017(u0_a17) com.google.android.gms.persistent identical 2 lines
11-08 11:28:12.866  3986  3986 I GeofencerStateMachine: removeGeofences: removeRequest=RemoveGeofencingRequest[REMOVE_BY_PENDING_INTENT pendingIntent=PendingIntent[creatorPackage=com.google.android.gms], packageName=null]
11-08 11:28:13.214   576   874 E QC-QMI  : linux_qmi_qmux_io_wake_lock: Err in writing wakelock=qmuxd_port_wl_0, error [1:Operation not permitted]
11-08 11:28:13.215   576   874 E QC-QMI  : linux_qmi_qmux_io_wake_unlock: Err in writing wakelock=qmuxd_port_wl_0, error [1:Operation not permitted]
11-08 11:28:13.222  5346  5346 I CarrierServices: [2] n.a: CellServiceUtils.getRegisteredCellInfo, no coarse location permission.
11-08 11:28:13.236  5346  5346 D ConnectivityManager: getMobileDataEnabled()+ subId=8
11-08 11:28:13.237  5346  5346 D ConnectivityManager: getMobileDataEnabled()- subId=8 retVal=true
11-08 11:28:17.054   576   874 E QC-QMI  : linux_qmi_qmux_io_wake_lock: Err in writing wakelock=qmuxd_port_wl_0, error [1:Operation not permitted]
11-08 11:28:17.055   576   874 E QC-QMI  : linux_qmi_qmux_io_wake_unlock: Err in writing wakelock=qmuxd_port_wl_0, error [1:Operation not permitted]
11-08 11:28:17.064  5346  5346 I CarrierServices: [2] n.a: CellServiceUtils.getRegisteredCellInfo, no coarse location permission.
11-08 11:28:17.076  5346  5346 D ConnectivityManager: getMobileDataEnabled()+ subId=8
11-08 11:28:17.077  5346  5346 D ConnectivityManager: getMobileDataEnabled()- subId=8 retVal=true
11-08 11:28:17.787 13786 25663 I EventLogSendingHelper: Sending log events.
11-08 11:28:17.859   801   817 I am_pss  : [25634,10189,com..mobiledatatester,37364736,34234368,9216]
11-08 11:28:19.615   576   874 E QC-QMI  : linux_qmi_qmux_io_wake_lock: Err in writing wakelock=qmuxd_port_wl_0, error [1:Operation not permitted]
11-08 11:28:19.615   576   874 E QC-QMI  : linux_qmi_qmux_io_wake_unlock: Err in writing wakelock=qmuxd_port_wl_0, error [1:Operation not permitted]
11-08 11:28:19.623  5346  5346 I CarrierServices: [2] n.a: CellServiceUtils.getRegisteredCellInfo, no coarse location permission.
11-08 11:28:19.636  5346  5346 D ConnectivityManager: getMobileDataEnabled()+ subId=8
11-08 11:28:19.638  5346  5346 D ConnectivityManager: getMobileDataEnabled()- subId=8 retVal=true
11-08 11:28:22.175   576   874 E QC-QMI  : linux_qmi_qmux_io_wake_lock: Err in writing wakelock=qmuxd_port_wl_0, error [1:Operation not permitted]
11-08 11:28:22.175   576   874 E QC-QMI  : linux_qmi_qmux_io_wake_unlock: Err in writing wakelock=qmuxd_port_wl_0, error [1:Operation not permitted]
11-08 11:28:22.183  5346  5346 I CarrierServices: [2] n.a: CellServiceUtils.getRegisteredCellInfo, no coarse location permission.
11-08 11:28:22.197  5346  5346 D ConnectivityManager: getMobileDataEnabled()+ subId=8
11-08 11:28:22.199  5346  5346 D ConnectivityManager: getMobileDataEnabled()- subId=8 retVal=true
11-08 11:28:24.735   576   874 E QC-QMI  : linux_qmi_qmux_io_wake_lock: Err in writing wakelock=qmuxd_port_wl_0, error [1:Operation not permitted]
11-08 11:28:24.735   576   874 E QC-QMI  : linux_qmi_qmux_io_wake_unlock: Err in writing wakelock=qmuxd_port_wl_0, error [1:Operation not permitted]
11-08 11:28:24.743  5346  5346 I CarrierServices: [2] n.a: CellServiceUtils.getRegisteredCellInfo, no coarse location permission.
11-08 11:28:24.757  5346  5346 D ConnectivityManager: getMobileDataEnabled()+ subId=8
11-08 11:28:24.759  5346  5346 D ConnectivityManager: getMobileDataEnabled()- subId=8 retVal=true
11-08 11:28:27.295   576   874 E QC-QMI  : linux_qmi_qmux_io_wake_lock: Err in writing wakelock=qmuxd_port_wl_0, error [1:Operation not permitted]
11-08 11:28:27.295   576   874 E QC-QMI  : linux_qmi_qmux_io_wake_unlock: Err in writing wakelock=qmuxd_port_wl_0, error [1:Operation not permitted]
11-08 11:28:27.303  5346  5346 I CarrierServices: [2] n.a: CellServiceUtils.getRegisteredCellInfo, no coarse location permission.
11-08 11:28:27.318  5346  5346 D ConnectivityManager: getMobileDataEnabled()+ subId=8
11-08 11:28:27.319  5346  5346 D ConnectivityManager: getMobileDataEnabled()- subId=8 retVal=true
11-08 11:28:32.415   576   874 E QC-QMI  : linux_qmi_qmux_io_wake_lock: Err in writing wakelock=qmuxd_port_wl_0, error [1:Operation not permitted]
11-08 11:28:32.415   576   874 E QC-QMI  : linux_qmi_qmux_io_wake_unlock: Err in writing wakelock=qmuxd_port_wl_0, error [1:Operation not permitted]
11-08 11:28:32.424  5346  5346 I CarrierServices: [2] n.a: CellServiceUtils.getRegisteredCellInfo, no coarse location permission.
11-08 11:28:32.439  5346  5346 D ConnectivityManager: getMobileDataEnabled()+ subId=8
11-08 11:28:32.441  5346  5346 D ConnectivityManager: getMobileDataEnabled()- subId=8 retVal=true
11-08 11:28:34.975   576   874 E QC-QMI  : linux_qmi_qmux_io_wake_lock: Err in writing wakelock=qmuxd_port_wl_0, error [1:Operation not permitted]
11-08 11:28:34.975   576   874 E QC-QMI  : linux_qmi_qmux_io_wake_unlock: Err in writing wakelock=qmuxd_port_wl_0, error [1:Operation not permitted]
11-08 11:28:34.984  5346  5346 I CarrierServices: [2] n.a: CellServiceUtils.getRegisteredCellInfo, no coarse location permission.
11-08 11:28:34.997  5346  5346 D ConnectivityManager: getMobileDataEnabled()+ subId=8
11-08 11:28:34.999  5346  5346 D ConnectivityManager: getMobileDataEnabled()- subId=8 retVal=true
11-08 11:28:40.095   576   874 E QC-QMI  : linux_qmi_qmux_io_wake_lock: Err in writing wakelock=qmuxd_port_wl_0, error [1:Operation not permitted]
11-08 11:28:40.095   576   874 E QC-QMI  : linux_qmi_qmux_io_wake_unlock: Err in writing wakelock=qmuxd_port_wl_0, error [1:Operation not permitted]
11-08 11:28:40.105  5346  5346 I CarrierServices: [2] n.a: CellServiceUtils.getRegisteredCellInfo, no coarse location permission.
11-08 11:28:40.119  5346  5346 D ConnectivityManager: getMobileDataEnabled()+ subId=8
11-08 11:28:40.121  5346  5346 D ConnectivityManager: getMobileDataEnabled()- subId=8 retVal=true
11-08 11:28:42.655   576   874 E QC-QMI  : linux_qmi_qmux_io_wake_lock: Err in writing wakelock=qmuxd_port_wl_0, error [1:Operation not permitted]
11-08 11:28:42.655   576   874 E QC-QMI  : linux_qmi_qmux_io_wake_unlock: Err in writing wakelock=qmuxd_port_wl_0, error [1:Operation not permitted]
11-08 11:28:42.663  5346  5346 I CarrierServices: [2] n.a: CellServiceUtils.getRegisteredCellInfo, no coarse location permission.
11-08 11:28:42.679  5346  5346 D ConnectivityManager: getMobileDataEnabled()+ subId=8
11-08 11:28:42.681  5346  5346 D ConnectivityManager: getMobileDataEnabled()- subId=8 retVal=true
11-08 11:28:43.935   576   874 E QC-QMI  : linux_qmi_qmux_io_wake_lock: Err in writing wakelock=qmuxd_port_wl_0, error [1:Operation not permitted]
11-08 11:28:43.935   576   874 E QC-QMI  : linux_qmi_qmux_io_wake_unlock: Err in writing wakelock=qmuxd_port_wl_0, error [1:Operation not permitted]
11-08 11:28:43.942  5346  5346 I CarrierServices: [2] n.a: CellServiceUtils.getRegisteredCellInfo, no coarse location permission.
11-08 11:28:43.960  5346  5346 D ConnectivityManager: getMobileDataEnabled()+ subId=8
11-08 11:28:43.961  5346  5346 D ConnectivityManager: getMobileDataEnabled()- subId=8 retVal=true
11-08 11:28:47.775   576   874 E QC-QMI  : linux_qmi_qmux_io_wake_lock: Err in writing wakelock=qmuxd_port_wl_0, error [1:Operation not permitted]
11-08 11:28:47.775   576   874 E QC-QMI  : linux_qmi_qmux_io_wake_unlock: Err in writing wakelock=qmuxd_port_wl_0, error [1:Operation not permitted]
11-08 11:28:47.783  5346  5346 I CarrierServices: [2] n.a: CellServiceUtils.getRegisteredCellInfo, no coarse location permission.
11-08 11:28:47.799  5346  5346 D ConnectivityManager: getMobileDataEnabled()+ subId=8
11-08 11:28:47.800  5346  5346 D ConnectivityManager: getMobileDataEnabled()- subId=8 retVal=true
11-08 11:28:47.890   801   817 I am_pss  : [4093,10035,com.google.android.googlequicksearchbox,87817216,74682368,8192]
11-08 11:28:50.335   576   874 E QC-QMI  : linux_qmi_qmux_io_wake_lock: Err in writing wakelock=qmuxd_port_wl_0, error [1:Operation not permitted]
11-08 11:28:50.335   576   874 E QC-QMI  : linux_qmi_qmux_io_wake_unlock: Err in writing wakelock=qmuxd_port_wl_0, error [1:Operation not permitted]
11-08 11:28:50.344  5346  5346 I CarrierServices: [2] n.a: CellServiceUtils.getRegisteredCellInfo, no coarse location permission.
11-08 11:28:50.358  5346  5346 D ConnectivityManager: getMobileDataEnabled()+ subId=8
11-08 11:28:50.360  5346  5346 D ConnectivityManager: getMobileDataEnabled()- subId=8 retVal=true
11-08 11:28:51.914  1952  1952 D DCT     : [0]Data stall alarm
11-08 11:28:51.981  3986 25676 E AppUsageEventWatcher: wrong time range: [1510165154112, 1510162131978)
11-08 11:28:52.895   576   874 E QC-QMI  : linux_qmi_qmux_io_wake_lock: Err in writing wakelock=qmuxd_port_wl_0, error [1:Operation not permitted]
11-08 11:28:52.895   576   874 E QC-QMI  : linux_qmi_qmux_io_wake_unlock: Err in writing wakelock=qmuxd_port_wl_0, error [1:Operation not permitted]
11-08 11:28:52.902  5346  5346 I CarrierServices: [2] n.a: CellServiceUtils.getRegisteredCellInfo, no coarse location permission.
11-08 11:28:52.917  5346  5346 D ConnectivityManager: getMobileDataEnabled()+ subId=8
11-08 11:28:52.918  5346  5346 D ConnectivityManager: getMobileDataEnabled()- subId=8 retVal=true
11-08 11:28:55.455   576   874 E QC-QMI  : linux_qmi_qmux_io_wake_lock: Err in writing wakelock=qmuxd_port_wl_0, error [1:Operation not permitted]
11-08 11:28:55.455   576   874 E QC-QMI  : linux_qmi_qmux_io_wake_unlock: Err in writing wakelock=qmuxd_port_wl_0, error [1:Operation not permitted]
11-08 11:28:55.464  5346  5346 I CarrierServices: [2] n.a: CellServiceUtils.getRegisteredCellInfo, no coarse location permission.
11-08 11:28:55.479  5346  5346 D ConnectivityManager: getMobileDataEnabled()+ subId=8
11-08 11:28:55.481  5346  5346 D ConnectivityManager: getMobileDataEnabled()- subId=8 retVal=true
11-08 11:29:00.005   801   801 I ActivityManager: Killing 24197:com.android.providers.calendar/u0a2 (adj 906): empty for 1800s
11-08 11:29:00.005   801   801 I am_kill : [0,24197,com.android.providers.calendar,906,empty for 1800s]
11-08 11:29:00.068   801  2148 I am_proc_died: [0,24197,com.android.providers.calendar,906,17]
11-08 11:29:00.069   801  2148 I am_uid_stopped: 10002
11-08 11:29:00.092   801   817 I am_pss  : [13786,10035,com.google.android.googlequicksearchbox:search,48027648,40529920,10240]
11-08 11:29:00.128   801   817 I am_pss  : [18565,10028,com.android.vending:instant_app_installer,10842112,3805184,0]
11-08 11:29:00.575   576   874 E QC-QMI  : linux_qmi_qmux_io_wake_lock: Err in writing wakelock=qmuxd_port_wl_0, error [1:Operation not permitted]
11-08 11:29:00.575   576   874 E QC-QMI  : linux_qmi_qmux_io_wake_unlock: Err in writing wakelock=qmuxd_port_wl_0, error [1:Operation not permitted]
11-08 11:29:00.583  5346  5346 I CarrierServices: [2] n.a: CellServiceUtils.getRegisteredCellInfo, no coarse location permission.
11-08 11:29:00.598  5346  5346 D ConnectivityManager: getMobileDataEnabled()+ subId=8
11-08 11:29:00.600  5346  5346 D ConnectivityManager: getMobileDataEnabled()- subId=8 retVal=true
11-08 11:29:05.695   576   874 E QC-QMI  : linux_qmi_qmux_io_wake_lock: Err in writing wakelock=qmuxd_port_wl_0, error [1:Operation not permitted]
11-08 11:29:05.695   576   874 E QC-QMI  : linux_qmi_qmux_io_wake_unlock: Err in writing wakelock=qmuxd_port_wl_0, error [1:Operation not permitted]
11-08 11:29:05.703  5346  5346 I CarrierServices: [2] n.a: CellServiceUtils.getRegisteredCellInfo, no coarse location permission.
11-08 11:29:05.719  5346  5346 D ConnectivityManager: getMobileDataEnabled()+ subId=8
11-08 11:29:05.722  5346  5346 D ConnectivityManager: getMobileDataEnabled()- subId=8 retVal=true
11-08 11:29:07.495   801  1058 D ConnectivityService: releasing NetworkRequest [ REQUEST id=72, [ Transports: CELLULAR Capabilities: INTERNET&NOT_RESTRICTED&TRUSTED&NOT_VPN] ] (CALLBACK_UNAVAIL)
11-08 11:29:07.503 25634 25652 V Main    : network unavailable

iwlan中不允许默认数据调用激活

令人担忧,但我不知道它们到底是什么意思


在处理网络回调时,是否有正确的方法来确保始终调用“可用”回调?

在某些Android 6设备上,有时不调用可用回调时,我会遇到类似的问题。我的印象是这个API在这些设备上有缺陷:(你在使用什么设备,你在使用一个库存ROM?