1. Home
  2. SureMDM
  3. Changing The Ownership Of The Device And Clearing All The User Data Without Having To Factory Reset The Device
  1. Home
  2. Android Management
  3. Changing The Ownership Of The Device And Clearing All The User Data Without Having To Factory Reset The Device

Changing The Ownership Of The Device And Clearing All The User Data Without Having To Factory Reset The Device

KB ID: 42G2209188
Views: 152
Updated: September 2022

When a device is enrolled and given to temporary users who are not knowledge workers and allowed to do anything on the device without any restrictions. e.g. Devices are given to patients in the hospital. The users may download the files (which can be private), and apps, and set up WhatsApp and Facebook accounts (Personal).

In this case, when they hand over the devices to the Admin, once they are discharged, the Administrator currently has to factory reset the device to remove all the personal and private content.

The device administrators wouldn’t want to set up all the devices freshly by doing a factory reset when a device is re-assigned from one user to another. This is a time-consuming process. So the approach proposed here will help them to delete all the user data, accounts, and files from the devices without factory resetting when changing the ownership from one user to another.

The below suggested solutions can be used in conjunction to achieve the above:

The process involves the steps of creating runscript job on the SureMDM console and below are the steps for the same.

  1. Login to the SureMDM Console
  2. Navigate to Jobs
  3. Click New Job and select Android platform
  4. Click on Run Script
  5. Enter the Job Name
  6. Enter the script
  7. Click OK to save the job

SCRIPT TO CLEAR USER APP DATA

!#suremdm 
clearAllSystemUserAppsData

Note: This script will clear all user-downloaded application app data except for SureMDM Agent/ SureLock/SureFox/SureVideo

SCRIPT TO DELETE THE ACCOUNTS

!#suremdm 
removeAccountFromDevice(account_type)

The account_type examples

Gmail > com.google.android.gm
Facebook > com.facebook.katana
WhatsApp > com.whatsapp

Note 

  1. Package names may vary at times based on the model. Check on the device end and enter the correct package name
  2. PFW accounts should be excluded since they are needed for DO & PO enrollment.

CLEAR SD CARD DATA

  • Delete all files inside the “test folder” with extensions
rm -r /mnt/sdcard/test/*
  • Remove all the data from the SD card, including SureProduct data
rm -r /mnt/sdcard/*

RUNSCRIPT TO RESET THE HOME SCREEN AND LOCK SCREEN WALLPAPERS TO DEFAULT

Home screen wallpaper

!#suremdm
setHomeScreenWallpaper(<Image_path>,<Image_Position>)
Lock screen wallpaper

!#suremdm
LockScreenWallpaper(<Image_path>,<Image_Position>)

Image position can be: fill, fit, Stretch

Note: The wallpaper file should be sent to the device as part of the file transfer job after clearing the data specified in the above section.

Once all the runscript jobs are created, the admin can create a composite job and apply it to the devices to take immediate effect.

Related Articles