Docs Menu
Docs Home
/ /
Atlas Device SDKs
/ /

Check the Current Network Connection - Java SDK

To check the current network connection, call getConnectionState() on your SyncSession:


Connection States vs. Session States

The SDK manages communication with App Services at two levels: connection state and session state. Connection state tracks the state of the network connection between a client device and your backend App. Session state refers to a single user's synchronization state, which can be paused and resumed in the SDK at will. As a result, you must check both states to determine whether a user's local changes will sync to the backend. Synchronization only occurs when the connection state is "connected" and the session state is "active".

You can also subscribe to connection changes on your SyncSession with addConnectionChangeListener(), which works similarly to upload and download listeners.

← Check Upload & Download Progress for a Sync Session - Java SDK