How To Use MTP-connected Devices

by Doug Gordon » Thu, 03 Mar 2011 01:48:04 GMT


Sponsored Links
 My app currently requires the user to manually copy certain files from 
their PC to their USB-mounted Android device where my app can open them 
and do its thing. But I'm already running into issues with users' 
devices that want to mount in this "MTP" mode, and I hear that the Xoom 
*only* supports MTP, etc.


So how can MTP be used to transfer files to the device that don't really 
fit into the "Media files" category, and how do I locate the directory 
from my app? What do getExternalStorageDirectory and getExternalFilesDir 
return for a device like the Xoom?


Doug Gordon
GHCS Software

--



Re: How To Use MTP-connected Devices

by FrankG » Thu, 03 Mar 2011 04:59:35 GMT


 Hi Doug,

I can imagine that this will be more an more a problem for
applications
like yours : You cannot know in which usb mode the target device is
currently,
as this is highly vendor/manufacturer specific. You would also run
into trouble
if the user will use pictbridge. And you also not able to trigger a
mode change
because the interface to this is also specific for the manufacturer.

Would be interessted to know whether XOOM only supports MTP, but --
how far I understood Dianne in the past -- it must be at least MTP
+ADB,
otherwise Android Market will not work ?

Good luck !

   Frank





-- 


Sponsored Links


Other Threads

1. why can't catch the SocketTimeoutException

Key code below:

                    try {
                        Xml.parse(operation.outBody,
Xml.Encoding.UTF_8, parser); //  Line 89
                    } catch (SocketException e) {
                        Log.e(TAG, "getAlbumPhotos: " + e);
                        ++syncResult.stats.numIoExceptions;
                        e.printStackTrace();
                        return RESULT_ERROR;
                    } catch (SocketTimeoutException e) {  // why
SocketTimeoutException can't be catched there?????
                        Log.e(TAG, "getAlbumPhots: " + e);
                        ++syncResult.stats.numIoExceptions;
                        e.printStackTrace();
                        return RESULT_ERROR;
                   }



01:00:50 E/AndroidRuntime(935): FATAL EXCEPTION: SyncAdapterThread-1

java.lang.AssertionError: java.net.SocketTimeoutException

        at android.util.Xml.parse(Xml.java:89)

        at com.cooliris.picasa.PicasaApi.getAlbumPhotos(PicasaApi.java:293)

        at 
com.cooliris.picasa.PicasaContentProvider.syncAlbumPhotos(PicasaContentProvider.java:400)

        at 
com.cooliris.picasa.PicasaContentProvider.syncUserPhotos(PicasaContentProvider.java:362)

        at 
com.cooliris.picasa.PicasaContentProvider.syncUsersAndAlbums(PicasaContentProvider.java:185)

        at 
com.cooliris.picasa.PicasaService.performSyncImpl(PicasaService.java:177)

        at com.cooliris.picasa.PicasaService.performSync(PicasaService.java:113)

        at 
com.cooliris.picasa.PicasaSyncAdapter.onPerformSync(PicasaSyncAdapter.java:74)

        at 
android.content.AbstractThreadedSyncAdapter$SyncThread.run(AbstractThreadedSyncAdapter.java:164)

Caused by: java.net.SocketTimeoutException

        at 
org.apache.harmony.luni.net.PlainSocketImpl.read(PlainSocketImpl.java:461)

        at 
org.apache.harmony.luni.net.SocketInputStream.read(SocketInputStream.java:85)

        at 
org.apache.http.impl.io.AbstractSessionInputBuffer.fillBuffer(AbstractSessionInputBuffer.java:103)

        at 
org.apache.http.impl.io.AbstractSessionInputBuffer.read(AbstractSessionInputBuffer.java:134)

        at 
org.apache.http.impl.io.ChunkedInputStream.read(ChunkedInputStream.java:161)

        at 
org.apache.http.impl.io.ChunkedInputStream.read(ChunkedInputStream.java:175)

        at 
org.apache.http.conn.EofSensorInputStream.read(EofSensorInputStream.java:178)

        at java.util.zip.InflaterInputStream.fill(InflaterInputStream.java:225)

        at java.util.zip.InflaterInputStream.read(InflaterInputStream.java:178)

        at java.util.zip.GZIPInputStream.read(GZIPInputStream.java:174)

        at java.io.FilterInputStream.read(FilterInputStream.java:133)

        at 
org.apache.harmony.xml.ExpatParser.parseFragment(ExpatParser.java:516)

        at 
org.apache.harmony.xml.ExpatParser.parseDocument(ExpatParser.java:479)

        at org.apache.harmony.xml.ExpatReader.parse(ExpatReader.java:318)

        at org.apache.harmony.xml.ExpatReader.parse(ExpatReader.java:275)

        at android.util.Xml.parse(Xml.java:87)

        ... 8 more

-- 

2. Set wallpaper from webview

Hi, I have created 3D rendered images which I have added to an app
using Webview and I would like the option to allow the user to set
each picture as wallpaper.
I have searched high and low for this info but can't find anything.
Any information would be great. Thanks.

-- 

3. Multiple content providers to sync...

4. [WTS] titipan temen Samsung Galaxy Spica hitam 2nd

5. Benchmark Test: HTC Pyramid vs. LG Optimus 2X

6. xperia play cdma/gsm

7. Swype Bahasa Indonesia for Motorola Defy WVGA854 (Moded by keaton)