Rank: Administration
Groups: AcademicCoachingSchool, admin, Administration, BookSeller, CatholicSchool, CoachingAdult, CoachingProfessional, CoachingSports, ExtraCurriculumCoaching, IndependentSchool, Moderator, MusicTeacher, PrivateSchool, PublicSchool, SelectiveSchool, tutor Joined: 23/11/2008(UTC) Posts: 523
|
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, 22 June 2020 8:36:32 PM(UTC)
| Reason: Not specified
|