Пример #1
0
		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);
		}