Make sure that the Status bar
is not hidden in your application.
if it's not visible it will always return No wifi or cellular
because your code reads the text in the Status bar
thats all.
this is the best way to solve your problem, just make the Status bar
not hidden then the application will get the text about the network type.