mirror of
https://dev.azure.com/TeilRad/sharee.bike%20App/_git/Code
synced 2025-05-13 21:16:38 +02:00
Initial version.
This commit is contained in:
parent
e4fb48f6ab
commit
10dbeb5a90
737 changed files with 61885 additions and 0 deletions
49
TINK/TINK.Android/Model/Device/SpecialFolder.cs
Normal file
49
TINK/TINK.Android/Model/Device/SpecialFolder.cs
Normal file
|
@ -0,0 +1,49 @@
|
|||
using Serilog;
|
||||
using System;
|
||||
using TINK.Model.Device;
|
||||
using Xamarin.Forms;
|
||||
|
||||
[assembly: Dependency(typeof(TINK.Droid.Model.Device.SpecialFolder))]
|
||||
namespace TINK.Droid.Model.Device
|
||||
{
|
||||
public class SpecialFolder : ISpecialFolder
|
||||
{
|
||||
/// <summary> Get the folder name of external folder to write to. </summary>
|
||||
/// <returns> Name of the external folder. </returns>
|
||||
public string GetExternalFilesDir()
|
||||
{
|
||||
string baseFolderPath = string.Empty;
|
||||
try
|
||||
{
|
||||
var context = Android.App.Application.Context;
|
||||
Java.IO.File[] dirs = context.GetExternalFilesDirs(null);
|
||||
|
||||
foreach (Java.IO.File folder in dirs)
|
||||
{
|
||||
bool IsRemovable = Android.OS.Environment.InvokeIsExternalStorageRemovable(folder);
|
||||
bool IsEmulated = Android.OS.Environment.InvokeIsExternalStorageEmulated(folder);
|
||||
|
||||
if (IsRemovable
|
||||
&& !IsEmulated)
|
||||
{
|
||||
baseFolderPath = folder.Path;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
catch (Exception l_oException)
|
||||
{
|
||||
Log.Error("Getting external files directory failed. {@l_oException}", l_oException);
|
||||
}
|
||||
|
||||
return baseFolderPath;
|
||||
}
|
||||
|
||||
/// <summary> Gets the folder name of the personal data folder dir on internal storage. </summary>
|
||||
/// <returns>Directory name.</returns>
|
||||
public string GetInternalPersonalDir()
|
||||
{
|
||||
return Environment.GetFolderPath(Environment.SpecialFolder.Personal);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue