More Group Sites
Education Books
School Rankings
Jobless Net
Better Home
Enviro++
更好教育论坛
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Share
Options
View
Go to last post Go to first unread
hong  
#1 Posted : Monday, June 22, 2020 8:36:01 PM(UTC)
hong

Rank: Administration

Reputation:

Groups: AcademicCoachingSchool, admin, Administration, BookSeller, CatholicSchool, CoachingAdult, CoachingProfessional, CoachingSports, ExtraCurriculumCoaching, IndependentSchool, Moderator, MusicTeacher, PrivateSchool, PublicSchool, SelectiveSchool, tutor
Joined: 11/23/2008(UTC)
Posts: 522

Xamarin forms Android save file to download directory

Code:
            //"/storage/emulated/0/Android/data/au.com.interlogix.tecommobilev2/files/Download/" 

            var sdkLogPath = Application.Context.GetExternalFilesDir(Android.OS.Environment.DirectoryDownloads).AbsolutePath + "/";             HCNetSDK.Instance.NET_DVR_SetLogToFile(3, sdkLogPath + "/", true);

Incorrect ways:

Code:

            //HCNetSDK.Instance.NET_DVR_SetLogToFile(3, "/mnt/sdcard/sdklog/", true);             //path of the folder, sdklog file SdkLog_1_W.log             //var sdkLogPath = Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), "sdklog/");             //"/data/user/0/au.com.interlogix.tecommobilev2/files/sdklog/"             //var sdkLogPath = Path.Combine(FileSystem.AppDataDirectory, "sdklog/");

            //System.Environment.SpecialFolder.MyDocuments is the same as FileSystem.AppDataDirectory or System.Environment.SpecialFolder.Personal             //no SdkLog_1_W.log created

            //https://kimsereyblog.blogspot.com/2016/11/differences-between-internal-and.html             //Internal folder             //Use this storage to store document specific to your application which will not be accessible from else where.             //Another important point is that when the user uninstall the application, all the data within that folder will be removed.             //var rootDirectory = System.Environment.GetFolderPath(System.Environment.SpecialFolder.MyDocuments);             //var sdkLogPath = rootDirectory + "/";

            //Public external folders /storage/emulated/0/             //var sdkLogPath = Android.OS.Environment.ExternalStorageDirectory.AbsolutePath + "/";             //tested isWriteable = true             //bool isWriteable = Android.OS.Environment.MediaMounted.Equals(Android.OS.Environment.ExternalStorageState);

            //"/storage/emulated/0/Download/", use the next one             //var sdkLogPath = Path.Combine(Android.OS.Environment.ExternalStorageDirectory.AbsolutePath, Android.OS.Environment.DirectoryDownloads) + "/";

Edited by user Monday, June 22, 2020 8:36:32 PM(UTC)  | Reason: Not specified

Sponsor
Rss Feed  Atom Feed
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.