cant get connect event for mobile data network

melamoud

Active Member
Licensed User
Longtime User
hi,

I'm registering for android.net.conn.CONNECTIVITY_CHANGE
and I'm getting the WIFI connect / disconnect events
but only the mobile disconnect event
even when I'm connected to the 3g or 4g network - I can see that using the this code - can someone explain ?

B4X:
Dim ss As ServerSocket
Dim ip,wifiIP As String
ip = ss.GetMyIP()
wifiIP = ss.GetMyWifiIP()
If (ip <> wifiIP AND ip <> "127.0.0.1" AND ip <> "") Then
   Log ("My Mobile 3g/4g Ip is:" & ip)
   Return ip
End If
Log ("not connected to Mobile network: ip=" & ip & " WifiIP=" & wifiIP)
Return ""

the events I'm getting are: (from the phone library)
B4X:
'ConNot:In PE_ConnectivityChanged: mobile_ims, State = DISCONNECTED Intent=(Intent) Intent { act=android.net.conn.CONNECTIVITY_CHANGE flg=0x10000010 (has extras) }
'ConNot:PE_ConnectivityChange Intent Extra:Bundle[{extraInfo=VZWIMS, reason=dependencyMet, networkInfo=NetworkInfo: Type: mobile_ims(11)[LTE], State: DISCONNECTED/DISCONNECTED, reason: dependencyMet, extra: VZWIMS, roaming: False, failover: False, isAvailable: False, inetCondition=100}]

or from the recviver
B4X:
      'ConNot:Intent:(Intent) Intent { act=android.net.conn.CONNECTIVITY_CHANGE_IMMEDIATE flg=0x10000010 cmp=appsright.connectivitynotifier/.connectivitynotifier$connectivitynotifier_BR (has extras) }
      '( 1829): ConNot:Extra2String:Bundle[{reason=dataEnabled, networkInfo=NetworkInfo: Type: mobile_ims(11)[LTE], state: DISCONNECTED/DISCONNECTED, reason: dataEnabled, extra: VZWIMS, roaming: False, failover: False, isAvailable: True, extraInfo=VZWIMS, inetCondition=100}]
 

melamoud

Active Member
Licensed User
Longtime User
here it is

B4X:
Sub Service_Start (StartingIntent As Intent)   
   Log ("in Service_Start (BT)")
   '(Intent) Intent { act=android.bluetooth.device.action.ACL_DISCONNECTED cmp=appsright.btmonitoring/.btmonitoring$btmonitoring_BR (has extras) }
   Log ("intent:"&StartingIntent)
     'Bundle[{android.bluetooth.device.extra.DEVICE=00:0C:8A:4B:37:9D}]
     Log ("Extra2String:"&StartingIntent.ExtrasToString)
...

or the PE_ function
B4X:
Sub PE_ConnectivityChanged( networkType As String, State As String, Intent As Intent)    

   Log ("In PE_ConnectivityChanged: " & networkType & ", state = " & State & " Intent=" & Intent)    
   Log("PE_ConnectivityChange intent Extra:" & Intent.ExtrasToString)
 
Upvote 0

melamoud

Active Member
Licensed User
Longtime User
service is running

yes service is running, and I get multiple disconnect events all with the same data (intent) but no connect event - but the phone is connected to the mobile network
 
Upvote 0

melamoud

Active Member
Licensed User
Longtime User
This event just exposes the system intents. This is the data available.

Did you change the mobile network connected state?

yes I turned off the Wifi saw that mobile data is working

it might be a problem specific to my phone, I will check on others

thanks
 
Upvote 0
Top