BlackBerryForums.com : Your Number One BlackBerry Community
     

»Sponsored Links


BlackBerryApps.com Best Sellers



Reply
 
LinkBack Thread Tools
  (#1 (permalink)) Old
misty83 Offline
Thumbs Must Hurt
 
Posts: 73
Join Date: Jan 2009
Model: 7100T
PIN: N/A
Carrier: -
Default is it possible to check when a user has connected(disconnected) to the internet? - 07-03-2009, 01:04 PM

hi,
is it possible programatically to check that the user has just connected (disconnected) to the internet?

kind regards
   
Reply With Quote
Sponsored Links
Please Login or Register to Remove these Advertisements!

  (#2 (permalink)) Old
hrbuckley Offline
CrackBerry Addict
 
Posts: 831
Join Date: Jan 2006
Model: 9000
OS: 4.6.0.303
Carrier: Rogers CA
Default 07-03-2009, 01:16 PM

What do you mean? If you want to know if another program has opened or closed an http connection, then not unless that program implements an API to provide that information. If you want to know if the unit is configured and in service to enable a particular type of connection, then yes.


BPS/Zarafa
   
Reply With Quote
  (#3 (permalink)) Old
misty83 Offline
Thumbs Must Hurt
 
Posts: 73
Join Date: Jan 2009
Model: 7100T
PIN: N/A
Carrier: -
Default 07-03-2009, 01:34 PM

i must check if user:

-opens a browser (couse that means ofcourse that he is using internet)
-opens an application that (for example) download or send some files using internet

what i must to do is a log-every day i must write into a file for how long user was using internet, how many data did he received/sent. for receiving/sending data i know that there is RadioInfo.getNumberOfPacketsSent/Received but as i checked-it always returns something even if i do not run any application that connects to the internet and the browser is closed..

so i was wondering if there is any method that will tell me that (par example) the user has started/finished using a browser or an application (that connects to the internet).-cause having such methods i could simply count for how long the internet was used and also-when disconnected-i can get the packets sent/received.

can You please suggst me anything? cause i'm trying to solve it from yesterday and have no more ideas..
   
Reply With Quote
  (#4 (permalink)) Old
hrbuckley Offline
CrackBerry Addict
 
Posts: 831
Join Date: Jan 2006
Model: 9000
OS: 4.6.0.303
Carrier: Rogers CA
Default 07-04-2009, 02:03 PM

A BES will do that for you, I don't know if it would be possible for a third party application to find out what the browser is up to. That would run counter to Blackberry security.


BPS/Zarafa
   
Reply With Quote
  (#5 (permalink)) Old
misty83 Offline
Thumbs Must Hurt
 
Posts: 73
Join Date: Jan 2009
Model: 7100T
PIN: N/A
Carrier: -
Default 07-05-2009, 01:33 AM

i do not want to check what the browser does (which pages user has visited etc). i just need to recognize when user has started using internet and when finished it..
   
Reply With Quote
  (#6 (permalink)) Old
hrbuckley Offline
CrackBerry Addict
 
Posts: 831
Join Date: Jan 2006
Model: 9000
OS: 4.6.0.303
Carrier: Rogers CA
Default 07-05-2009, 09:55 PM

That would be a very difficult metric to validate, even if you could find that information which I don't think you can outside of the BES.

For example, I could start the browser and open a page, then put the browser in the background for several hours before coming back to it later without ever closing it. In fact the Blackberry browser never exits. The most you can do is go back to the start page. This is because one of the things the Blackberry browser does is listen for push data.

The BES can tell you when a particular page was loaded, but that is about it.


BPS/Zarafa
   
Reply With Quote
  (#7 (permalink)) Old
misty83 Offline
Thumbs Must Hurt
 
Posts: 73
Join Date: Jan 2009
Model: 7100T
PIN: N/A
Carrier: -
Default 07-06-2009, 02:19 AM

ok, maybe let's try differently. i saw an application on bb which checks every day how many data did user sent/received from internet. i would like to do something similar for me. how can i do that?
   
Reply With Quote
  (#8 (permalink)) Old
hrbuckley Offline
CrackBerry Addict
 
Posts: 831
Join Date: Jan 2006
Model: 9000
OS: 4.6.0.303
Carrier: Rogers CA
Default 07-06-2009, 12:07 PM

RadioInfo.getNumberOfPacketsReceived() and RadioInfo.getNumberOfPacketsSent()


BPS/Zarafa
   
Reply With Quote
  (#9 (permalink)) Old
misty83 Offline
Thumbs Must Hurt
 
Posts: 73
Join Date: Jan 2009
Model: 7100T
PIN: N/A
Carrier: -
Default 07-07-2009, 02:07 AM

i know these methods. but look-You must know when to call them. when? when user starts using internet.. so that is the reason why i was asking-how can i check if user has started using internet? i've noticed that getNumberOfPacketsSent() and getNumberOfPacketsReceived() returns me something even if i do not use internet at the moment (browser is closed and all application are closed also)...
   
Reply With Quote
  (#10 (permalink)) Old
hrbuckley Offline
CrackBerry Addict
 
Posts: 831
Join Date: Jan 2006
Model: 9000
OS: 4.6.0.303
Carrier: Rogers CA
Default 07-07-2009, 01:10 PM

I thought we covered that. You won't be able to get that information in a third party application. Your line of inquiry is based on a false assumption. A Blackberry never connects or disconnects from the Internet (except when turning on/off or entering/leaving coverage). The browser never starts or stops except when the device reboots. You may (with a BES) easily find out what URLs a user looks at and when (unless you allow third party browsers).

If you really have to have that kind of data, you should probably put your users on a BES anyway. Once they are on a BES you can disable all browsers except the Desktop Browser, disable loading third party applications then buy web monitoring software for your network.


BPS/Zarafa
   
Reply With Quote
  (#11 (permalink)) Old
misty83 Offline
Thumbs Must Hurt
 
Posts: 73
Join Date: Jan 2009
Model: 7100T
PIN: N/A
Carrier: -
Default 07-08-2009, 02:08 AM

hmm..
ok, so actually what for are these methods:
RadioInfo.getNumberOfPacketsReceived() and RadioInfo.getNumberOfPacketsSent()

as i cannot use them as i described? i really do not unerstand meaning of them, in this situation they are totally useless..
   
Reply With Quote
  (#12 (permalink)) Old
Dougsg38p Offline
CrackBerry Addict
 
Posts: 813
Join Date: Mar 2008
Location: Austin, TX
Model: 8320
PIN: N/A
Carrier: T-Mobile
Default 07-08-2009, 06:40 PM

One more try: there is no way to determine if the user has "connected" to the internet, because the device is almost always connected (unless the device is in a basement or something).

The RadioInfo methods just tell you how much traffic is flowing between the device and the network. I suppose you could save these values at some given point in time, then compare a future value to determine how much traffic occurred.

The CoverageInfo class will tell you what type of coverage is *available*.

Perhaps if you explain what your end-goal is, someone can make a productive suggestion.
   
Reply With Quote
  (#13 (permalink)) Old
misty83 Offline
Thumbs Must Hurt
 
Posts: 73
Join Date: Jan 2009
Model: 7100T
PIN: N/A
Carrier: -
Default 07-09-2009, 03:34 AM

what i need to do is write to a log how much data did user downloaded and sent. every 24h data will be send to a server, the log ill be erase, and new data will be written.

as i understand-so.. if BB is almost always connected, probably that is the reason why getNumberOfPacketsReceived()/Sent() always return something. but i need an information of the data sent/received when user knows it (par example when he opens a browser and download something). i need to get somehow info about user's internet activity for which he would be charged!

also-getNumberOfPacketsReceived()/Sent() returns data in bytes?
   
Reply With Quote
  (#14 (permalink)) Old
misty83 Offline
Thumbs Must Hurt
 
Posts: 73
Join Date: Jan 2009
Model: 7100T
PIN: N/A
Carrier: -
Default 07-09-2009, 03:49 AM

even if using RadioInfo methods for checking transmission activity-i need to know when should i start checking it.. (that was the reason why i asked is there a possibility to check when user starts using an application which connects to the internet). i was thinking about writing a timer which will call getNumberOfPacketsReceived()/Sent() methods every second so that i can register the transmission activity.. but i do not think that putting it into timer is very efficient way of doing it.. i just do not have any idea.. :/
   
Reply With Quote
  (#15 (permalink)) Old
misty83 Offline
Thumbs Must Hurt
 
Posts: 73
Join Date: Jan 2009
Model: 7100T
PIN: N/A
Carrier: -
Default 07-09-2009, 04:09 AM

i saw a presentation of a company whose application shows the usage of internet. par example-you run the application and You can see that You've used 3.5MB from 5MB free..
so if they did it-it is possible to do somehow..
   
Reply With Quote
  (#16 (permalink)) Old
hrbuckley Offline
CrackBerry Addict
 
Posts: 831
Join Date: Jan 2006
Model: 9000
OS: 4.6.0.303
Carrier: Rogers CA
Default 07-09-2009, 10:43 PM

You can't count on everything a company tells you in a presentation. The RadioInfo calls can be used for that, and that is the only way I've been able to find that kind of information. The problem is there are so many variables. Is the device in Wi-Fi cover. Even if it is, is some poorly written application using direct. Is the plan staggered with 50MB free for mail and 1GB free for web and everything else at $10/MB.

In any case, if you want to know how much data has gone to/from the Blackberry over a period of time you read those values at the beginning and the end of the period. The difference is the data use over the period.

Blackberries are very chatty, the values will more often change than not.


BPS/Zarafa
   
Reply With Quote
  (#17 (permalink)) Old
misty83 Offline
Thumbs Must Hurt
 
Posts: 73
Join Date: Jan 2009
Model: 7100T
PIN: N/A
Carrier: -
Default 07-10-2009, 02:33 AM

hi,
thx for answer.
i have implemented RadioInfoListener and i've noticed that it only reacts on the change of the signal. par example-when i turn on/off the radio. or when the strength of the signal has been changed. none of these parameteres says me if i'm using internet right now.

i'm trying to understand it (what is not always simple as my english is not too sophisticated). and as i understand-information about how much data did user download/sent can be taken from BES.. am i right?

regards and thx for Your time
   
Reply With Quote
  (#18 (permalink)) Old
misty83 Offline
Thumbs Must Hurt
 
Posts: 73
Join Date: Jan 2009
Model: 7100T
PIN: N/A
Carrier: -
Default 07-10-2009, 02:38 AM

and actually i have another question about these methods getNumberOfPacketsReceived()/Sent(). actually i think i do not understand them, i mean:

1. are these method for this, par example-when my application connects to a server and i sent to it, let's say and image.. so then i can call getNumberOfPacketsSent() and it would tell me how much data i've just sent?

2. or is it like that, when i call this method it returns me the number of packets that have been sent/received at that second when the methods were called?

3. or is it like that: i run my application and (par example) after one hour of the application's activity i call these methods so then they would return me how much data was sent/received during this hour?

that is really not clear to me..
   
Reply With Quote
  (#19 (permalink)) Old
misty83 Offline
Thumbs Must Hurt
 
Posts: 73
Join Date: Jan 2009
Model: 7100T
PIN: N/A
Carrier: -
Default 07-10-2009, 03:51 AM

i would also like to know what exactly is returned by these methods? cause in API it is written that number what packets.. but what is the size of these packets?
   
Reply With Quote
  (#20 (permalink)) Old
hrbuckley Offline
CrackBerry Addict
 
Posts: 831
Join Date: Jan 2006
Model: 9000
OS: 4.6.0.303
Carrier: Rogers CA
Default 07-10-2009, 02:25 PM

I don't know what API you are reading in mine is says getNumberOfPacketsReceived returns:
Quote:
Number of bytes received by the radio, or -1 if this feature is not supported.


BPS/Zarafa
   
Reply With Quote
  (#21 (permalink)) Old
jasonwatson Offline
New Member
 
Posts: 11
Join Date: Jul 2009
Model: 7100T
PIN: N/A
Carrier: verison
Default 07-10-2009, 09:38 PM

what jre are you using?
   
Reply With Quote
  (#22 (permalink)) Old
hrbuckley Offline
CrackBerry Addict
 
Posts: 831
Join Date: Jan 2006
Model: 9000
OS: 4.6.0.303
Carrier: Rogers CA
Default 07-10-2009, 10:19 PM

Well that is interesting. From a quick check it appears that wording first appears in 4.6.1 and continues in 4.7.0. I suspect that the original use of the word Packet was a mistake in the original method name (cause as misty83 points out, how big would the packets be?) that has been corrected in the documentation.

In any case my use of the function gives results that make sense IAW the 4.6.1 documentation, even on devices running earlier OSs.


BPS/Zarafa
   
Reply With Quote
  (#23 (permalink)) Old
misty83 Offline
Thumbs Must Hurt
 
Posts: 73
Join Date: Jan 2009
Model: 7100T
PIN: N/A
Carrier: -
Default 07-11-2009, 03:45 AM

i'm using jde 4.6... please take a look here: BlackBerry JDE 4.6.0 API Reference

it is clearly written:

Number of packets received by the radio, or -1 if this feature is not supported.

but now, when You've said this i've checked the 4.6.1 api and it is written:

Number of bytes received by the radio, or -1 if this feature is not supported.

so, i understand, You suggest to take what is written in 4.6.0 (also in 4.5.0) is a word mistake?
i'll try test it a little and check if that make sense.
   
Reply With Quote
  (#24 (permalink)) Old
ChromeInfo Offline
New Member
 
Posts: 1
Join Date: Aug 2009
Model: 8110
PIN: N/A
Carrier: Airtel
Default Can i get total number of bytes used in BB?? - 08-29-2009, 12:11 PM

Have you got any luck with your internet data collection logger?
I am also trying to get the the total number of bytes recieved/sent by different network interfaces. By using RadioStatusListener's interfaces, I am able to get the type of active network interface and the number of bytes recieved. But for that we need to create a connection everytime by providing a URL.
as we want to create a background application we can't just create a connection with the URL everytime user is trying to surf anything.

So I decided to move back to RadioInfo. RadioInfo.GetNumberOfPacketsRecieved() just returns me the same 9 digit number (for example 268040972) everytime even if I download the data of size around 200kb by TCP connection. Is there any specific way to use it. Have you seen that 9 digit number returned by GetNumberOfPacketsRecieved() changing on different call intervals? My development environment is eclipse plug-in with jde 4.5.0.

Last edited by ChromeInfo : 08-29-2009 at 01:30 PM. Reason: mentioning jde version
   
Reply With Quote
Reply


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On





Copyright © 2004-2009 BlackBerryFAQ.com, BlackBerryForums.com.
The names RIM © and BlackBerry © are registered Trademarks of Research In Motion Limited.