//

791
5
Jump to solution
05-23-2017 10:28 AM
_____
by
New Member
0 Kudos
1 Solution

Accepted Solutions
LucasDanzinger
Esri Frequent Contributor

System is a singleton, so you should use Connections for this - Connections QML Type | Qt QML 5.8 

Connections {
    target: System
   
    onOnlineStateChanged: {
        console.log("is online?", online);
        // hide whatever layers you want to hide
    }
}

View solution in original post

5 Replies
LucasDanzinger
Esri Frequent Contributor

If you are not connected, you can expect your online layers to not draw. You can test that on your windows device by turning off your wifi. You might see some data that has been cached, but it will not be able to fetch any new tiles. Instead, you will either need to make a TPK and side load it, or use the Export Tile Cache Task to take a tile service offline. Then, you can use System.isOnline property from ArcGISExtras to switch between your online/offline layer:

pseudocode:

BasemapImagery {
  id: onlineBasemap
}

Basemap {
  id: offlineBasemap
  ArcGISTiledLayer {
    TileCache {
      path: "/pathToData/data.tpk"
    }
  }
}

Map {
  // user ternary operator to switch between the layers whenever the isOnline property changes
  basemap: System.isOnline ? onlineBasemap : offlineBasemap
}
_____
by
New Member

//

0 Kudos
LucasDanzinger
Esri Frequent Contributor

System is a singleton, so you should use Connections for this - Connections QML Type | Qt QML 5.8 

Connections {
    target: System
   
    onOnlineStateChanged: {
        console.log("is online?", online);
        // hide whatever layers you want to hide
    }
}
_____
by
New Member

//

0 Kudos
LucasDanzinger
Esri Frequent Contributor

it's a direct wrap of this Qt object - QNetworkConfigurationManager Class | Qt Network 5.8, so it will have the same behavior as that. I've read in forums where there are some caveats like if you are on a hotel wifi but have not yet authenticated, it might say you are online even though you can't really use it yet. Other than that, it should trigger if you either turn wifi off or pull the hard wire (depending on how you are connected)