This post is idea how this problem can be solved, and question to other developers.
If somebody wont to use file that mosync not support, probably will skip that file and find alternative, but if somebody wont to use video (to download), or for example pdf files for some library or any other file that somebody find usefull.
Solution to use file in app, that no have support, is for average developer impossible. But what can he do,
he can download that file to phone, and open that file in phone gallery. Somebody will say, ok why use this when u can't use it in app??, Well i have couple reasons first user can with one click download file that you wont to be downloaded, no need to surf to find that file, no need to leave app, you can implement download progress to track download, or inform user when download is finished and inform him that file is on phone gallery and many others reasons that i cannot remember now, just to make it easy it can be for user. So if you can live with this that file is not supported, or cannot wait update when it will can, this is some kind of alternative.
This procedure is well know, but i not find any explanation or forum topic how it can be done, or have part explanation, so this can help.
First for video:
there have api for streaming, but i find that it use heap memory in app, and on phones that have little memory can cause memory problem and have error out of memory try to ...
For now good solution is give it to maPlatformRequest(const char* url) will handle streaming, it will open phone default stream player and play that video, after it finished it will return to place where you be before. But if it url is not (rtsp), it will start play that video after it download to phone gallery, and it will be saved.
If somebody wont to download some file to phone gallery it is possible with MAUtil/downloader
and it is vary easy to use:
First is to give downloader url where that file is:
Downloader Conn;
MAHandle mPDFResource;
mPDFResource = maCreatePlaceholder();
Conn.beginDownloading("http://test.com/test.pdf",mPDFResource);
Next step is saving this pdf and we do that in download finished
void Screen::finishedDownloading(Downloader* downloader, MAHandle data)
{
MAHandle h = maOpenStore("proba.pdf", MAS_CREATE_IF_NECESSARY);
maWriteStore(h, mPDFResource);
maCloseStore(h, 0);
}
Here must whatch out how you will call file, if it is pdf it must have .pdf, or video .3gp and so long, name of file is not important you can call it like you wont but must ceap proper extension.Now this file will be avalible in phone (of course if it support it)
Here i wont to point on one more thing that can be usefull:
MAHandle mPDFResource;
and
maWriteStore(h, mPDFResource);
if in app (same screen ) wont to download several diferent files and save them all, you will need to make handle for each of them, and in download finished metod to use correct handle for writing to store.
Question will be : I tested this on Symbian and J2me phones what about others platforms? Where files will be and are they will available to easy use?
Best regards.