Results 1 to 16 of 16
  1. #1
    Toll's Avatar
    Toll is offline Senior Member
    Join Date
    May 2011
    Location
    Sweden
    Posts
    392
    Rep Power
    4

    Default Transferring files to cellphone

    Hi!

    So I'm working on a small project of mine to convert videos into formats that better suit a cellphone, and want to add in functionality to transfer the completed files to the phone as well once they're done. I can't seem to find it anywhere though; it's not in File.listRoots, nor can I find a link anywhere in the file system. Is there a general way to do what I want to do (either in standard Java or by downloading an addon), or would I need to go JNI-diving (which I probably won't do) to add that functionality? In case it matters, it's an Android 4.1.2 (LG-P875).

  2. #2
    kjkrum's Avatar
    kjkrum is offline Senior Member
    Join Date
    Apr 2011
    Location
    Tucson, AZ
    Posts
    1,060
    Rep Power
    6

    Default Re: Transferring files to cellphone

    It's not in File.listRoots() even when the phone is connected as a USB mass storage device? What about emailing the files to the phone?
    Get in the habit of using standard Java naming conventions!

  3. #3
    Toll's Avatar
    Toll is offline Senior Member
    Join Date
    May 2011
    Location
    Sweden
    Posts
    392
    Rep Power
    4

    Default Re: Transferring files to cellphone

    Encoded video files tend to be too large to send as emails. And besides, it'd probably be easier to just manually copy the files rather than sending a mail to the phone and then opening the attachment.

  4. #4
    kjkrum's Avatar
    kjkrum is offline Senior Member
    Join Date
    Apr 2011
    Location
    Tucson, AZ
    Posts
    1,060
    Rep Power
    6

    Default Re: Transferring files to cellphone

    So... direct transfer to USB mass storage? What OS are you developing on? Keep in mind that UNIX will only ever have one filesystem root. Have a look at this: How can I get a list of all mounted filesystems in Java on Unix? - Stack Overflow
    Get in the habit of using standard Java naming conventions!

  5. #5
    Toll's Avatar
    Toll is offline Senior Member
    Join Date
    May 2011
    Location
    Sweden
    Posts
    392
    Rep Power
    4

    Default Re: Transferring files to cellphone

    Nah, I'm using Windows. And the problem is the cellphone isn't showing up on File.listRoots(), so I have no way to access it through Java. It appears in My Computer though, so I can access it from there by hand... just not automatically as I would've liked. If it were Unix, I probably could've figured something out, but... yeah, not with Windows.

  6. #6
    kjkrum's Avatar
    kjkrum is offline Senior Member
    Join Date
    Apr 2011
    Location
    Tucson, AZ
    Posts
    1,060
    Rep Power
    6

    Default Re: Transferring files to cellphone

    Weird. I don't know why it wouldn't show up in File.listRoots() if it shows up in My Computer. Seems like a JRE bug, but I'm not sure.
    Get in the habit of using standard Java naming conventions!

  7. #7
    Toll's Avatar
    Toll is offline Senior Member
    Join Date
    May 2011
    Location
    Sweden
    Posts
    392
    Rep Power
    4

    Default Re: Transferring files to cellphone

    I think the problem is that it doesn't show up as a normal device (i.e. it doesn't have C:\ or E:\ or anything like that), but rather as a "mobile device". So while I can access it like any other storage medium manually, I can't actually do so by using Java, nor by using the command prompt (at least not that I've found).

  8. #8
    kjkrum's Avatar
    kjkrum is offline Senior Member
    Join Date
    Apr 2011
    Location
    Tucson, AZ
    Posts
    1,060
    Rep Power
    6

    Default Re: Transferring files to cellphone

    When I connect my phone (Android 2.3.6) it asks if I want to turn on USB mass storage. If I say yes, it shows up as a normal drive. If I say no, it's treated as an unknown device because I didn't install any special drivers for it. You may have to change something in your phone settings to have it show up as a USB mass storage device.
    Get in the habit of using standard Java naming conventions!

  9. #9
    Toll's Avatar
    Toll is offline Senior Member
    Join Date
    May 2011
    Location
    Sweden
    Posts
    392
    Rep Power
    4

    Default Re: Transferring files to cellphone

    I get five or so choices when I connect mine, and neither is "USB mass storage", nor can I find it in the settings anywhere (although I've only had the phone for a couple of weeks, so I could have overlooked something). No matter which type of connection I choose though, it never shows up as a normal drive, but always a mobile device.

    I'm starting to think that isn't a "normal" way for a phone to connect though, so that generic easy-to-use connection I was hoping for probably doesn't exist, alas.

  10. #10
    kjkrum's Avatar
    kjkrum is offline Senior Member
    Join Date
    Apr 2011
    Location
    Tucson, AZ
    Posts
    1,060
    Rep Power
    6

    Default Re: Transferring files to cellphone

    You could set up a Bluetooth file server or something on the phone, or write a custom app to receive the files. You can also use adb to copy the files, but this would require turning on adb debugging in the phone's developer settings. Using adb To Copy Files To / From Your Android Device | Think. Debate. Innovate.
    Get in the habit of using standard Java naming conventions!

  11. #11
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    4,054
    Rep Power
    6

    Default Re: Transferring files to cellphone

    Quote Originally Posted by kjkrum View Post
    Weird. I don't know why it wouldn't show up in File.listRoots() if it shows up in My Computer. Seems like a JRE bug, but I'm not sure.
    You can't blame the JRE for something that the OS manages.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  12. #12
    Toll's Avatar
    Toll is offline Senior Member
    Join Date
    May 2011
    Location
    Sweden
    Posts
    392
    Rep Power
    4

    Default Re: Transferring files to cellphone

    A bit more hackish than I was hoping for, but at least it works! Thanks! I'm going to have to write an app for this at some point though...

    I know it's a bit off-topic, but would you happen to have a nice tutorial for writing apps? Just need to know where to start, basically.

  13. #13
    kjkrum's Avatar
    kjkrum is offline Senior Member
    Join Date
    Apr 2011
    Location
    Tucson, AZ
    Posts
    1,060
    Rep Power
    6

    Default Re: Transferring files to cellphone

    I got started with two books: "Unlocking Android" published by Manning (which is old and partly obsolete) and "Programming Android" published by O'Reilly.
    Get in the habit of using standard Java naming conventions!

  14. #14
    kjkrum's Avatar
    kjkrum is offline Senior Member
    Join Date
    Apr 2011
    Location
    Tucson, AZ
    Posts
    1,060
    Rep Power
    6

    Default Re: Transferring files to cellphone

    Quote Originally Posted by gimbal2 View Post
    You can't blame the JRE for something that the OS manages.
    I thought he meant it was showing up as a file system in My Computer but not in File.listRoots().
    Get in the habit of using standard Java naming conventions!

  15. #15
    Toll's Avatar
    Toll is offline Senior Member
    Join Date
    May 2011
    Location
    Sweden
    Posts
    392
    Rep Power
    4

    Default Re: Transferring files to cellphone

    Quote Originally Posted by kjkrum View Post
    I got started with two books: "Unlocking Android" published by Manning (which is old and partly obsolete) and "Programming Android" published by O'Reilly.
    I'll see if I can get a hold of those books then. I've always kinda wanted to do some programming for the Android system, and now that I've got one myself, I figure it's time to do just that. Thanks for all your help!

    And yeah, sorry about the confusion. Sometimes I get ahead of myself in my explanations, and won't spell things out all the way.

  16. #16
    DarrylBurke's Avatar
    DarrylBurke is online now Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,305
    Rep Power
    20

    Default Re: Transferring files to cellphone

    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

Similar Threads

  1. Transferring a file using Sockets
    By SerbianSergeant in forum Networking
    Replies: 1
    Last Post: 09-08-2011, 01:16 AM
  2. Netbeans errors when transferring file
    By dbashby in forum New To Java
    Replies: 7
    Last Post: 04-15-2009, 03:41 PM
  3. Transferring a .txt file from 1 location to another
    By dbashby in forum New To Java
    Replies: 2
    Last Post: 04-15-2009, 05:22 AM
  4. Dual sim solutions for any cellphone
    By Larrys in forum NetBeans
    Replies: 1
    Last Post: 02-25-2009, 04:17 AM
  5. Transferring Over Network
    By qwerty in forum Advanced Java
    Replies: 2
    Last Post: 08-01-2008, 01:40 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •