• BlackBerry Spark
  • Security library for Android applications
Preferences Class Reference

Secure SharedPreferences.

Public Member Functions

android.content.SharedPreferences getSharedPreferences (String name, int mode)
 Access a preferences file in the BlackBerry secure store. More...

Member Function Documentation

◆ getSharedPreferences()

android.content.SharedPreferences getSharedPreferences ( String  name,
int  mode 

Call this method to access a preferences file stored in the BlackBerry secure store.

This method returns a SharedPreferences object that can be used to take actions on the preferences file, such as reading and editing preference settings. The returned object implements the android.content.SharedPreferences interface with the following exceptions:

  • Only the application that created the preferences file can access it. The only supported operating mode is MODE_PRIVATE.
  • The preferences file can only be accessed after BlackBerry Spark runtime has been initialized.

See the android.content.SharedPreferences interface reference on android.com for details of the API.

Multiple preference files can be created, with different names. The preferences file name is specified as a parameter to this method. If a preferences file with the specified name doesn't exist at the time this method is called, an object reference is still returned. If an editor commit action is taken on the returned object, a new preferences file will be created, in the secure store.

nameString containing the name of the preferences file.
modeint specifying the operating mode of the preferences file, which must be MODE_PRIVATE.
android.content.SharedPreferences instance that can be used to access preferences.
See also
android.content.Context.getSharedPreferences method reference on android.com