You must remove it from the cloud code using the master key.
In android client:
//clear the installation backend HashMap<String, String> params = new HashMap<>(); String idToken = ParseInstallation.getCurrentInstallation().getInstallationId(); params.put("installationId", idToken); ParseCloud.callFunctionInBackground("removeInstallation", params, new FunctionCallback<String>() { @Override public void done(String response, ParseException e) { if (e == null) { //clear the local chache ParseEasyAccess.clearParse(); } else { e.printStackTrace(); } } });
And then in the Cloud Code:
Parse.Cloud.define("removeInstallation", function(request, response) { Parse.Cloud.useMasterKey(); var installationId = request.params.installationId; var query = new Parse.Query(Parse.Installation); query.equalTo("installationId", installationId); query.find(function(installations) { installations[0].destroy().then( function() { response.success("Destroyed"); }, function() { response.error("Failed"); }); }); });
And if you want to also remove the cached installation on your device, follow these steps:
Create a package named com.parse
Create a class, for example, MyParseTools.
Make a static method like this:
public static void clearParseInstallation() { ParseInstallation.getCurrentInstallationController().clearFromDisk(); ParseInstallation.getCurrentInstallationController().clearFromMemory();}
source share