I want to know if it is possible to determine the current mobile data connection in the status bar. I know it is possible to read things such as cellular strength, wifi strength, phone battery, time etc.
You can get the current celluar strength in xamarin using:
UIStatusBarManager statusBarManager = UIApplication.SharedApplication.KeyWindow.WindowScene?.StatusBarManager;
NSObject localStatusBar = (NSObject)statusBarManager.ValueForKey(new NSString("createLocalStatusBar"));
NSObject statusBar = (NSObject)localStatusBar.ValueForKey(new NSString("statusBar"));
UIView statusBar1 = (UIView)statusBar.ValueForKey(new NSString("_statusBar"));
NSObject currentData = (NSObject)statusBar1.ValueForKey(new NSString("currentData"));
NSObject cellularEntry = (NSObject)currentData.ValueForKey(new NSString("cellularEntry"));
Number)cellularEntry.ValueForKey(new NSString("displayValue"))).Int32Value;
and in swift
if let statusBarManager = UIApplication.shared.keyWindow?.windowScene?.statusBarManager,
let localStatusBar = statusBarManager.value(forKey: "createLocalStatusBar") as? NSObject,
let statusBar = localStatusBar.value(forKey: "statusBar") as? NSObject,
let _statusBar = statusBar.value(forKey: "_statusBar") as? UIView,
let currentData = _statusBar.value(forKey: "currentData") as? NSObject,
let celluar = currentData.value(forKey: "cellularEntry") as? NSObject,
let signalStrength = celluar.value(forKey: "displayValue") as? Int {
return signalStrength
If possible I would like the result in Xamarin but if given in Object C or Swift I can try and translate that so no worries.