Need to know how NetworkMonitor lib works

sergiokv

Member
Licensed User
Longtime User
Does anyone have any example where the NetworkMonitor lib is being used?

I would like the know whats the main syntax that needs to be used

Thanks again to everyone who has help me so far with my questions!

Below is an example of the program that I'm writting just to see how it works, but haven't been able to compile it:

Sub Process_Globals

Dim tracker As NetworkMonitor
Dim g As Long

End Sub

Sub Service_Create

Dim r As String
tracker.Initialize ("r")

End Sub

Sub Service_Start (StartingIntent As Intent)
Dim g As Long
tracker.MobileRxBytes(g As Long)

End Sub

Sub Service_Destroy

End Sub
 

vb1992

Well-Known Member
Licensed User
Longtime User
B4X:
Sub Process_Globals
 
Dim NetStats As NetworkMonitor      
Dim Timer1 As Timer
 
End Sub

Sub Globals
    
End Sub

Sub Activity_Create(FirstTime As Boolean)


 
 Netstats.Initialize("Netstats")

Timer1.Initialize("Timer1",500)

   Timer1.Enabled=True
 
End Sub



Sub timer1_tick

Activity.title = NetStats.MobileRxBytes
 

End Sub
 
Upvote 0

sergiokv

Member
Licensed User
Longtime User
I did get a -1 too, Tomas (Aka XverhelstX) just replied in other of my questions and told me that the lib has a bug and he will be fixing it later, so I'll let you know when it's fixed and working.
 
Upvote 0

alain bertrand

Member
Licensed User
Longtime User
don't find out the NetworkMonitor lib

Sorry for a so stupid question.
Where is this NetworkMonitor lib ?
I failed to find it on the B4A site.

Thanks for your help.
 
Upvote 0

alain bertrand

Member
Licensed User
Longtime User
seems not working. How to get around ?

Erel,
Thanks for your response.
NetworkMonitor returns -1 and the log is about 2 missing files:
"/sys/class/net/rmnet0/statistics/rx_bytes" and
"/sys/class/net/ppp0/statistics/rx_bytes".

Actually, both files are not in my Android 2.2 phone nor in the AVD.

If it is just a matter of reading an Android log file, B4A is brave enough. No need for a java lib.

Android counts up traffic into /sys/class/net/[device]/ (for network device) and in /proc/uid_stat/[uid]/tcp_rcv and tcp_snd (for the app).
The later is working fine with Android 2.2.

Question: Is the path '/proc/uid_stat/[uid]/...' kept over Android versions > 2.2 ?
Regards.
 
Upvote 0
Top