本文整理汇总了C#中Android.Content.Context.CreateDeviceProtectedStorageContext方法的典型用法代码示例。如果您正苦于以下问题:C# Context.CreateDeviceProtectedStorageContext方法的具体用法?C# Context.CreateDeviceProtectedStorageContext怎么用?C# Context.CreateDeviceProtectedStorageContext使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Android.Content.Context
的用法示例。
在下文中一共展示了Context.CreateDeviceProtectedStorageContext方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AlarmStorage
public AlarmStorage (Context context)
{
Context storageContext;
// TODO Use Support BuildCompat or proper N Version code.
if (Build.VERSION.SdkInt > BuildVersionCodes.M) {
// All N devices have split storage areas, but we may need to
// move the existing preferences to the new device protected
// storage area, which is where the data lives from now on.
Context deviceContext = context.CreateDeviceProtectedStorageContext();
if (!deviceContext.MoveSharedPreferencesFrom (context, ALARM_PREFERENCES_NAME))
Log.Warn (TAG, "Failed to migrate shared preferences.");
storageContext = deviceContext;
} else {
storageContext = context;
}
sharedPreferences = storageContext.GetSharedPreferences (ALARM_PREFERENCES_NAME, FileCreationMode.Private);
}