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.
[null,null,["Last updated 2025-08-20 UTC."],[[["\u003cp\u003e\u003ccode\u003eGoogleMobileAds.Api.ApplicationPreferences\u003c/code\u003e provides an interface for managing platform-specific preference data.\u003c/p\u003e\n"],["\u003cp\u003eThis interface allows setting integer and string values, which are shared across SDKs within the application.\u003c/p\u003e\n"],["\u003cp\u003ePreference data is stored using \u003ccode\u003eSharedPreferences\u003c/code\u003e on Android and \u003ccode\u003eNSUserDefaults\u003c/code\u003e on iOS, ensuring application-wide accessibility.\u003c/p\u003e\n"],["\u003cp\u003eValues are saved with a specific key for later retrieval or modification.\u003c/p\u003e\n"]]],[],null,["# GoogleMobileAds.Api.ApplicationPreferences Class Reference\n\nGoogleMobileAds.Api.ApplicationPreferences\n==========================================\n\nInterface for accessing and modifying application preference data (SharedPreferences on Android and NSUserDefaults on iOS).\n\nSummary\n-------\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-----------------------\n\n### GetInt\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\n### GetString\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\n### SetInt\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\n### SetString\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. | |"]]