Info: APIs for network status
The
BlackBerry Dynamics SDK for Android
contains several APIs to manage network connections. For semantics of parameters and other
details, see the API Reference. For
examples of how to use the APIs, see the
Apache
Http sample
app. GDConnectivityManager
You
can use the following class to control the connection from
your
app to the
infrastructure.
GDNetworkInfo
This class represents the status of the connection from the
app
to the
BlackBerry
Dynamics
infrastructure. Every BlackBerry
Dynamics
app
connects to the BlackBerry
Dynamics
infrastructure whenever possible. The connection is maintained by the BlackBerry
Dynamics
Runtime in the mobile
application. The BlackBerry
Dynamics
infrastructure includes the BlackBerry
Dynamics
Network Operation Center (NOC) as well as a number of other components
that can be installed by the enterprise. The current status can be obtained synchronously.
It is also possible to receive notifications whenever the status changes.void registerReceiver(BroadcastReceiver receiver, IntentFilter filter)
Call this method to register for specific notifications sent by local broadcast. There is only
one notification sent by local broadcast: the change of network connection status. See the
GDNetworkInfo class reference for details of this notification, and sample code. The receiver
will be run on the main thread of the application. Long-running processing generally shouldn't
be run on the main thread. If the receiver processing is long-running then the receiver should
spawn a new thread, or use some other mechanism to cause the processing to take place on a
thread other than the main thread.
void unregisterReceiver(BroadcastReceiver receiver)
Call this method to remove a previously registered receiver of local broadcasts. The receiver
is specified as a parameter. The specified receiver will not receive any more local broadcasts
from the
BlackBerry
Dynamics
Runtime, for any type of notification.