Documentation : Files

About

Mobeelizer provides the simple way to distribute binary data across the cloud. The only thing you have to do is to define binary field in your application. Pictures, documents or other binary data stored in this field will be automatically synchronized between devices.

How to define the binary field?

To define binary field, edit your model in App Designer and click 'New field'. Choose the name and set the type to FILE and save it.

Frequently asked questions

How to create the file?

You can't initialize MobeelizerFile. Instead, use the factory method to get it, set it as binary field value and save the entity. See platform SDK for more details.

What does the name mean?

Basically the name of the file has no meaning. Usually you will set it as the original file name, but it's up to you.

What does the guid mean?

The guid is the unique identifier of the file. That is mean that there is only one file with given guid in entire cloud. The guid is automatically generated when new file is created.

Where the files are saved?

On Android devices the files are saved in Environment.getExternalStorageDirectory() directory under the path /mobeelizer/applicationName/instanceName/userLogin/. Because of external storage usage, user permission android.permission.WRITE_EXTERNAL_STORAGE must be
given.

On iOS devices the files are saved in NSDocumentDirectory directory under the path /instanceName/userLogin/.

On WP7 devices the files are saved in IsolatedStorage under the path /instanceName/userLogin/.

Can I attach one file to many entities?

Yes, you can. There are two methods to create MobeelizerFile object. The first receives the name and content of the file, creates the file under new guid and returns the the MobeelizerFile class with this guid. The second reveives the name and the guid of the existing files. To attach existing file to the entity use the second method.

How to read the content of the file?

To read the content of the file you have to get the MobeelizerFile object. This object have the field with the content. See platform SDK for more details.

How to remove the file?

There is no direct way to remove the file. The files are automatically removed when there are no entities referenced to them. So, to delete the file, change the value of the file's field to null or to another file, save the entity and synchronize the device. The file will be deleted.

 

Attachments:

files_art.png (image/png)