Latest Posts

PowerApps Check if user is online or not using connection function


In Power Apps, the Connection function is used to retrieve information about the network connection status of the device running the app. This can be useful for providing feedback to users about their connectivity status or for implementing logic that depends on whether the device is online or offline.

PowerApps – Connection function Syntax

Connection

Properties of the Connection Object

  • Connected: A Boolean value indicating whether the device is connected to a network (true) or not (false).
  • Metered: A Boolean value indicating whether the network connection is metered (true) or not (false).

PowerApps - Display Connection Status

You can use the Connection object to display the network connection status to users.

  1. Add a Label Control:
    • Insert a Label control onto your screen.
    • Set the Text property of the Label to:

If(Connection.Connected, "You are online", "You are offline")

This label will display "You are online" if the device is connected to a network, and "You are offline" if it is not.

PowerApps - Handle Metered Connections

You can use the Connection object to check if the network connection is metered and handle it accordingly.

  1. Add a Label Control:
    • Insert a Label control onto your screen.
    • Set the Text property of the Label to:

If(Connection.Metered, "You are on a metered connection", "You are not on a metered connection")

 

This label will display "You are on a metered connection" if the network connection is metered, and "You are not on a metered connection" if it is not.

PowerApps - Conditional Data Loading based on Online or Offline

You can use the Connection object to conditionally load data based on the network connection status.

  1. Add a Button Control:
    • Insert a Button control onto your screen.
    • Set the OnSelect property of the Button to:

If(Connection.Connected,

    ClearCollect(MyData, DataSource),

    Notify("Cannot load data. You are offline.", NotificationType.Error)

)

When the button is pressed, it will load data from DataSource into the MyData collection if the device is connected to the network. If the device is offline, it will display a notification indicating that data cannot be loaded.


We value your Feedback:

Page URL:

Name:

Email:


Suggestion:

© 2024 Code SharePoint