Interface MMKVHandler
-
- All Implemented Interfaces:
public interface MMKVHandlerUnified callback handler for MMKV. Callback is called on the operating thread of the MMKV instance.
-
-
Method Summary
Modifier and Type Method Description abstract MMKVRecoverStrategiconMMKVCRCCheckFail(String mmapID)By default MMKV will discard all data on crc32-check failure. abstract MMKVRecoverStrategiconMMKVFileLengthError(String mmapID)By default MMKV will discard all data on file length mismatch. abstract booleanwantLogRedirecting()abstract voidmmkvLog(MMKVLogLevel level, String file, int line, String function, String message)Log Redirecting. longgetNativeLogHandler()handle the log in NDK native code booleanwantContentChangeNotification()voidonContentChangedByOuterProcess(String mmapID)Inter-process content change notification. voidonMMKVContentLoadSuccessfully(String mmapID)Called when an MMKV file is loaded successfully. -
-
Method Detail
-
onMMKVCRCCheckFail
abstract MMKVRecoverStrategic onMMKVCRCCheckFail(String mmapID)
By default MMKV will discard all data on crc32-check failure. OnErrorDiscard
- Parameters:
mmapID- The unique ID of the MMKV instance.- Returns:
Return OnErrorRecover to recover any data on the file.
-
onMMKVFileLengthError
abstract MMKVRecoverStrategic onMMKVFileLengthError(String mmapID)
By default MMKV will discard all data on file length mismatch. OnErrorDiscard
- Parameters:
mmapID- The unique ID of the MMKV instance.- Returns:
Return OnErrorRecover to recover any data on the file.
-
wantLogRedirecting
abstract boolean wantLogRedirecting()
- Returns:
Return False if you don't want log redirecting.
-
mmkvLog
abstract void mmkvLog(MMKVLogLevel level, String file, int line, String function, String message)
Log Redirecting.
- Parameters:
level- The level of this log.file- The file name of this log.line- The line of code of this log.function- The function name of this log.message- The content of this log.
-
getNativeLogHandler
long getNativeLogHandler()
handle the log in NDK native code
- Returns:
a native log handler with signature of void log(int level, const char *file, int line, const char *function, const char *message) return 0 to indicate no native handler
-
wantContentChangeNotification
boolean wantContentChangeNotification()
- Returns:
Return true if you want inter-process content change notification.
-
onContentChangedByOuterProcess
void onContentChangedByOuterProcess(String mmapID)
Inter-process content change notification. Triggered by any method call, such as getXXX() or setXXX() or checkContentChangedByOuterProcess.
- Parameters:
mmapID- The unique ID of the changed MMKV instance.
-
onMMKVContentLoadSuccessfully
void onMMKVContentLoadSuccessfully(String mmapID)
Called when an MMKV file is loaded successfully.
- Parameters:
mmapID- The unique ID of the loaded MMKV instance.
-
-
-
-