mobileBroadbandNetwork.GetCellsInfoAsync() return null

~MrR ~ 0 Reputation points
2024-05-09T01:42:18.24+00:00
var mobileBroadbandAccounts = MobileBroadbandAccount.AvailableNetworkAccountIds;
LogInfo($"mobileBroadbandAccounts.Count {mobileBroadbandAccounts.Count}");


if (mobileBroadbandAccounts.Count > 0)
{
    var mobileBroadbandAccount = MobileBroadbandAccount.CreateFromNetworkAccountId(mobileBroadbandAccounts[0]);

    LogInfo($" NetworkAccountId : {mobileBroadbandAccount.NetworkAccountId}");

    var mobileBroadbandNetwork = mobileBroadbandAccount.CurrentNetwork;
    LogInfo($"AccessPointName {mobileBroadbandNetwork.AccessPointName}");
    LogInfo($"RegisteredProviderId {mobileBroadbandNetwork.RegisteredProviderId}");
    

    MobileBroadbandCellsInfo mobileBroadbandCellsInfo = null;
    bool voiceSupport =true;
    Task.Run(async () =>
    {
        mobileBroadbandCellsInfo = await mobileBroadbandNetwork.GetCellsInfoAsync();
        voiceSupport = await mobileBroadbandNetwork.GetVoiceCallSupportAsync();
    })
    .ContinueWith(t =>
    {

        if (null == mobileBroadbandCellsInfo)
        {
            
            LogInfo($"mobileBroadbandCellsInfo is null " );
            return;
        }
        var servingCellsLte = mobileBroadbandCellsInfo.NeighboringCellsLte;
        foreach (var cell in servingCellsLte)
        {
            LogInfo("power dbm " + cell.ReferenceSignalReceivedPowerInDBm);
            LogInfo("quality dbm " + cell.ReferenceSignalReceivedQualityInDBm);
            LogInfo(cell.ToString());
        }
    }, TaskScheduler.FromCurrentSynchronizationContext());
}

mobileBroadbandNetwork.GetCellsInfoAsync() always return null

Windows 11
Windows 11
A Microsoft operating system designed for productivity, creativity, and ease of use.
8,371 questions
0 comments No comments
{count} votes