BlackBerry: track GPRS and Wi-Fi usage separately

Does anyone know a way to use only GPRS data ( excluding Wifi data) programmatically?

RadioInfo.getNumberOfPacketsReceived() 

and

 RadioInfo.getNumberOfPacketsSent() 

return the received and sent totals . But I want to get GPRS data received and sent (optionally, the number of Wifi data) .

A sample application called miniMoni seems to do this. But I could find sample code for this task. Please give me some advice on this?

Please note that I want to get general use of the GPRS device, and not the use of a single application .

+4
source share
1 answer

Disclaimer: I am not a RIM expert, but ... there is a key to a possible way to do this on the page that is linked above, where it talks about the transport descriptor.

If you can get a TransportDescripter (accessible from API v5.0.0), you probably know if the data will be routed through GPRS or WiFi (note that this is NOT the same as opening a connection).

If you know this, you can use RadioInfo.GetNumberOfPacketsSent and RadioInfo.GetNumberOfPacketsReceived to calculate the packets that are sent and received when you have a GPRS connection.

Connect
Get TransportDescriptor = GPRS
Receive Packages / Receive
Receive Packages / Receive
WiFi Switches
Receive Packages / Receive Immediately (I)
GPRS packets = packets (I)
GPRS Connection
Receive Packages / Receive Immediately (II)
WiFi packets = packets (II) minus packets (I)
etc.

It only gives an estimate and includes a bit of dirty code. As I said, this is just an assumption from reading the documentation ... I would be interested if someone points out why this method does not work, though.

+1
source

All Articles