How To Pass A Parmeter To Service Android
When using Firebase console or the Remote Config backend APIs, you define 1 or more parameters (central-value pairs) and provide in-app default values for those parameters. You tin can override in-app default values by defining server-side parameter values. Parameter keys and parameter values are strings, but parameter values tin exist cast as other data types when you apply these values in your app.
Using the Firebase console or the Remote Config REST API, you can create new default values for your parameters, equally well as conditional values that are used to target groups of app instances. Each time yous update your configuration in the Firebase console, Firebase creates and publishes a new version of your Remote Config template. The previous version is stored, assuasive yous to think or rollback as needed. These operations are also bachelor to you via the REST API.
This guide explains parameters, conditions, rules, provisional values, and how various parameter values are prioritized on the Remote Config Server and in your app. Information technology likewise provides details on the types of rules used to create conditions.
Weather condition, rules, and conditional values
A condition is used to target a group of app instances. Weather are made upward of one or more rules that must all evaluate to true for the condition to evaluate to true for a given app instance. If the value for a rule is undefined (for example, when no value is available), that rule will evaluate to false.
For case, a parameter that defines an app'due south splash folio could display different images based on OS type using the unproblematic rule if device_os = Android:
Or, a time condition could be used to control when your app displays special promotional items.
A parameter tin can have multiple provisional values that utilize different conditions, and parameters can share conditions inside a project. In the Parameters tab of the Firebase console, you can view the fetch percentage for each parameter'southward conditional values. This metric indicates the percent of requests in the last 24 hours that received each value.
Parameter value priority
A parameter might have several conditional values associated with it. The following rules decide which value is fetched from the Remote Config Server, and which value is used in a given app case at a particular point in time:
Server-side parameter values are fetched according to the following priority list
-
First, conditional values are applied, if any take conditions that evaluate to
truthfulfor a given app case. If multiple conditions evaluate totruthful, the first (top) ane shown in the Firebase console UI takes precedence, and conditional values associated with that condition are provided when an app fetches values from the backend. You can alter the priority of conditions by dragging and dropping conditions in the Conditions tab. -
If there are no conditional values with atmospheric condition that evaluate to
true, the server-side default value is provided when an app fetches values from the backend. If a parameter doesn't be in the backend, or if the default value is ready to Use in-app default, then no value is provided for that parameter when an app fetches values.
In your app, parameter values are returned by get methods according to the following priority list
- If a value was fetched from the backend and and then activated, the app uses the fetched value. Activated parameter values are persistent.
- If no value was fetched from the backend, or if values fetched from the Remote Config backend have not been activated, the app uses the in-app default value.
- If no in-app default value has been ready, the app uses a static type value (such every bit
0forintandfalseforboolean).
This graphic summarizes how parameter values are prioritized in the Remote Config backend, and in your app:
Parameter value information types
Remote Config allows you to select a data type for each parameter, and validates all server-side values against that type before a template update. The information type is stored and returned on a getRemoteConfig request.
The currently supported types are:
-
String -
Boolean -
Number -
JSON
In the Firebase console UI the information blazon tin be selected from a dropdown next to the parameter fundamental. In the Residuum API types can be set using the value_type field within the parameter object.
Parameter groups
Remote Config allows yous to group parameters together for a more organized UI and mental model.
For example, permit's say you demand to enable or disable three unlike auth types while rolling out a new login feature. With Remote Config, you tin create the 3 parameters to enable the types as desired, and so organize them in a grouping named "New login," with no need to add together prefixes or special sorting.
Y'all can create parameter groups using the Firebase panel or the Remote Config Residue API. Each parameter group you create has a unique name in your Remote Config template. When creating parameter groups, keep in mind:
- Parameters can be included in only one group at any fourth dimension, and a parameter key must still be unique across all parameters.
- Parameter group names are limited to 256 characters.
- If y'all use both the Rest API and the Firebase console, make certain that any Balance API logic is updated to handle parameter groups on publish.
Create or modify parameter groups using the Firebase console
You tin grouping parameters in the Parameters tab of the Firebase console. To create or modify a group:
- Select Manage groups.
- Select checkboxes for parameters you want to add and select Motility to group.
- Select an existing group, or create a new grouping by entering a name and description, and selecting Create new group. After you relieve a grouping, it is available to exist published using the Publish changes push button.
Create groups programmatically
The Remote Config REST API provides an automated way to create and publish parameter groups. Assuming you are familiar with REST and are fix to authorize requests to the API, you lot can perform these steps to manage groups programmatically:
- Retrieve the current template
- Add together JSON objects to represent your parameter groups
- Publish the parameter groups using an HTTP PUT request.
The parameterGroups object contains group keys, with a nested description and listing of grouped parameters. Note that each group key must be globally unique.
For case, here is an excerpt from a template revision that adds the parameter group "new menu" with one parameter, pumpkin_spice_season:
{ "parameters": {}, "version": { "versionNumber": "1", … }, "parameterGroups": { "new menu": { "clarification": "New Menu", "parameters": { "pumpkin_spice_season": { "defaultValue": { "value": "truthful" }, "description": "Whether it's currently pumpkin spice season." } } } } } Condition rule types
The following rule types are supported in the Firebase console. Equivalent functionality is available in the Remote Config Rest API, as detailed in the conditional expression reference.
| Rule type | Operator(s) | Value(s) | Note |
|---|---|---|---|
| App | == | Select from a list of App IDs for apps associated with your Firebase project. | When you add together an app to Firebase, you lot enter a bundle ID or Android package proper name that defines an attribute that'south exposed every bit App ID in Remote Config rules. Use this aspect equally follows:
|
| App version | For string values: exactly matches, contains, does non contain, regular expression For numeric values: | Specify the version(s) of your app to target. Before using this dominion, you must use an App ID rule to select an Android/Apple app associated with your Firebase project. | For Apple platforms: Use the app'south CFBundleShortVersionString. Annotation: Brand sure your Apple app is using Firebase Apple platforms SDK version half-dozen.24.0 or above, equally CFBundleShortVersionString is not beingness sent in earlier versions (see release notes). For Android: Employ the app's versionName. String comparisons for this dominion are case-sensitive. When using the exactly matches, contains, does not contain , or regular expression operator, you can select multiple values. When using the regular expression operator, you tin can create regular expressions in RE2 format. Your regular expression tin friction match all or part of the target version string. You lot tin can also apply the ^ and $ anchors to match the beginning, end, or entirety of a target cord. |
| Build number | For cord values: exactly matches, contains, does not incorporate, regular expression For numeric values: | Specify the build(s) of your app to target. Earlier using this dominion, you must use an App ID rule to select an Apple tree or Android app associated with your Firebase projection. | This operator is available for Apple and Android apps simply. It corresponds to the app's CFBundleVersion for Apple tree and versionCode for Android. String comparisons for this rule are case-sensitive. When using the exactly matches, contains, does non incorporate , or regular expression operator, you can select multiple values. When using the regular expression operator, you can create regular expressions in RE2 format. Your regular expression can match all or part of the target version cord. Y'all can also utilize the ^ and $ anchors to match the showtime, end, or entirety of a target string. |
| Platform | == | iOS Android Web | |
| Operating system | == | Specify the operating organization(south) to target. Before using this rule, you lot must utilize an App ID rule to select a Spider web app associated with your Firebase project. | This dominion evaluates to true for a given Spider web app instance if the operating system and its version matches a target value in the specified listing. |
| Browser | == | Specify the browser(south) to target. Before using this rule, yous must use an App ID rule to select a Web app associated with your Firebase project. | This rule evaluates to true for a given Web app example if the browser and its version matches a target value in the specified list. |
| Date/Fourth dimension | <=, > | A specified engagement and fourth dimension, either in the device timezone or a specified timezone such as "(GMT+eleven) Sydney time." | Compares the current time to the device fetch time. |
| User in random percentile | <=, > | 0-100 | Use this field to utilise a change to a random sample of app instances (with sample sizes as small as .0001%), using the <= and > operators to segment users (app instances) into groups. Each app instance is persistently mapped to a random whole or fractional number, co-ordinate to a key divers in that projection. A rule will use the default primal (shown as DEF in Firebase console) unless you select or create another key. You can return a rule to using the default cardinal by clearing the Randomize users using this key field. You can employ a single primal beyond rules to consistently accost the aforementioned app instances within given per centum ranges. Or, yous can select a new randomly-assigned group of app instances for a given percentage range past creating a new primal. For example, to create two related conditions that each apply to a non-overlapping 5% of an app's users, you could have 1 condition include a <= five% rule, and some other status include both a > 5% rule and a <= 10% dominion. To make it possible for some users to randomly announced in both groups, use different keys for the rules in each status. |
| User in audience | == | Select one or more from a listing of Google Analytics audiences that you have set up for your projection. | This dominion requires an App ID rule to select an app associated with your Firebase project. Note: Because many Analytics audiences are defined by events or user properties, which can be based the actions of app users, it may take some time for a User in audience rule to accept effect for a given app instance. |
| Device in region/country | == | Select one or more regions or countries. | This rule evaluates to true for a given app example if the example is in any of the regions or countries listed. The device country lawmaking is determined using the device's IP address in the request or the country code determined by Firebase Analytics (if Analytics information is shared with Firebase). |
| Device language | == | Select 1 or more languages. | This rule evaluates to true for a given app instance if that app instance is installed on a device that uses ane of the languages listed. |
| User property | For string values: contains, does not contain, exactly matches, regular expression For numeric values: Annotation: On the customer, you lot tin can set merely string values for user backdrop. For weather condition that use numeric operators, Remote Config converts the value of the corresponding user property into an integer/float. | Select from a list of available Google Analytics user properties. | To learn how you can apply user properties to customize your app for very specific segments of your user base, see Remote Config and user properties. To learn more than virtually user properties, run into the following guides:
When using the exactly matches, contains, does not contain or regular expression operator, you lot can select multiple values. When using the regular expression operator, yous can create regular expressions in RE2 format. Your regular expression tin match all or function of the target version string. You can also utilise the ^ and $ anchors to match the beginning, terminate, or entirety of a target string. Note: Automatically nerveless user backdrop are not currently available when creating Remote Config conditions. |
| Imported segment | == | Select one or more than imported segment. | This rule requires setting upward custom imported segments. |
| Installation ID | == | Specify i or more Installation IDs (up to 50) to target. | This rule evaluates to true for a given installation if that installation's ID is in the comma-separated listing of values. To larn how you can become installation IDs, see Remember client identifiers. |
Searching parameters and conditions
Y'all can search your project'southward parameter keys, parameter values, and conditions from the Firebase console using the search box at the top of the Remote Config Parameters tab.
Limits on parameters and weather
Within a Firebase projection, yous can have up to 2000 parameters, and up to 500 conditions. Parameter keys can be upwards to 256 characters long, must outset with an underscore or English language letter graphic symbol (A-Z, a-z), and may also include numbers. The full length of parameter value strings within a project cannot exceed 1,000,000 characters.
Next steps
To get started configuring your Firebase project, come across Set upwardly a Firebase Remote Config Project.
How To Pass A Parmeter To Service Android,
Source: https://firebase.google.com/docs/remote-config/parameters
Posted by: perkinstoopece.blogspot.com

0 Response to "How To Pass A Parmeter To Service Android"
Post a Comment