You can set the location's site
name for a mobile app in the Aternity Mobile SDK, to track the performance of all end users in that
location.
In Android, the
Aternity
class provides two instance
methods for setting the site: setSite
for
setting the site name, and setOffSite
to
define the site as Off-site.
Set the site name to
correspond to the Site field in your
organization's Microsoft Active Directory, so Aternity can
automatically map the site to its
Country,
State and
City in the dashboards. For more
information see how to configure location mapping.
In addition to using this
method, you can also set this property when the Android app initializes
with init
and setting the property ATERNITY_CONFIG_SITE
.
Using the site-based location of monitored mobile apps
Since this is an instance method, you need
to call this with an instantiated object. The Aternity
class provides the
getInstance
method which returns a singleton object. You
should call the class's methods using the singleton object, to avoid manually
creating and maintaining the Aternity
object.
Before You Begin
Before you begin, ensure you have already done the following:
Method Definition
In Android, the
Aternity
class provides two instance
methods for setting the site: setSite
for
setting the site name, and setOffSite
to
define the site as Off-site.
public void setSite(String site);
public void setOffSite();
Parameters
Parameter |
Description |
site
|
Set the site name of device's location's site name to this value, which should
correspond to the Site name in your Microsoft Active
Directory.
|
Example
This example queries the name (SSID) of the connected WiFi network to determine the
location's site name. If the network names are not recognized, it sets the name to
Off-Site.
android.net.wifi.WifiInfo wi = mWifiManager.getConnectionInfo();
//Since these are instance methods, use getInstance to return a singleton object.
if (wi.getSSID().equals("AP-1"))
Aternity.getInstance().setSite("Warehouse");
else if (wi.getSSID().equals("AP-2"))
Aternity.getInstance().setSite("HQ");
else
Aternity.getInstance().setOffSite();