camera.delete

Deletes a file given its URI. This command was modified in API level 2.

Parameters

  • API level 1
    • fileUri: URI of a file to delete. Manufacturers decide whether to use absolute or relative URIs. Clients may treat this as an opaque identifier.
  • API level 2
    • fileUrls: A list of absolute URLs for files to be deleted from the camera, which were obtained previously, e.g. from camera.listFiles or camera.takePicture commands. There are three special cases:
      • The list only contains string “all”: delete all files in the camera.
      • The list only contains string “image”: delete all images in the camera.
      • The list only contains string “video”: delete all videos in the camera.

Results

  • fileUrls: URLs of files that are not successfully deleted. Please note this happens when all the URLs in fileUrls are valid but camera fails to delete some of them. If any of the URLs is invalid, error code invalidParameterValue should be returned without deleting any file. This was added in API level 2.

Errors

  • missingParameter: fileUri not specified.
  • invalidParameterName: The input parameter name is unrecognized.
  • invalidParameterValue: The input parameter name is recognized, but its value is invalid; for example, the fileUri doesn't exist in API level 1 or any URL in fileUrls doesn't exist in API level 2.

Command I/O

Command Input (API level 1)
{
    "parameters": {
        "fileUri": "file URI"
    }
}
Command Output (API level 1)
none
Command Output (Error) (API level 1)
{
    "error": {
        "code": "invalidParameterName",
        "message": "Parameter XYZ is unrecognized."
    }
}
Command Input (API level 2)
{
    "parameters": {
        "fileUrls": [
            "url1",
            "url2",
            "url3",
            ...
            "urln"
        ]
    }
}
Command Output (API level 2)
{
    "results": {
        "fileUrls": [
            "urln"
        ]
    }
}
Command Output (Error) (API level 2)
{
    "error": {
        "code": "invalidParameterValue",
        "message": "Parameter url3 doesn't exist."
    }
}