Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Web and WebWorks Development

Reply
New Contributor
sandawg
Posts: 6
Registered: ‎03-13-2011
My Device: Tablet Playbook
My Carrier: AT&T

How to Check for Internet Connection in WebWork App?

I have an application with downloads video from my server.  How can I check to see if the user is connected to the internet so I can gracefully display a message that lets them know they need to connect via wifi/3G/4G to view the video?

 

I was thinking since I am using jQuery to do a POST to my server and if I get a response back then I can assume that user is connected to the internet.  Is this good practice or is there a better way of doing this?

Please use plain text.
Contributor
mmzepedab
Posts: 22
Registered: ‎09-01-2010
My Device: Blackberry 8900
My Carrier: Tigo Honduras

Re: How to Check for Internet Connection in WebWork App?

I've been looking for something similar but not luck, I wonder if there is an API to check if the wifi is enabled, hope someone can help us out here.

 

 

Please use plain text.
BlackBerry Development Advisor
tneil
Posts: 3,708
Registered: ‎10-16-2008
My Device: Z10
My Carrier: Rogers

Re: How to Check for Internet Connection in WebWork App?

You can use the hasDataCoverage() function on the System object

 

http://www.blackberry.com/developers/docs/widgetapi/blackberry.system.html

 

you can also use the blackberry.network property to see what type of network you are on.

Tim Neil
Director, Application Platform & Tools Product Management
Follow me on Twitter
Please use plain text.
Contributor
dyashkir
Posts: 23
Registered: ‎03-21-2011
My Device: 9780
My Carrier: WIND

Re: How to Check for Internet Connection in WebWork App?

Can you determine if the device is being teathered through BB or is on WiFi?

Please use plain text.
BlackBerry Development Advisor
tneil
Posts: 3,708
Registered: ‎10-16-2008
My Device: Z10
My Carrier: Rogers

Re: How to Check for Internet Connection in WebWork App?

The network property will give you a comma delimited list of all its connection points.. if it is on WiFi it will be in that list

 

http://www.blackberry.com/developers/docs/widgetapi/blackberry.html

Tim Neil
Director, Application Platform & Tools Product Management
Follow me on Twitter
Please use plain text.
Contributor
dyashkir
Posts: 23
Registered: ‎03-21-2011
My Device: 9780
My Carrier: WIND

Re: How to Check for Internet Connection in WebWork App?

Please use plain text.
Developer
sergeh
Posts: 123
Registered: ‎03-22-2011
My Device: curve 8900
My Carrier: Rogers

Re: How to Check for Internet Connection in WebWork App?

@Tim

 

does the Playbook WebWorks has access to those api call as well?

--
Bitbox
Please use plain text.
BlackBerry Development Advisor
tneil
Posts: 3,708
Registered: ‎10-16-2008
My Device: Z10
My Carrier: Rogers

Re: How to Check for Internet Connection in WebWork App?

It has the hasCoverage() function.. not the network one.. the first PlayBook will be wifi only

 

http://www.blackberry.com/developers/docs/webworks/api/playbook/

Tim Neil
Director, Application Platform & Tools Product Management
Follow me on Twitter
Please use plain text.