urbanairship-core/src/main/java/com/urbanairship/PreferenceDataStore.java
private boolean writeValue(String value) {
            synchronized (this) {
                if (value == null) {
                    Logger.verbose("PreferenceDataStore - Removing preference: " + key);

                    if (resolver.delete(UrbanAirshipProvider.getPreferencesContentUri(context), WHERE_CLAUSE_KEY, new String[] { key }) == 1) {
                        resolver.notifyChange(this.uri, observer);
                        return true;
                    }

                    return false;
                } else {
                    Logger.verbose("PreferenceDataStore - Saving preference: " + key + " value: " + value);
                    ContentValues values = new ContentValues();
                    values.put(PreferencesDataManager.COLUMN_NAME_KEY, key);
                    values.put(PreferencesDataManager.COLUMN_NAME_VALUE, value);

                    if (resolver.insert(UrbanAirshipProvider.getPreferencesContentUri(context), values) != null) {
                        resolver.notifyChange(this.uri, observer);
                        return true;
                    }

                    return false;
                }
            }
        }
/**
         * Actually writes the value to the database.
         *
         * @param value The value to write
         * @return <code>true</code> if the preference was successfully written to
         * the database, otherwise <code>false</code>
         */
Actually writes the value to the database.
@param value The value to write
@return true if the preference was successfully written to
the database, otherwise false
Actually writes the value to the database . @param value The value to write @return true if the preference was successfully written to the database otherwise false
private boolean writeValue(String value) {
            synchronized (this) {
                if (value == null) {
                    Logger.verbose("PreferenceDataStore - Removing preference: " + key);
                    if (resolver.delete(UrbanAirshipProvider.getPreferencesContentUri(context), WHERE_CLAUSE_KEY, new String[] { key }) == 1) {
                        resolver.notifyChange(this.uri, observer);
                        return true;
                    }
                    return false;
                } else {
                    Logger.verbose("PreferenceDataStore - Saving preference: " + key + " value: " + value);
                    ContentValues values = new ContentValues();
                    values.put(PreferencesDataManager.COLUMN_NAME_KEY, key);
                    values.put(PreferencesDataManager.COLUMN_NAME_VALUE, value);
                    if (resolver.insert(UrbanAirshipProvider.getPreferencesContentUri(context), values) != null) {
                        resolver.notifyChange(this.uri, observer);
                        return true;
                    }
                    return false;
                }
            }
        }
private boolean writeValue ( String value ) { synchronized ( this ) { if ( value == null ) { Logger . verbose ( "PreferenceDataStore - Removing preference: " + key ) ; if ( resolver . delete ( UrbanAirshipProvider . getPreferencesContentUri ( context ) , WHERE_CLAUSE_KEY , new String [ ] { key } ) == 1 ) { resolver . notifyChange ( this . uri , observer ) ; return true ; } return false ; } else { Logger . verbose ( "PreferenceDataStore - Saving preference: " + key + " value: " + value ) ; ContentValues values = new ContentValues ( ) ; values . put ( PreferencesDataManager . COLUMN_NAME_KEY , key ) ; values . put ( PreferencesDataManager . COLUMN_NAME_VALUE , value ) ; if ( resolver . insert ( UrbanAirshipProvider . getPreferencesContentUri ( context ) , values ) != null ) { resolver . notifyChange ( this . uri , observer ) ; return true ; } return false ; } } }
Actually writes the value to the database.
Actually writes the value to the database .