Available Methods
- getSystemService ( )
- obtainStyledAttributes ( )
- startActivity ( )
- getSharedPreferences ( )
- getApplicationContext ( )
- getString ( )
- getResources ( )
- getPackageManager ( )
- startService ( )
- getPackageName ( )
- getContentResolver ( )
- sendBroadcast ( )
- getCacheDir ( )
- getFilesDir ( )
- getApplicationInfo ( )
- toString ( )
- registerReceiver ( )
- getAssets ( )
- getExternalFilesDir ( )
- getExternalCacheDir ( )
- getDir ( )
- unregisterReceiver ( )
- bindService ( )
- openFileOutput ( )
- stopService ( )
- checkCallingOrSelfPermission ( )
- getTheme ( )
- unbindService ( )
- startForegroundService ( )
- getMainLooper ( )
- deleteDatabase ( )
- getClassLoader ( )
- getDatabasePath ( )
- openFileInput ( )
- MODE_PRIVATE
- checkSelfPermission ( )
- getDrawable ( )
- checkPermission ( )
- deleteFile ( )
- createConfigurationContext ( )
- getColor ( )
- grantUriPermission ( )
- CONTEXT_DEVICE_PROTECTED_STORAGE
- getExternalFilesDirs ( )
- getFileStreamPath ( )
- CONTEXT_CREDENTIAL_PROTECTED_STORAGE
- sendOrderedBroadcast ( )
- setTheme ( )
- MODE_MULTI_PROCESS
- checkCallingOrSelfUriPermission ( )
- getText ( )
- createPackageContext ( )
- openOrCreateDatabase ( )
- isRestricted ( )
- NOTIFICATION_SERVICE
- BIND_AUTO_CREATE
- startActivities ( )
- getPackageCodePath ( )
- createDeviceProtectedStorageContext ( )
- getExternalCacheDirs ( )
- CONTEXT_IGNORE_SECURITY
- registerComponentCallbacks ( )
- revokeUriPermission ( )
- getColorStateList ( )
- CONTEXT_RESTRICTED
- checkCallingPermission ( )
- BIND_IMPORTANT
- deleteSharedPreferences ( )
- getClass ( )
- getCodeCacheDir ( )
- BIND_DEBUG_UNBIND
- MODE_WORLD_READABLE
- startServiceAsUser ( )
- getSharedPreferencesPath ( )
- enforceCallingOrSelfPermission ( )
- BIND_TREAT_LIKE_ACTIVITY
- getObbDir ( )
- getObbDirs ( )
- LOCATION_SERVICE
- moveSharedPreferencesFrom ( )
- CONTEXT_INCLUDE_CODE
- bindServiceAsUser ( )
- BIND_ABOVE_CLIENT
- removeStickyBroadcast ( )
Related Classes
- java.io.File
- java.io.InputStream
- android.os.Bundle
- android.view.View
- java.util.Date
- android.util.Log
- android.widget.TextView
- android.content.Intent
- android.view.ViewGroup
- android.app.Activity
- java.io.FileOutputStream
- java.util.Locale
- android.view.LayoutInflater
- android.os.Build
- android.widget.Toast
- android.util.AttributeSet
- android.widget.ImageView
- android.graphics.Color
- android.os.Handler
- android.net.Uri
- android.graphics.Bitmap
- android.text.TextUtils
- android.graphics.Paint
- android.graphics.drawable.Drawable
- android.widget.LinearLayout
Java Code Examples for android.content.Context#moveSharedPreferencesFrom()
The following examples show how to use
android.content.Context#moveSharedPreferencesFrom() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AlarmStorage.java From security-samples with Apache License 2.0 | 6 votes |
public AlarmStorage(Context context) { Context storageContext; if (BuildCompat.isAtLeastN()) { // 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. final Context deviceContext = context.createDeviceProtectedStorageContext(); if (!deviceContext.moveSharedPreferencesFrom(context, ALARM_PREFERENCES_NAME)) { Log.w(TAG, "Failed to migrate shared preferences."); } storageContext = deviceContext; } else { storageContext = context; } mSharedPreferences = storageContext .getSharedPreferences(ALARM_PREFERENCES_NAME, Context.MODE_PRIVATE); }
Example 2
Source File: AlarmStorage.java From android-DirectBoot with Apache License 2.0 | 6 votes |
public AlarmStorage(Context context) { Context storageContext; if (BuildCompat.isAtLeastN()) { // 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. final Context deviceContext = context.createDeviceProtectedStorageContext(); if (!deviceContext.moveSharedPreferencesFrom(context, ALARM_PREFERENCES_NAME)) { Log.w(TAG, "Failed to migrate shared preferences."); } storageContext = deviceContext; } else { storageContext = context; } mSharedPreferences = storageContext .getSharedPreferences(ALARM_PREFERENCES_NAME, Context.MODE_PRIVATE); }
Example 3
Source File: WadbApplication.java From WADB with Apache License 2.0 | 5 votes |
public static SharedPreferences getDefaultSharedPreferences() { Context context= getInstance(); if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.N) { context = getInstance().createDeviceProtectedStorageContext(); context.moveSharedPreferencesFrom(getInstance(),getDefaultSharedPreferenceName()); } return context.getSharedPreferences(getDefaultSharedPreferenceName(), Context.MODE_PRIVATE); }
Example 4
Source File: SharedPreferencesUtils.java From talkback with Apache License 2.0 | 5 votes |
/** * Move existing preferences file from credential protected storage to device protected storage. * This is used to migrate data between storage locations after an Android upgrade from * Build.VERSION < N to Build.VERSION >= N. */ public static void migrateSharedPreferences(Context context) { if (BuildVersionUtils.isAtLeastN()) { Context deContext = ContextCompat.createDeviceProtectedStorageContext(context); deContext.moveSharedPreferencesFrom( context, PreferenceManager.getDefaultSharedPreferencesName(context)); } }