[Q] check if video exists and if not download from web - Java for Android App Development

Hi,
Appologies if this is in the wrong place, it keeps telling me this is not a Q&A forum but I cant find any other Q&A section and there appears to be questions in this one so here goes.
Im working on an app that will contain several large videos. I want the user to download the app 'empty' with no videos in so that it doesnt clog up their phone/tablet. When they use the phone there will be the option to stream these videos from youtube but if the user wishes they will have the option to download the video to SD card. This raises 2 problems for me as Im very new to this kind of programming, only worked with PHP and HTML untill now so getting a little confused, Ive looked at loads of tutorials now and not been able to find a solution.
1. What code do I use to download a file from the internet to the users SD card?
2. What code do I use to check if the file already exists. If it doesnt then the user will get the download option if it does they wont. I will also use this code to decide which video to play. i.e. if file is on SDcard then play that otherwise use youtube.
Does this sound like a good way to use large videos and is it correct to store on the SD Card rather than internal memory etc? I have read that if the video is stored in the raw folder then there is no point checking if it already exists as the app wont compile in the first place.
If anyone can help with any of thes either by providing the code or links to some relevant tutorials that would be great.
Thanks

Related

My Device Storage space issue, **SOLVED**

In an earlier thread of mine about my Device Storage (Lack Of). I want to share with you all, especially as this issue appears to be a common theme running through the forum, how I came about resolving mine.
I suddenly came to a situation whereby my phone was showing 0.00mb of Free Device Memory, annoying popup messages, not being able to install anything to the phone etc. Even though, since getting the phone, I'd installed virtually everything to SD card. I totally could not understand it?
I know I'm running the crappy UK o2 1.43 ROM, but surely this wasn't entirely to blame? One of these days I'll pluck up the courage to update the ROM. Bad memories on this score with my old Omnia i900.....!
Turns out that after downloading & viewing several youtube videos over a period of time and which I thought I'd deleted after viewing, were in fact being stored in a folder on the phone, thus taking up my valuable device memory.
If anyone views online videos then it might be worth trying this.
Launch File Explorer and navigate to: Windows>>Opera 9>>Profile>>Download. I had approaching over 100mb of valuable device storage space stored in this file. After deleting these video files I now have 119+mb of free device storage space. No more annoying pop up messages!
I'm not saying this is a fix for everyone who has device memory issues, but its worth checking out, especially if you view on-line vids.
Just wondered if this had helped anyone?
I watched few youtube vids as well and my storage is 0.00. It had ~15 MB of stuff, but no youtube vids, deleted, thanks.
I'm doing a bit of "spring cleaning" myself, and have just freed up a bit of extra space. I was just wondering how you managed to get youtube videos in an Opera 9 download folder? (I'm just about to check that folder myself)
Speaking of youtube, where are the vids stored, if I watch them through that HTC app?
johncmolyneux said:
I'm doing a bit of "spring cleaning" myself, and have just freed up a bit of extra space. I was just wondering how you managed to get youtube videos in an Opera 9 download folder? (I'm just about to check that folder myself)
Click to expand...
Click to collapse
This is a mystery to me as well. All I know is that when I select a youtube video online the video player that HD2 uses (not sure what this player is, it certainly isn't WMP?) then gives me three options, which are: Open, Save & Cancel. I always select open. I then have to wait maybe 2 or 3 mins until a green download bar has reached 100%, this signifies that the video has been downloaded. I'm then able to view the video. After viewing I select an icon in the bottom right corner of the screen. This gives me a further 2 options, which are: Delete & Remove All Completed. I select delete.
There must have been occasions where I haven't selected delete, or forgotten to, and these are the videos I found being stored in the Download folder within Opera 9.
With my old Omnia i900 when I selected a video to view, WMP immediately opened up and began buffering the video. I would maybe have to wait, at the most, 10 seconds for the video to buffer. I was then able to view the video. I certainly didn't have to actually download the video as I appear to be doing now. I would much rather be using WMP as the viewing time is much quicker. I don't want to use the player the HD2 seems to use by default. But how do I get videos to play through WMP?
Any help on this would be much appreciated.
Help on this much appreciated.
Yes I am also facing problem with memory. When I try to watch any youtube video through the HTC application I get the message ' memory is full' I donot have a folder called download within the opera folder.
RoN_HD2 said:
In an earlier thread of mine about my Device Storage (Lack Of). I want to share with you all, especially as this issue appears to be a common theme running through the forum, how I came about resolving mine.
I suddenly came to a situation whereby my phone was showing 0.00mb of Free Device Memory, annoying popup messages, not being able to install anything to the phone etc. Even though, since getting the phone, I'd installed virtually everything to SD card. I totally could not understand it?
I know I'm running the crappy UK o2 1.43 ROM, but surely this wasn't entirely to blame? One of these days I'll pluck up the courage to update the ROM. Bad memories on this score with my old Omnia i900.....!
Turns out that after downloading & viewing several youtube videos over a period of time and which I thought I'd deleted after viewing, were in fact being stored in a folder on the phone, thus taking up my valuable device memory.
If anyone views online videos then it might be worth trying this.
Launch File Explorer and navigate to: Windows>>Opera 9>>Profile>>Download. I had approaching over 100mb of valuable device storage space stored in this file. After deleting these video files I now have 119+mb of free device storage space. No more annoying pop up messages!
I'm not saying this is a fix for everyone who has device memory issues, but its worth checking out, especially if you view on-line vids.
Click to expand...
Click to collapse
Thought id check it out as a i have lost a bit of ram recently and used youtube a bit. When i go to windowns/opera9/profile i dont even have a download folder so no luck for me there :-(

Camcorder - "Bad Public Movie Atom"

Hello everyone,
I tried finding a solution for this on Google and through the forums here and fell short.
When I record mp4 files with the Camcorder on my HD2 that are larger than, say 90MB, they do not play on the device (when you tap the file, nothing happens). Also, when I copy these files on my Windows PC, Quicktime prompts a "Bad Public Movie Atom".
I cannot find a way to recover these files...and it does not happen with smaller mp4s.
Anybody experience this/found a fix for it?
Really? No one's experienced this? Sorry for being a little desperate and bumping this thread...but if anyone can help...would be much appreciated. I figured if anyone could help, it would be the guys at XDA. Thanks again.
Have you tried playing them with some other program?
Yes I have...Quicktime...RealPlayer...Windows Media Player...Media Player Classic...Divx Player. I always get a random error message about how the file cannot be played back. They will not play on my Archos 5IT either. Very frustrating. What is surprising to me is that no one else has reported similar behavior on the HD2, at least to my knowledge.
Doesn't make a whole lotta sense to me...as I frequently record stuff thats like 150+MB for my YouTube...and they work just fine. What kinda SD card and formatting are you using?
I am using the 16gb SanDisk SD card that came with the phone (class 2 I believe). I have not changed the formatting since I bought it.
Well man, that is just terrible all the way around...uhm, have you tried hard resetting? I am at a total loss here.
try open the file in some tag editor software, change any tag, save it. See what happens, and let us know.
try open the file in some tag editor software, change any tag, save it. See what happens, and let us know.
samsamuel said:
try open the file in some tag editor software, change any tag, save it. See what happens, and let us know.
Click to expand...
Click to collapse
Thanks for the tip. Installed Mp3Tag v2.46a. When I try to save the tag I get an error message: "File cannot be opened for writing". The file is not set to Read Only...so I am not sure why I am getting this message.
ah well, it was just something i came across on google.
Well, seems that I found the root to the problem. I backed up all the contents of my SD card to the computer, then formatted the SD card, using the format function on my HD2. After I restarted and copied all my backed up content back, the camcorder now shoots videos normally...and they come out much smaller in size than before. The down-side is, the corrupt videos I took before will not work, and I still have no way to fix them, even after trying all the suggestions that come up after a Google search.
I just felt obliged to share...if you are shooting corrupt videos with your HTC HD2...format your SD card, and it will solve the problem for future videos.

[Q] Any real application or way to hide the files?

Okay. I have some important PDF files that I need to carry in my phone and I really want to keep them private. I have searched in the market for the application to hide the files, but it turns out that all those applications only provides us the way to hide only Pictures and Videos, which is obviously more demanding and so called private data.
My concern is, no matter how I store these documents, Adobe Reader always and always finds them and displays them. I don't know what's wrong with Adobe and why it is searching for all PDF documents in the SD card and displaying it to public.
I have made the following file/folder structures to make the files not to appear in the Adobe Reader, but failed every time. Adobe just find them somehow.
.folder/file.pdf
.folder/.folder1/file.pdf
.file.pdf
.folder/.file.pdf
.folder/.folder1/.file.pdf
I also have tried all above combinations by applying hidden and system attributes to the PDF files and those folders. But as its Linux, I failed.
So I did some research and though I'll just disallow adobe from accessing things, but when I went to security thing, it told me Adobe don't need anything.
Then why it is searching for my PDF files.
There is a way and only way to hide those files from Adobe is to change their extension to XPS ( ), but it isn't feasible and not something I'm looking for.
Kindly assist me. Thanks.
Couldn't you just password protect them?
Although not as convenient you could use a separate micro sd? Or you could use a cloud system like dropbox.
you can use an application like app protector to password protect the adobe reader. though ur files will be displayed in adobe reader but adobe reader itself would require a password\pattern to open.
Sent from my HTC Wildfire using XDA App
Thanks a lot guys
joningi said:
Couldn't you just password protect them?
Click to expand...
Click to collapse
The files are already secured and there's no way to edit them without knowing the password of those secured documents. And applying password protection to every single file isn't a feasible solution. Though it's a good answer, it's not a solution. Life would have been easier if Adobe would just have allowed users to browse directories and open files instead of listing thousands of PDF files in the system.
djdevine2 said:
Although not as convenient you could use a separate micro sd? Or you could use a cloud system like dropbox.
Click to expand...
Click to collapse
Yes, separate micro SD card is not the convenient way as I bough the 16GB card just to have everything in single place. I even dumped my iPod Touch, because I'm considering my Wildfire to all in device. And about dropbox, correct me if I'm wrong, but it needs Internet connection every time you want to see the file, exception of cached file. May be I'm expecting too much, but my provider don't support the 3G in my area, so GPRS internet isn't something I can rely on.
maaz_obaid said:
you can use an application like app protector to password protect the adobe reader. though ur files will be displayed in adobe reader but adobe reader itself would require a password\pattern to open.
Sent from my HTC Wildfire using XDA App
Click to expand...
Click to collapse
Now that's a solution. I've tried the application just now and it looks promising. Thanks a lot for providing the solution, it's easier to get rid of Adobe instead of hiding files.
after applying the command, like writing . in renaming u have to restart ur cell , nd then ur reader will not find that. without restart it holds the path already so it able to find even u hide them. or dnt want to restart then install e.s security. thats gud
meetmenow007 said:
after applying the command, like writing . in renaming u have to restart ur cell , nd then ur reader will not find that. without restart it holds the path already so it able to find even u hide them. or dnt want to restart then install e.s security. thats gud
Click to expand...
Click to collapse
Even after restart, Adobe Reader just finds the files somehow and shows all of them. I'm using the App Protector now and its working fine. But few hours ago found E S Security in the market and installed it on my phone. I still needs to have a look at it. Thanks for the note mate, will be helpful for other applications.
Why Security-Through-Obscurity Won't Work
I'd rather try encrypting the files and/or not use FAT16/32 filesystem as it provides no security whatsoever
Maybe repartition your card to use a ext3/ext4 partition with user rights and encryption if those data are important to you.

[Q] external sd card general questions

hi, i've just got my iconia and I am also new on the Android world. A couple of things I've noticed about the external SD card that maybe somebody could help me to understand.
1.- when I hook my tablet to my windows 7 laptop, I get to see the internal memory on the win explorer but not the external card, so is this normal or do I have to look for more updated drivers on my PC?
2.- with the external SD card on I get to see my files on an android file manager and I get to open any file individually by getting the "select app for opening this file", but this is time consuming so I am wondering if my stock lumiread, gallery, multimedia player have the current limitation of only reading the content from the internal memory. If so, what free alternatives do I have to replace stock apps?
A couple of answers
First, if you install File Manager HD, you won't need to tether your Iconia to your laptop any more. In the app, open the 'menu' and touch 'LAN Connections'. Your Windows PC will show up as an IP address. Make sure to change the IP Address to a computer name (long press, rename) so that next time File Manager won't have to search for it every time. You will be able to transfer anything on the tab to the 'Public' folder on the PC, and vice versa. Depending on what folders are shared on the PC, you will be able to access more on the PC.
I keep my music on my external SD card in a folder named 'My Music'. The stock music/multimedia players found them with no problem.
I haven't tried moving any books for Lumiread to the external SD card, so all I can suggest is to look at the file structure and duplicate it on the ext SD card, copy a book into it (a new one, or move an existing one) and see if it finds it. I don't see anything within the app to set search/storage directories, but maybe it will scan everything like the music apps do.
Have fun with you new Tab. The more you play with it the more you will understand Honeycomb and it won't seem so foreign to you. It does pretty much everything every other OS does, just a little different way.
Kp
Thanks Ken, I downloaded FMHD and will try it soon. I also though about reproducing the lumiread folder on the ext sd card but no luck, so probably a future update on the app will fix that. I tried this as well copying the pictures folder (and also renaming it as 'My Pictures') but the stock gallery just won't see the image files, is there any chance you could see if you get the same results? I have not tried yet on the music stock app. Again, thanks for your help, it is great to find nice people on the web with similar tech passions as I do
Hello Ken, like that app. Wondering if it would be an easy way to tether to my HTC Evo? Thanks in advance for you thoughts.
Bob
Get Quickpic
sensei22 said:
Thanks Ken, I downloaded FMHD and will try it soon. I also though about reproducing the lumiread folder on the ext sd card but no luck, so probably a future update on the app will fix that. I tried this as well copying the pictures folder (and also renaming it as 'My Pictures') but the stock gallery just won't see the image files, is there any chance you could see if you get the same results? I have not tried yet on the music stock app. Again, thanks for your help, it is great to find nice people on the web with similar tech passions as I do
Click to expand...
Click to collapse
I use Quickpic from the Market (free) since it lets you choose which drives/directories to scan.
Here is what you do.
1. Create the My Pics directory on the External SD card with File Manager HD, put a few pics in it.
2. After installing Quickpic, start the app. It will display everything it finds on the internal SD Card.
3. Touch the Menu button from the main screen.
4. Choose SETTINGS-INCLUDED FOLDERS-ADD
5. Tap the double dots at the top of the list, it will display all the memory devices attached.
6. Tap EXTERNAL_SD. All directories on the card will be displayed. Press OK.
Now press the 'back' button and you will see your pics that are anywhere on the External SD card.
All I did to get the A500 music player to find the music on the External SD card was run the NemoPlayer app and open the music. Once I did that the regular music app found them, too.
Have fun!
Evo
pov1 said:
Hello Ken, like that app. Wondering if it would be an easy way to tether to my HTC Evo? Thanks in advance for you thoughts.
Bob
Click to expand...
Click to collapse
Don't quote me on this, but I don't think so. From what I have seen and heard so far it is only connecting to Windows shares. I don't have an Android phone to test with, so can't swear to it, but I know it doesn't see an iPhone, so likely won't see a Mac either.
Anyone else been able to connect to anything but a Windows share? Let us know if you have, and what app you used please.

[Q] Sharing apps and media files between users

Hello,
I've tried to search but didn't find an answer...
I've just got my N10. I want to have two profiles: one for myself, the other for my wife.
The problem is the apps I installed on my own user are not shown on my wife user. I don't want to install twice every app. In addition, I don't want to pay twice for payed apps both my wife and I want to use.
Same problem with media files: pictures I took on my user are not available on my wife's user gallery.
So, my questions are:
1. How can I share apps between users?
2. How can I share media files (photos, music) between users?
Thanks in advance!
Sharing apps
Animor said:
Hello,
I've tried to search but didn't find an answer...
I've just got my N10. I want to have two profiles: one for myself, the other for my wife.
The problem is the apps I installed on my own user are not shown on my wife user. I don't want to install twice every app. In addition, I don't want to pay twice for payed apps both my wife and I want to use.
Same problem with media files: pictures I took on my user are not available on my wife's user gallery.
So, my questions are:
1. How can I share apps between users?
2. How can I share media files (photos, music) between users?
Thanks in advance!
Click to expand...
Click to collapse
Hi, did you find an answer to this? Same problem.
Hi,
1. I've found out that if an app is installed for one user, then when I install it for another user, it doesn't really get installed twice, but uses the same installation. It only makes a separate folder for saving app related data for the other user. In other words - the app is installed only once, but users have their own data, settings, etc.
2. I've also found out that I can define play store on the other user account with my own google account. That means that my wife has her own gmail and all other google things, but the play store on her user is defined with my own google account. By doing that, I solve the payed apps issue - they appear for both of us as already payed and we can just install them on my wife user without paying again.
3. As for shared files (pictures, movies, etc.) - Unfortunately, I didn't find any solution. I still hope that someone can help me with that.
Sharing apps
Animor said:
Hi,
1. I've found out that if an app is installed for one user, then when I install it for another user, it doesn't really get installed twice, but uses the same installation. It only makes a separate folder for saving app related data for the other user. In other words - the app is installed only once, but users have their own data, settings, etc.
2. I've also found out that I can define play store on the other user account with my own google account. That means that my wife has her own gmail and all other google things, but the play store on her user is defined with my own google account. By doing that, I solve the payed apps issue - they appear for both of us as already payed and we can just install them on my wife user without paying again.
3. As for shared files (pictures, movies, etc.) - Unfortunately, I didn't find any solution. I still hope that someone can help me with that.
Click to expand...
Click to collapse
Thanks for the reply Animor, really helpful.
Para 2 makes sense to implement, particularly when I have purchased apps specifically for the Nexus, at least I don't have to buy them twice!
The shared files problem is a bit of an issue, I should be able to share music and photos without having to double up on valuable storage space. Any fixes for this welcome!
Animor said:
3. As for shared files (pictures, movies, etc.) - Unfortunately, I didn't find any solution. I still hope that someone can help me with that.
Click to expand...
Click to collapse
Try putting a couple files in /data/media/obb/ and see if all users can access them. If I recall correctly, the purpose of that directory is sharing files between users.
Sharing apps
dafunk60 said:
Try putting a couple files in /data/media/obb/ and see if all users can access them. If I recall correctly, the purpose of that directory is sharing files between users.
Click to expand...
Click to collapse
Thanks - I'll try that.
dafunk60 said:
Try putting a couple files in /data/media/obb/ and see if all users can access them. If I recall correctly, the purpose of that directory is sharing files between users.
Click to expand...
Click to collapse
Thanks, but I didn't find this directory on my Nexus 10...
However, I've got a solution from another forum:
Directory /sdcard/android/obb/ can be used to share files beteween users. Basically this directory is used by large applications, but it can be also used for sharing files by adding directories or files there.
It doesn't require root, btw. All users have direct access to it.
Maybe put the shared pictures and whatnot in a Dropbox folder you share with your wife?
Not the exact solution you're looking for, but it might fit your specified requirements.
Sent from my Nexus 10 using xda app-developers app
Thank, but using dropbox is not necessary since I've already found a solution.
As I stated in my previous reply, /sdcard/android/obb/ is common to all users, so I just put there everything I want to share.
Thanks all
Answer
Try using 'SendFile'...Its available on the playstore....very simple UI and u can share any type of file between mobiles and PC's....what attaracted me was the fact that u dont need the app to download the files.....
dafunk60 said:
Try putting a couple files in /data/media/obb/ and see if all users can access them. If I recall correctly, the purpose of that directory is sharing files between users.
Click to expand...
Click to collapse
Just updated Nexus 4 to Lollipop and got excited with the new "multi-user" feature.
And following your suggestion, I managed to share files between users.

Categories

Resources