Android Question Is it possible to detect if a hardware mobile data connection exists (GPRS) on a device?

bgsoft

Well-Known Member
Licensed User
Longtime User
Is it possible to detect if a hardware mobile data connection exists (GPRS) on a device?

similar to this (hardware keyboard exists, By Erel):

B4X:
Sub HardwareKeyboardPresent As Boolean
  Dim r As Reflector
  r.Target = r.GetContext
  r.Target = r.RunMethod("getResources")
  r.Target = r.RunMethod("getConfiguration")
  Dim keyboard As Int = r.GetField("keyboard")
  Return keyboard <> 1'KEYBOARD_NOKEYS  
End Sub

regards
 

bgsoft

Well-Known Member
Licensed User
Longtime User
I want to know if the device has gprs connection (data connection), for example, a tablet, sometimes do not have and only have wifi.

I've tried GetPhoneType (Phone library) and with this I can say, but do not want to add a new library to my application.
So wondering if there is something similar to see if there is a hard keyboard.

thanks

regards
 
Upvote 0

bgsoft

Well-Known Member
Licensed User
Longtime User
If I add a library more. when I compile the application size is increased. And I try to make it as small as possible.

I use the library reflection. I wanted to know if I can use a similar method which is used to see if there hard keyboard. To find out if exists GPRS

Sub HardwareKeyboardPresent AsBooleanDim

r AsReflector
r.Target = r.GetContext
r.Target = r.RunMethod("getResources")
r.Target = r.RunMethod("getConfiguration")

Dim keyboard AsInt = r.GetField("keyboard")
Return keyboard <> 1'KEYBOARD_NOKEYS
End Sub

regards
 
Upvote 0
Top