Summary: As per the title Reviewed By: passy Differential Revision: D15181533 fbshipit-source-id: ca2b13dc81cd28fd2d6ab84fbdc000006d2d43e9
42 lines
985 B
Markdown
42 lines
985 B
Markdown
---
|
|
id: shared-preferences-plugin
|
|
title: Shared Preferences Setup
|
|
sidebar_label: Shared Preferences
|
|
---
|
|
|
|
This plugin is available for both Android and iOS.
|
|
|
|
## Android
|
|
|
|
```java
|
|
import com.facebook.flipper.plugins.sharedpreferences.SharedPreferencesFlipperPlugin;
|
|
|
|
client.addPlugin(
|
|
new SharedPreferencesFlipperPlugin(context, "my_shared_preference_file"));
|
|
```
|
|
|
|
## iOS
|
|
|
|
If you want to use the Shared Preferences plugin, you need to add `FlipperKit/FlipperKitUserDefaultsPlugin` to your Podfile.
|
|
|
|
```ruby
|
|
pod 'FlipperKit/FlipperKitUserDefaultsPlugin', '~>' + flipperkit_version
|
|
```
|
|
|
|
Initialize the plugin in the following way:
|
|
|
|
<!--DOCUSAURUS_CODE_TABS-->
|
|
<!--Objective-C-->
|
|
```objc
|
|
#import <FlipperKitUserDefaultsPlugin/FKUserDefaultsPlugin.h>
|
|
|
|
[client addPlugin:[[FKUserDefaultsPlugin alloc] initWithSuiteName:@"your_suitename"]];
|
|
```
|
|
<!--Swift-->
|
|
```swift
|
|
import FlipperKit
|
|
|
|
client?.add(FKUserDefaultsPlugin.init(suiteName: "your_suitename"))
|
|
```
|
|
<!--END_DOCUSAURUS_CODE_TABS-->
|