deleteUserAccount Method

Delete the user association and all files related to it on the device. Particularly, the OpenRoaming user profile will be also removed from the device if a profile has already been provisioned previously. Take in mind that, additionally, the user identity information and all associated user details will also be removed from Cisco Spaces Backend.

The deleteUserAccount method receives the lambda expression deleteUserHandler as a parameter, which allows the application to specify a code to be executed at the end of the method.

Particularly, in the iOS case, if an error occurs during deleteUserAccount method execution, this information is returned via a parameter in deleteUserHandler handler. It is a good practice to always provide a lambda expression to handle a possible error.

iOS (Swift)

void OpenRoaming.deleteUserAccount(deleteUserHandler: { error in <code> })

Android (Kotlin)

void OpenRoaming.deleteUserAccount{ <code> }

Method Parameters

Attribute Type Description Platform
deleteUserHandler Lambda Expression Lambda expression to be executed at the end of the method iOS
Android

Lambda parameters for deleteUserHandler

Attribute Description Platform
error OpenRoamingError (ENUM) with the error message if the method execution is not successful. If the method executes successfully, this parameter receives nil value. iOS

Code example

iOS (Swift)

OpenRoaming.deleteUserAccount(deleteUserHandler: { error in
    if error == nil {
        print("User deleted with success.")
    } else {
        print("There was a problem while deleting the user: " + error)
    }
})

Dependencies

  • Import OpenRoaming_framework.
  • registerSdk method must have been called at some earlier time.
  • A user identity must have been already associated via associateUser method.

Possible exceptions

  • Swift does not throw any exception, but provides error messages on lambda expressions instead. For more information on existing error messages, see OpenRoamingError.

Android (Kotlin)

OpenRoaming.deleteUserAccount(deleteUserHandler = {
    try {
      this.activity?.runOnUiThread {
          System.out.println("User deleted with success.")
      }
    } catch (e: Exception) {
        System.out.println("There was a problem while deleting the user: " + error)
    }
})

Dependencies

  • Import com.cisco.or.sdk.OpenRoaming.
  • registerSdk method must have been called at some earlier time.
  • A user identity must have been already associated via associateUser method.
  • Allowed permissions: "android.permission.INTERNET" and "android.permission.NETWORK_SETTINGS&#x201D;.

Possible exceptions

  • NotInitializedException
  • NotSignedException

For more information on possible exceptions, see Exceptions.