Project initialization

Initialize Users

In order to track geofencing events, you need to initialize a user in your Cloud4Wi account.

The method to initialize users is exposed in the WiFi SDK, so you need to integrate also the WiFi SDK into your project.

Once both the WiFi and Location SDKs are installed you can use the following snippet to initialize the customer in Cloud4Wi as soon the deviceId is assigned to the phone. This function will initialize an anonymous user without any additional attribute or personal data associated.

Cloud4WiSDKWiFi mobileSDK = new Cloud4WiSDKWiFi(getApplicationContext());
GeoUniq mGeoUniq = GeoUniq.getInstance(this);
            mGeoUniq.setDeviceIdListener(new GeoUniq.IDeviceIdListener() {
                @Override
                public void onDeviceIdAvailable(String deviceId) {
                    mobileSDK.setupCustomer(
                            customerCreateResponse -> {
                                Log.d("", customerCreateResponse.toString());
                            },
                            e -> {
                                Log.d("", e.getMessage());
                            });
                }
            });

In the alternative, you can use the native WiFi SDK methods to initialize a customer.

Last updated