The following sample code shows how to upload an object body with the transfer-at-once method.
Here is what is happening in the sample code:
Set key-value pairs (e.g., file name, file size, and the availability of an object body) in a KiiObject as needed.
Call the save() method to create a new KiiObject on Kii Cloud.
Create a reference to the target file (myImage.jpg).
Start uploading by calling the uploadBody() method.
You need to create a KiiObject with the save() method prior to uploading its object body with the uploadBody() method.
The non-blocking onTransferProgress() method will be called as the upload progresses. The method can reach 100% on the first call if the data size is small.
Set the content type in a form of "type/subtype". The content type sent to Kii Cloud will be used when the object body is downloaded and when the object body is published and viewed on the browser.
You might need to get rutime permissions for accessing an external storage during the object body uploading. See Getting runtime permissions for the implementation details.