Xamarin - Android enable MTP programmatically

HBBob 21 Reputation points
2021-06-29T01:02:08.073+00:00

I have a Xamarin form app targeting Android that runs on a MEMOR 10 device. The user scans barcodes, the app creates a .csv file. The user connects the device to a PC and manually pulls the .csv file off the device. Simple enough... My issue is the default USB connection type for the device is "USB Charging" unless the user changes it to "File Transfer" they can't see the file. I know I can change the default on the device itself but I'd like to be able to do it from my app, is this possible? If so how? Thanks

Developer technologies .NET Xamarin
0 comments No comments
{count} votes

Accepted answer
  1. JarvanZhang 23,971 Reputation points
    2021-06-30T02:09:09.88+00:00

    Hello,​

    Welcome to our Microsoft Q&A platform!

    I know I can change the default on the device itself but I'd like to be able to do it from my app, is this possible?

    Sorry, it's not possible. Google doesn't support to swich to the MTP mode for a device programmatically because the beavior may cause a huge security vulnerability. This mode can only be enabled manaually.

    Best Regards,

    Jarvan Zhang


    If the response is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.