Stay organized with collections
Save and categorize content based on your preferences.
GoogleMobileAds.Api.ApplicationPreferences
Interface for accessing and modifying application preference data (SharedPreferences on Android and NSUserDefaults on iOS).
Summary
Values saved by this interface are saved in an application scope, and are shared by SDKs included in this application.
Public static functions
|
GetInt(string key)
|
int
Read an int value from the application preferences.
|
GetString(string key)
|
string
Read a string value from the application preferences.
|
SetInt(string key, int value)
|
void
Set an int value in the application preferences.
|
SetString(string key, string value)
|
void
Set a string value in the application preferences.
|
Public static functions
GetInt
int GetInt(
string key
)
Read an int value from the application preferences.
Details |
Parameters |
key
|
The key with which to retrieve the value.
|
|
GetString
string GetString(
string key
)
Read a string value from the application preferences.
Details |
Parameters |
key
|
The key with which to retrieve the value.
|
|
SetInt
void SetInt(
string key,
int value
)
Set an int value in the application preferences.
Details |
Parameters |
key
|
The key with which to associate the value.
|
value
|
The value that needs to be associated to the key.
|
|
SetString
void SetString(
string key,
string value
)
Set a string value in the application preferences.
Details |
Parameters |
key
|
The key with which to associate the value.
|
value
|
The value that needs to be associated to the key.
|
|
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-08-20 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-20 UTC."],[[["\u003cp\u003eThe \u003ccode\u003eApplicationPreferences\u003c/code\u003e interface allows access and modification of application preference data, similar to SharedPreferences on Android and NSUserDefaults on iOS.\u003c/p\u003e\n"],["\u003cp\u003eValues stored using this interface are application-wide and shared by all SDKs within the application.\u003c/p\u003e\n"],["\u003cp\u003eIt provides functions to get and set integer and string values using keys.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eGetInt\u003c/code\u003e and \u003ccode\u003eGetString\u003c/code\u003e retrieve integer and string values respectively using a specified key.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eSetInt\u003c/code\u003e and \u003ccode\u003eSetString\u003c/code\u003e store integer and string values respectively, associating them with a given key.\u003c/p\u003e\n"]]],["This interface allows access to application preference data, shared across all SDKs within the application. It provides four functions: `GetInt` and `GetString` to read integer and string values, respectively, using a specified key. `SetInt` and `SetString` are used to store integer and string values, associating them with a given key. The data is stored with application scope.\n"],null,["GoogleMobileAds.Api.ApplicationPreferences\n\nInterface for accessing and modifying application preference data (SharedPreferences on Android and NSUserDefaults on iOS).\n\nSummary\n\nValues saved by this interface are saved in an application scope, and are shared by SDKs included in this application.\n\n| Public static functions ||\n|------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------|\n| [GetInt](#class_google_mobile_ads_1_1_api_1_1_application_preferences_1a45142ada039ff4f929c4833f8716c013)`(string key)` | `int` Read an int value from the application preferences. |\n| [GetString](#class_google_mobile_ads_1_1_api_1_1_application_preferences_1a4d3bb991eb41c245be0a69d07a61a283)`(string key)` | `string` Read a string value from the application preferences. |\n| [SetInt](#class_google_mobile_ads_1_1_api_1_1_application_preferences_1af44cbd83d5b0197fa4cb5aade13b866e)`(string key, int value)` | `void` Set an int value in the application preferences. |\n| [SetString](#class_google_mobile_ads_1_1_api_1_1_application_preferences_1a66402a11446d4af5eec8ca2821c45baf)`(string key, string value)` | `void` Set a string value in the application preferences. |\n\nPublic static functions \n\nGetInt \n\n```c#\nint GetInt(\n string key\n)\n``` \nRead an int value from the application preferences.\n\n\u003cbr /\u003e\n\n| Details ||\n|------------|-------------------------------------------------------------------------------------------------------------|\n| Parameters | |-------|-------------------------------------------| | `key` | The key with which to retrieve the value. | |\n\nGetString \n\n```c#\nstring GetString(\n string key\n)\n``` \nRead a string value from the application preferences.\n\n\u003cbr /\u003e\n\n| Details ||\n|------------|-------------------------------------------------------------------------------------------------------------|\n| Parameters | |-------|-------------------------------------------| | `key` | The key with which to retrieve the value. | |\n\nSetInt \n\n```c#\nvoid SetInt(\n string key,\n int value\n)\n``` \nSet an int value in the application preferences.\n\n\u003cbr /\u003e\n\n| Details ||\n|------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| Parameters | |---------|---------------------------------------------------| | `key` | The key with which to associate the value. | | `value` | The value that needs to be associated to the key. | |\n\nSetString \n\n```c#\nvoid SetString(\n string key,\n string value\n)\n``` \nSet a string value in the application preferences.\n\n\u003cbr /\u003e\n\n| Details ||\n|------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| Parameters | |---------|---------------------------------------------------| | `key` | The key with which to associate the value. | | `value` | The value that needs to be associated to the key. | |"]]