c# - How do I save a file to my Phone's Internal Storage or SD Card? -


due several bugs in frameworks, have resort manually copying , pasting apk file local machine phone when connected machine via usb.

this extremely tedious , it's getting on nerves. thought create console app, watches file system changes file , when necessary, copy file machine directory on phone.

i have full file access phone using file explorer in windows. it's android phone (htc 1 m8). , when browse root directory in file explorer, "file path" in address bar location of file explorer says:

this pc\htc one_m8\internal storage

or location:

this pc\htc one_m8\sd card

but when do:

file.copy(source, "this pc\htc one_m8\internal storage\notes.apk", true); 

i following exception:

could not find part of path 'this pc\htc one_m8\internal storage\notes.apk'. @ system.io.__error.winioerror(int32 errorcode, string maybefullpath) @ system.io.file.internalcopy(string sourcefilename, string destfilename, boolean overwrite, boolean checkhost) @ system.io.file.copy(string sourcefilename, string destfilename, boolean overwrite) @ quick_build_transfer.program.main(string[] args) in c:\users\jase\documents\visual studio 2015\projects\my samples\quick build transfer\quick build transfer\program.cs:line 33

mscorlib void winioerror(int32, system.string)

so question is, how copy file phone's internal storage, or sd card?

you can use

 adb install routeofapk/apk.apk 

and work fine. why don't use that?


Popular posts from this blog