This type defines the Client main entry point for the Connectivity feature.
More...
|
| ConnectivityService (CoroutineService coroutineService) |
|
async Promise | SetHasInternet (bool hasInternet) |
| Force the value of HasConnectivity. The connectivity is checked periodically, so if the given hasInternet value is not correct, the connectivity will be updated soon. If the given hasInternet value is different than the current HasConnectivity property, then the OnConnectivityChanged event will trigger as part of the execution of this method. More...
|
|
Promise | ReportInternetLoss () |
| Force the value of HasConnectivity to be false. The connectivity is checked periodically, so if internet connectivity returns, the HasConnectivity will be updated soon. If the value of HasConnectivity used to be true, then the OnConnectivityChanged event will trigger as part of the execution of this method. More...
|
|
void | OnReconnectOnce (ConnectionCallback callback, int order=0) |
| Enqueue a Promise to run when the HasConnectivity value returns to true. If the HasConnectivity is already true, the promise will be evaluated immediately. When connectivity is restored, all of the ConnectionCallback's will be invoked, and the Promises that are created will be awaited before the SetHasInternet's return Promise is completed. More...
|
|
void | OnReconnectOnce (Action onReconnection) |
| Run an action when the HasConnectivity value returns to true. If the HasConnectivity is already true, the action will be evaluated immediately. After connectivity is restored, and the action is executed, the action will never be executed again, even if further internet drops and restorations occur. See also the OnReconnectOnce(ConnectionCallback,int method. More...
|
|
|
bool | HasConnectivity = true [get] |
|
bool | ForceDisabled [getset] |
|
bool | Disabled [get] |
|
string | ConnectivityRoute [get] |
|
bool | HasConnectivity [get] |
| true when Beamable thinks the current device has an internet connection. This property will update automatically as the device goes on and off line. You can sue the OnConnectivityChanged event to listen for changes in this property.
|
|
bool | ForceDisabled [getset] |
| This property allows you to simulate network outage. When true, the Disabled property will be triggered, which forces the HasConnectivity to be false, even if the device is online. When false, it is still possible that Disabled can be triggered, if the IConnectivityServiceExtensions.GlobalForceDisabled property has been set.
|
|
bool | Disabled [get] |
| true if the ForceDisabled property has been set to true, OR if the IConnectivityServiceExtensions.GlobalForceDisabled property has been set to true. When Disabled is true, the HasConnectivity property will be forced to false. This can be helpful to simulate network outage, even if the device is online.
|
|
|
Action< bool > | OnConnectivityChanged |
|
Action< bool > | OnConnectivityChanged |
| An event that will trigger anytime the HasConnectivity status changes.
|
|
This type defines the Client main entry point for the Connectivity feature.
Related Links
◆ OnReconnectOnce() [1/2]
void Beamable.Api.Connectivity.ConnectivityService.OnReconnectOnce |
( |
Action |
onReconnection | ) |
|
|
inline |
Run an action when the HasConnectivity value returns to true. If the HasConnectivity is already true, the action will be evaluated immediately. After connectivity is restored, and the action is executed, the action will never be executed again, even if further internet drops and restorations occur. See also the OnReconnectOnce(ConnectionCallback,int method.
- Parameters
-
onReconnection | Some action to invoke when internet connectivity returns. |
Implements Beamable.Api.Connectivity.IConnectivityService.
◆ OnReconnectOnce() [2/2]
void Beamable.Api.Connectivity.ConnectivityService.OnReconnectOnce |
( |
ConnectionCallback |
promise, |
|
|
int |
order = 0 |
|
) |
| |
|
inline |
Enqueue a Promise to run when the HasConnectivity value returns to true. If the HasConnectivity is already true, the promise will be evaluated immediately. When connectivity is restored, all of the ConnectionCallback's will be invoked, and the Promises that are created will be awaited before the SetHasInternet's return Promise is completed.
- Parameters
-
promise | Some function that generates a Promise. The generator will be evaluated when internet is restored. |
order | The order to invoke the promise |
Implements Beamable.Api.Connectivity.IConnectivityService.
◆ ReportInternetLoss()
Promise Beamable.Api.Connectivity.ConnectivityService.ReportInternetLoss |
( |
| ) |
|
|
inline |
Force the value of HasConnectivity to be false. The connectivity is checked periodically, so if internet connectivity returns, the HasConnectivity will be updated soon. If the value of HasConnectivity used to be true, then the OnConnectivityChanged event will trigger as part of the execution of this method.
- Returns
- A Promise representing the completion of the operation.
Implements Beamable.Api.Connectivity.IConnectivityService.
◆ SetHasInternet()
async Promise Beamable.Api.Connectivity.ConnectivityService.SetHasInternet |
( |
bool |
hasInternet | ) |
|
|
inline |
Force the value of HasConnectivity. The connectivity is checked periodically, so if the given hasInternet value is not correct, the connectivity will be updated soon. If the given hasInternet value is different than the current HasConnectivity property, then the OnConnectivityChanged event will trigger as part of the execution of this method.
- Parameters
-
hasInternet | true if the device has internet, false otherwise. |
- Returns
- A Promise representing the completion of the operation. The promise will not complete until all promises registered with the OnReconnectOnce(ConnectionCallback,int method have completed.
Implements Beamable.Api.Connectivity.IConnectivityService.
The documentation for this class was generated from the following file:
- com.beamable/Runtime/Core/Platform/SDK/Connectivity/Connectivity.cs