Dynamically update your Firebase AI Logic app with Firebase Remote Config

When calling theGemini API from your app using aFirebase AI Logic SDK, your request contains a number of parameters thatcontrol generative AI responses. These usually include the model name, themodel generation configuration (maximum tokens, temperature, etc.), safetysettings, system instructions, and prompt data.

In most cases, you'll want to change these on-demand or as needed for a numberof scenarios:

  • Update your generative AI model without releasing a new app. You canupgrade to newer, stable model versions before earlier versions aredecommissioned, drop to lower-cost or higher performance models basedon your users' needs and attributes, or conditionally deploy the latestand greatest models to specific user segments (like beta testers).
  • Set the location where you access the model so that it's closer to yourusers.
  • A/B test different system instructions and prompts, then slowly roll out thewinning experiment values to your users.
  • Use feature flags to quickly expose or hide generative AI features in yourapp.

Firebase Remote Config does all of this andmore, letting you update parameter values as needed andconditionally for app instances that match characteristics you set in theFirebase console, without releasing a new version of your app.

This solution guide provides specific recommended use cases and describes how toaddRemote Config to your generative AI app.

Jump to code implementation

Why useFirebase Remote Config with your app?

Firebase Remote Config lets you dynamically adjust your app's behaviorwithout requiring app updates. This is especially powerful for apps that usegenerative AI, where rapid iteration and fine-tuning are crucial.

Essential use cases forRemote Config with generative AI apps

We recommend usingRemote Config withFirebase AI Logic for thefollowing essential use cases:

  • Upgrade to the latest model version without an app update:UseRemote Config parameters to change the model name as needed, so thatyou can upgrade to the latest version of your preferredGeminimodel as soon as it's available.

  • Update system instructions and safety settings without an app update:Store system instructions and safety settings insideRemote Configparameters to ensure that you can change them on-demand if you discoverissues after deployment.

  • Reduce risk and enforce AI safety:UseRemote Config rollouts to safely and gradually releasegenerative AI changes to your iOS and Android users.

Advanced and recommended use cases forRemote Config with generative AI apps

After instrumenting your app withRemote Config andGoogle Analytics,you can explore advanced use cases:

  • Set location based on client location:UseRemote Config conditions toset the location where you access the modelbased on the client's detected location.

  • Experiment with different models:Quickly test and switch between various generative AI models, or even accessdifferent models for different user segments, to find the best fit for yourspecific use case.

  • Optimize model performance:Fine-tune model parameters, such as system prompt, maximum output tokens,temperature, and other settings.

  • Use different system instructions, prompts, and model configurationbased on client attributes:When usingRemote Config withGoogle Analytics,you can create conditions based on client attributes or custom audiences andset different parameters based on these attributes.

    For example, if you're using generative AI to provide technical supportin your app, you might want to set system instructions specific to theapp platform to ensure accurate instructions are provided to yourAndroid, iOS, and web platform users.

  • Personalize experiences for each user:UseRemote Config personalization with your mobileapps and games to automatically determine the optimum generative AI settingsfor each user.

  • Control costs:Remotely adjust which generative AI models are called, how frequently theyare used, and dynamically configure maximum output token values based onuser audience to reduce unnecessary costs.

  • Optimize app experience and results:UseA/B Testing withRemote Config with yourmobile apps and games to test changes to generative AI parameters acrossdifferent user segments to see how they affect key metrics like retentionand revenue.

By instrumenting your generative AI app withFirebase Remote Config, you canbuild flexible, safe, and cost-effective AI-powered applications while creatingdelightful experiences for your users.

Important: Don't store confidential data inRemote Config parameterkeys or parameter values. Data is encrypted in transit, but end users canaccess any default or fetchedRemote Config orFirebase AI Logicparameter that is available to their app instance.

AddFirebase Remote Config to your app

In this solution guide, you'll useFirebase Remote Config todynamically update parameters in your Android app that use theFirebase AI Logic SDK. You will learn how to:

  • Fetch and activate parameters like model names and system instructions fromFirebase Remote Config.
  • Update yourGemini API calls to use the dynamically retrieved parameters,letting you switch between different models or modify system instructionswithout an app update.
  • Control parameters remotely, adjusting model behavior and capabilitiesas needed.

Prerequisites

This guide assumes that you're familiar with developing apps for your platform.

Before you begin, make sure that you do the following:

  • Complete theFirebase AI Logic getting started guide,which describes how to set up your Firebase project,connect your app to Firebase, add the SDK, initialize the backend servicefor your chosen "Gemini API" provider, and create a model instance.

  • EnableGoogle Analytics in your Firebase projectand add its SDK to your app (required for conditional targeting, likesetting the location where you access the model based on the client device'slocation).

Tip: If you don't have an app of your own, you can use the quickstart app forFirebase AI Logic:iOS+ |Android |Web |Flutter |Unity

Step 1: Set parameter values in theFirebase console

Create a clientRemote Config template and configure parameters andvalues to fetch and use in the app.

  1. Open your Firebase project in theFirebase console. Then, from the navigationmenu, expandRun and selectRemote Config.
  2. Ensure thatClient is selected from theClient/Server selectorat the top of the page.
  3. Start a client template by clickingCreate Configuration(orAdd parameter if you've previously used client templates).
  4. Define the parameters you want to control withRemote Config. Forexample:

    Parameter nameDescriptionTypeDefault value
    model_nameModel name. Seeavailable model names.Stringgemini-2.5-flash
    system_instructionsSystem instructions are like a "preamble" that you add before the model gets exposed to any further instructions from the end user to influence model behavior.StringYou are a helpful assistant who knows everything there is to know about Firebase!
    promptDefault prompt to use with your generative AI feature.StringI am a developer who wants to know more about Firebase!
    vertex_locationOnly applicable if usingVertex AI Gemini API.
    Control thelocation to access the model. You can set conditions to configure this option based on client location detected byGoogle Analytics.
    Stringglobal
    Tip: After you've created aRemote Config parameter, you candynamically or conditionally control it or use it forA/B Testing orfeature rollouts. For more ideas, seeAdvanced and recommended use cases forRemote Config with generative AI apps.
  5. When you've finished adding parameters, clickPublish changes. If thisis not a newRemote Config template, review the changes and clickPublish changes again.

Step 2: Add and initializeRemote Config in your app

Add theRemote Config library and set upRemote Config within your app.

Swift

As part ofFirebase AI Logic setup,you've already added the Firebase SDK to your app, but will also need to addRemote Config.

  1. In Xcode, with the project open, navigate toFile > Add PackageDependencies.

  2. Selectfirebase-ios-sdk and then clickAdd package.

  3. From the Project navigator, select your app >Targets > your app.

  4. From theGeneral tab, scroll toFrameworks, Libraries, andEmbedded Content.

  5. Click+ and chooseFirebaseRemoteConfig, then clickAdd.

  6. Add theFirebaseRemoteConfig import to your code:

    importFirebaseRemoteConfig
  7. Inside the appropriate class for your app, initialize Firebase and addRemote Config to your main application logic.

    Here, you'll includeRemote Config and theRemote Config real-time listener asimports so that the app can fetch new values in real-time, and add aminimum fetch interval:

    letremoteConfig=RemoteConfig.remoteConfig()letsettings=RemoteConfigSettings()settings.minimumFetchInterval=3600remoteConfig.configSettings=settings

    In thequickstart app,this would be insideVertexAISampleApp, within theAppDelegate class.

    Note: In this example, the default fetch interval is 3600 seconds, but werecommend that you set a relatively low minimum fetch interval inside yourcode during development.

Kotlin

  1. Add theRemote Config dependency to your module (app-level) Gradlefile (usuallyapp/build.gradle.kts orapp/build.gradle):

    dependencies{implementation(platform("com.google.firebase:firebase-bom:34.3.0"))implementation("com.google.firebase:firebase-ai")implementation("com.google.firebase:firebase-config")// ... other dependencies}
  2. AddRemote Config to your main application logic. Here, you'llinitializeRemote Config and add a minimum fetch interval:

    valremoteConfig:FirebaseRemoteConfig=Firebase.remoteConfigvalconfigSettings=remoteConfigSettings{minimumFetchIntervalInSeconds=3600}remoteConfig.setConfigSettingsAsync(configSettings)
    Note: In this example, the default fetch interval is 3600 seconds, but werecommend that you set a relatively low minimum fetch interval inside yourcode during development.

Java

  1. Add theRemote Config dependency to your module (app-level) Gradlefile (usuallyapp/build.gradle.kts orapp/build.gradle):

    dependencies{implementation(platform("com.google.firebase:firebase-bom:34.3.0"))implementation("com.google.firebase:firebase-ai")implementation("com.google.firebase:firebase-config")// ... other dependencies}
  2. AddRemote Config to your main application logic. Here, you'llinitializeRemote Config and add a minimum fetch interval:

    FirebaseRemoteConfigmFirebaseRemoteConfig=FirebaseRemoteConfig.getInstance();FirebaseRemoteConfigSettingsconfigSettings=newFirebaseRemoteConfigSettings.Builder().setMinimumFetchIntervalInSeconds(3600).build();mFirebaseRemoteConfig.setConfigSettingsAsync(configSettings);
    Note: In this example, the default fetch interval is 3600 seconds, but werecommend that you set a relatively low minimum fetch interval inside yourcode during development.

Web

  1. Open your code in a text editor and importRemote Config:

    import{getRemoteConfig}from'firebase/remote-config';
  2. Inside your primary function and after the Firebase app is initializedforFirebase AI Logic SDK, initializeRemote Config:

    // InitializeRemote Config and get a reference to the serviceconstremoteConfig=getRemoteConfig(app);
  3. Set a minimum fetch interval:

    remoteConfig.settings.minimumFetchIntervalMillis=3600000;
    Note: In this example, the default fetch interval is 3600 seconds, but werecommend that you set a relatively low minimum fetch interval inside yourcode during development.

Dart

  1. From your Flutter project directory, install and addRemote Configusing the following command:

    flutterpubaddfirebase_remote_config
  2. Open./lib/main.dart and add the import after the other imports youadded to supportFirebase AI Logic:

    import'package:firebase_vertexai/firebase_ai.dart';import'package:firebase_core/firebase_core.dart';import'package:firebase_remote_config/firebase_remote_config.dart';
  3. Add_modelName,_systemInstructions, and_prompt variables toyour app so that we can use them later:

    latefinalString_modelName;latefinalString_systemInstructions;latefinalString_prompt;
  4. Get theRemote Config object instance and set the minimum fetchinterval to allow for frequent refreshes. Make sure to add this afterFirebase is initialized.

    finalremoteConfig=FirebaseRemoteConfig.instance;awaitremoteConfig.setConfigSettings(RemoteConfigSettings(fetchTimeout:constDuration(seconds:3600),minimumFetchInterval:constDuration(seconds:3600),));
    Note: In this example, the default fetch interval is 3600 seconds, but werecommend that you set a relatively low minimum fetch interval inside yourcode during development.

Unity

  1. AddRemote Config to your Unity project, following theseinstructions.

  2. Get theRemote Config object instance and set the minimum fetchinterval to allow for frequent refreshes. Make sure to add this afterFirebase is initialized.

    varremoteConfig=FirebaseRemoteConfig.DefaultInstance;constintMillisecondsPerSecond=1000;awaitremoteConfig.SetConfigSettingsAsync(newConfigSettings(){FetchTimeoutInMilliseconds=3600*MillisecondsPerSecond,MinimumFetchIntervalInMilliseconds=3600*MillisecondsPerSecond});
    Note: In this example, the default fetch interval is 3600 seconds, but werecommend that you set a relatively low minimum fetch interval inside yourcode during development.

Step 3: Set in-app parameter values

You should set in-app default parameter values in theRemote Configobject. This ensures that your app behaves as expected even if it cannotfetch values from theRemote Config service.

Swift

  1. In theFirebase console, openRemote Config.

  2. In theParameters tab, opentheMenu, and selectDownload default values.

  3. When prompted, enable.plist for iOS, then clickDownload file.

  4. Save the file in the your application directory.

    If using the sample app, save it withinFirebaseVertexAI/Sample/VertexAISample.

  5. In Xcode, right-click on your app and selectAdd Files

    If using the sample, right-click onVertexAISample and selectAdd Files to "VertexAISample".

  6. Selectremote_config_defaults.plist, then clickAdd.

  7. Update your app code to reference the defaults file:

    // Set default valuesremoteConfig.setDefaults(fromPlist:"remote_config_defaults")

Kotlin

  1. From theFirebase console, openRemote Config.

  2. In theParameters tab, opentheMenu, and selectDownload default values.

  3. When prompted, enable.xml for Android, then clickDownload file.

  4. Save the file in your app's XML resources directory.

  5. Update your main activity file to add the defaults after theconfigSettings you added previously:

    // Set default values.remoteConfig.setDefaultsAsync(R.xml.remote_config_defaults)

Java

  1. In theFirebase console, openRemote Config.

  2. In theParameters tab, opentheMenu, and selectDownload default values.

  3. When prompted, enable.xml for Android, then clickDownload file.

  4. Save the file in your app's XML resources directory.

  5. Update your main activity file to add the defaults after theconfigSettings you added previously:

    // Set default values.mFirebaseRemoteConfig.setDefaultsAsync(R.xml.remote_config_defaults);

Web

You can set the default values directly in your code:

// Set default Remote Config parameter valuesremoteConfig.defaultConfig={model_name:'gemini-2.5-flash',system_instructions:'You are a helpful assistant who knows everything there is to know about Firebase!',prompt:'I am a developer who wants to know more about Firebase!',vertex_location:'global',};

Dart

You can set the default values directly in your code:

remoteConfig.setDefaults(const{"model_name":"gemini-2.5-flash","system_instructions":"You are a helpful assistant who knows everything there is to know about Firebase!","prompt":"I am a developer who wants to know more about Firebase!","vertex_location":"global"});

Unity

You can set the default values directly in your code:

awaitremoteConfig.SetDefaultsAsync(newSystem.Collections.Generic.Dictionary<string,object>(){{"model_name","gemini-2.5-flash"},{"system_instructions","You are a helpful assistant who knows everything there is to know about Firebase!"},{"prompt","I am a developer who wants to know more about Firebase!"},{"vertex_location","global"}});

Step 4: Fetch and activate values

After setting defaults, add the following to fetch and activate values.

Swift

// Fetch and activateRemote Config valuesremoteConfig.fetchAndActivate{status,errorinifleterror=error{print("Error fetchingRemote Config:\(error.localizedDescription)")}}

This should update theRemote Config object whenever a newRemote Config template is published.

Important: Be sure to put any code that depends on these valuesafterfetch and activate.

Kotlin

// Fetch and activateRemote Config valuesremoteConfig.fetchAndActivate().addOnCompleteListener(this){task->if(task.isSuccessful){valupdated=task.resultLog.d(TAG,"Remote Config values fetched and activated:$updated")}else{Log.e(TAG,"Error fetchingRemote Config",task.exception)}}
Important: Be sure to put any code that depends on these valuesafterfetch and activate.

Java

// Fetch and activateRemote Config valuesmFirebaseRemoteConfig.fetchAndActivate().addOnCompleteListener(this,newOnCompleteListener<Boolean>(){@OverridepublicvoidonComplete(@NonNullTask<Boolean>task){if(task.isSuccessful()){booleanupdated=task.getResult();Log.d(TAG,"Config params updated: "+updated);}else{Log.e(TAG,"Error fetchingRemote Config",task.exception)}}});
Important: Be sure to put any code that depends on these valuesafterfetch and activate.

Web

  1. AddgetValue andfetchAndActivate to your imports:

    import{getValue,fetchAndActivate}from'firebase/remote-config';
  2. After the code you added to configure defaultRemote Config values,fetch and activate the config, then assign values to themodelName,systemInstructions,prompt, andvertexLocation constants.

    // Fetch and activateRemote Config.try{awaitfetchAndActivate(remoteConfig);}catch(err){console.error('Remote Config fetch failed',err);}console.log('Remote Config fetched.');// AssignRemote Config values.constmodelName=getValue(remoteConfig,'model_name').asString();constsystemInstructions=getValue(remoteConfig,'system_instructions').asString();constprompt=getValue(remoteConfig,'prompt').asString();constvertexLocation=getValue(remoteConfig,'vertex_location').asString();
Important: Be sure to put any code that depends on these valuesafterfetch and activate.

Dart

// Fetch and activate Remote Config.remoteConfig.fetchAndActivate();// Assign Remote Config values.String?_modelName=remoteConfig.getString("model_name");String?_systemInstructions=remoteConfig.getString("system_instructions");String?_prompt=remoteConfig.getString("prompt");String?_vertexLocation=remoteConfig.getString("vertex_location");
Important: Be sure to put any code that depends on these valuesafterfetch and activate.

Unity

// Fetch and activateRemote Config values.awaitremoteConfig.FetchAndActivateAsync();
Important: Be sure to put any code that depends on these valuesafterfetch and activate.

Step 5: Add a real-timeRemote Config listener

Add areal-timeRemote Config listenerto your app to ensure that changes you make to theRemote Config templateare propagated to the client as soon as they're updated.

The following code updates theRemote Config object whenever a parametervalue changes.

Swift

// Add real-timeRemote ConfigremoteConfig.addOnConfigUpdateListener{configUpdate,erroringuardletconfigUpdate=configUpdate,error==nilelse{print("Error listening for config updates:\(error?.localizedDescription??"No error available")")return}print("Updated keys:\(configUpdate.updatedKeys)")remoteConfig.activate{changed,erroringuarderror==nilelse{print("Error activating config:\(error?.localizedDescription??"No error available")")return}print("Activated config successfully")}}

Kotlin

Optionally, you can also configure an action inside theaddOnCompleteListener activation:

// Add a real-timeRemote Config listenerremoteConfig.addOnConfigUpdateListener(object:ConfigUpdateListener{overridefunonUpdate(configUpdate:ConfigUpdate){Log.d(ContentValues.TAG,"Updated keys: "+configUpdate.updatedKeys);remoteConfig.activate().addOnCompleteListener{// Optionally, add an action to perform on update here.}}overridefunonError(error:FirebaseRemoteConfigException){Log.w(ContentValues.TAG,"Config update error with code: "+error.code,error)}}

Java

Optionally, you can also configure an action inside theaddOnCompleteListener activation:

// Add a real-timeRemote Config listenerremoteConfig.addOnConfigUpdateListener(newConfigUpdateListener(){@OverridepublicvoidonUpdate(ConfigUpdateconfigUpdate){Log.d(ContentValues.TAG,"Updated keys: "+configUpdate.getUpdatedKeys());remoteConfig.activate().addOnCompleteListener(newOnCompleteListener<Boolean>(){@OverridepublicvoidonComplete(@NonNullTask<Boolean>task){// Optionally, add an action to perform on update here.}});}@OverridepublicvoidonError(FirebaseRemoteConfigExceptionerror){Log.w(ContentValues.TAG,"Config update error with code: "+error.getCode(),error);}});

Web

Real-timeRemote Config listeners aren'tsupported for Web apps.

Dart

// Add a real-timeRemote Config listenerremoteConfig.onConfigUpdated.listen((event)async{awaitremoteConfig.activate();});

Unity

// Add a real-timeRemote Config listener to automatically update whenever// a new template is published.// Note: the parameters can be anonymous as they are unused.remoteConfig.OnConfigUpdateListener+=(_,_)=>{remoteConfig.ActivateAsync();};

Step 6: Update theGemini API requests to useRemote Config values

Click yourGemini API provider to view provider-specific content and code on this page.

Now thatRemote Config is fully configured, update your code to replace hard-coded values with values sourced fromRemote Config.

Swift

Note: This example shows usingRemote Config with aGenerativeModel,but it also works with anImagenModel, as applicable.
// Initialize the Gemini Developer API backend service// The Gemini Developer API doesn't support setting the location of a modelletai=FirebaseAI.firebaseAI(backend:.googleAI())// Create a `GenerativeModel` and add system instructions into its config// Both the model name and the system instructions will be sourced from Remote ConfigletmodelName=remoteConfig.configValue(forKey:"model_name").stringValueletsystemInstructions=remoteConfig.configValue(forKey:"system_instructions").stringValueletmodel=ai.generativeModel(modelName:modelName,systemInstruction:ModelContent(role:"system",parts:systemInstructions))// Provide a prompt that contains text// The text in the prompt will be sourced from Remote ConfigletuserPrompt=remoteConfig.configValue(forKey:"prompt").stringValue// To generate text output, call `generateContent` with the text inputletresponse=tryawaitmodel.generateContent(userPrompt)iflettext=response.text{print(text)}

Kotlin

Note: This example shows usingRemote Config with aGenerativeModel,but it also works with anImagenModel, as applicable.
// Initialize the Gemini Developer API backend service// The Gemini Developer API doesn't support setting the location of a modelvalai=Firebase.ai(backend=GenerativeBackend.googleAI())// Create a `GenerativeModel` and add system instructions into its config// Both the model name and the system instructions will be sourced from Remote Configvalmodel=ai.generativeModel(modelName=remoteConfig.getString("model_name"),systemInstruction=content{text(remoteConfig.getString("system_instructions"))})// To generate text output, call `generateContent` with the text input// The text in the prompt will be sourced from Remote Configvalresponse=model.generateContent(remoteConfig.getString("prompt"))print(response.text)

Java

Note: This example shows usingRemote Config with aGenerativeModel,but it also works with anImagenModel, as applicable.
// Initialize the Gemini Developer API backend service// The Gemini Developer API doesn't support setting the location of a modelFirebaseAIai=FirebaseAI.getInstance(GenerativeBackend.googleAI());// Create a `GenerativeModel` and add system instructions into its config// Both the model name and the system instructions will be sourced from Remote ConfigGenerativeModelgm=ai.generativeModel(/* modelName */remoteConfig.getString("model_name"),/* generationConfig (optional) */null,/* safetySettings (optional) */null,/* tools (optional) */null,/* toolsConfig (optional) */null,/* systemInstruction (optional) */newContent.Builder().addText(remoteConfig.getString("system_instructions")).build(),/* requestOptions (optional) */newRequestOptions());GenerativeModelFuturesmodel=GenerativeModelFutures.from(gm);// Provide a prompt that contains text// The text in the prompt will be sourced from Remote ConfigContentuserPrompt=newContent.Builder().addText(remoteConfig.getString("prompt")).build();// To generate text output, call `generateContent` with the text inputListenableFuture<GenerateContentResponse>response=model.generateContent(userPrompt);Futures.addCallback(response,newFutureCallback<GenerateContentResponse>(){@OverridepublicvoidonSuccess(GenerateContentResponseresult){StringresultText=result.getText();System.out.println(resultText);}@OverridepublicvoidonFailure(Throwablet){t.printStackTrace();}},executor);

Web

Note: This example shows usingRemote Config with aGenerativeModel,but it also works with anImagenModel, as applicable.
// Initialize FirebaseAppconstfirebaseApp=initializeApp(firebaseConfig);// Initialize the Gemini Developer API backend service// The Gemini Developer API doesn't support setting the location of a modelconstai=getAI(firebaseApp,{backend:newGoogleAIBackend()});// Create a `GenerativeModel` and add system instructions into its config// Both the model name and the system instructions will be sourced from Remote Configconstmodel=getGenerativeModel(ai,{model:modelName,systemInstruction:systemInstruction});// Wrap in an async function so you can use awaitasyncfunctionrun(){// Provide a prompt that contains text// The text in the prompt will be sourced from Remote ConfigconstuserPrompt=prompt;// To generate text output, call `generateContent` with the text inputconstresult=awaitmodel.generateContent(userPrompt);constresponse=result.response;consttext=response.text();console.log(text);}

Dart

Note: This example shows usingRemote Config with aGenerativeModel,but it also works with anImagenModel, as applicable.
// Initialize the Gemini Developer API backend service// The Gemini Developer API doesn't support setting the location of a modelfinalai=awaitFirebaseAI.googleAI();// Create a `GenerativeModel` and add system instructions into its config// Both the model name and the system instructions will be sourced from Remote Configfinalmodel=ai.generativeModel(model:_modelName,systemInstruction:Content.system(_systemInstructions),);// Provide a prompt that contains text// The text in the prompt will be sourced from Remote Configfinal_userPrompt=[Content.text(_prompt)];// To generate text output, call `generateContent` with the text inputfinalresponse=awaitmodel.generateContent(_userPrompt);print(response.text);

Unity

// Initialize the Gemini Developer API backend service// The Gemini Developer API doesn't support setting the location of a modelvarai=FirebaseAI.GetInstance(FirebaseAI.Backend.GoogleAI());// Create a `GenerativeModel` and add system instructions into its config// Both the model name and the system instructions will be sourced from Remote ConfigvarmodelName=remoteConfig.GetValue("model_name").StringValue;varsystemInstructions=remoteConfig.GetValue("system_instructions").StringValue;varmodel=ai.GetGenerativeModel(modelName:modelName,systemInstruction:ModelContent.Text(systemInstructions));// Provide a prompt that contains text// The text in the prompt will be sourced from Remote ConfigvaruserPrompt=remoteConfig.GetValue("prompt").StringValue;// To generate text output, call `GenerateContentAsync` with the text inputvarresponse=awaitmodel.GenerateContentAsync(userPrompt);UnityEngine.Debug.Log(response.Text??"No text in response.");

Step 7: Run the app

Build and run the app and verify that it works. Make changes to yourconfiguration from theRemote Config page in theFirebase console,publish the changes, and verify the result.

Next steps

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-10-03 UTC.