I have written an app using the official API to upload to Google drive, this works perfectly. However I can't find anyway to cancel an upload. I'm running it in an ASyncTask, so far I have tried making the drive object, the file path, the token and a few other variables none. I've also tried to invalidate the token however it seems this only removes it from the cache and doesn't actually invalidate it server side. I've called cancel on the ASyncTask however if it is cancelled once the upload has started there seems to be no way to stop it.
My issue is if a user starts uploading a 100mb file there's no way for them to cancel it other then turning their internet connection on and off which isn't practical. This is my upload code:
java.io.File jFile = new java.io.File(path); //Does not get file just info
File body = setBody(jFile, mimeType);
try
{
java.io.File mediaFile = new java.io.File(path);
InputStreamContent mediaContent =
new InputStreamContent(mimeType,
new BufferedInputStream(new FileInputStream(mediaFile)));
mediaContent.setLength(mediaFile.length());
request = drive.files().insert(body, mediaContent);
request.getMediaHttpUploader().setProgressListener(new CustomProgressListener());
File file = request.execute();
Surely there is a way to cancel an upload?