ইউনিটিতে রিমোট কনফিগ দিয়ে শুরু করুন

প্ল্যাটফর্ম নির্বাচন করুন: iOS+ অ্যান্ড্রয়েড ওয়েব ফ্লাটার ইউনিটি C++


You can use Firebase Remote Config to define parameters in your app and update their values in the cloud, allowing you to modify the appearance and behavior of your app without distributing an app update.

The Remote Config library is used to store in-app default parameter values, fetch updated parameter values from the Remote Config backend, and control when fetched values are made available to your app. To learn more, see Remote Config loading strategies .

এই নির্দেশিকাটি আপনাকে শুরু করার ধাপগুলো দেখিয়ে দেবে এবং কিছু নমুনা কোডও প্রদান করবে, যেগুলোর সবই firebase/quickstart-unity গিটহাব রিপোজিটরি থেকে ক্লোন বা ডাউনলোড করা যাবে।

ধাপ ১: আপনার অ্যাপে Remote Config যোগ করুন

Remote Config ব্যবহার করার আগে, আপনাকে যা করতে হবে তা হলো:

  • আপনার ইউনিটি প্রজেক্টটি রেজিস্টার করুন এবং ফায়ারবেস ব্যবহারের জন্য কনফিগার করুন।

    • আপনার ইউনিটি প্রজেক্টে যদি আগে থেকেই ফায়ারবেস ব্যবহার করা হয়, তাহলে এটি ফায়ারবেসের জন্য ইতোমধ্যেই নিবন্ধিত এবং কনফিগার করা আছে।

    • আপনার যদি কোনো ইউনিটি প্রজেক্ট না থাকে, তাহলে আপনি একটি স্যাম্পল অ্যাপ ডাউনলোড করতে পারেন।

  • আপনার ইউনিটি প্রজেক্টে Firebase Unity এসডিকে (বিশেষত, FirebaseRemoteConfig.unitypackage ) যোগ করুন।

Note that adding Firebase to your Unity project involves tasks both in the Firebase console and in your open Unity project (for example, you download Firebase config files from the console, then move them into your Unity project).

ধাপ ২: অ্যাপের মধ্যে ডিফল্ট প্যারামিটার মান সেট করুন

You can set in-app default parameter values in the Remote Config object, so that your app behaves as intended before it connects to the Remote Config backend, and so that default values are available if none are set in the backend.

To do this, create a string dictionary, and populate it with key-value pairs representing the defaults you want to add. If you have already configured Remote Config backend parameter values, you can download a file that contains these key-value pairs and use it to construct your string dictionary. For more information, see Download Remote Config template defaults .

( SetDefaultsAsync() কল করা হলে নন-স্ট্রিং প্রপার্টিগুলো তাদের নিজস্ব টাইপে রূপান্তরিত হবে)।

System.Collections.Generic.Dictionary<string, object> defaults =
  new System.Collections.Generic.Dictionary<string, object>();

// These are the values that are used if we haven't fetched data from the
// server
// yet, or if we ask for values that the server doesn't have:
defaults.Add("config_test_string", "default local string");
defaults.Add("config_test_int", 1);
defaults.Add("config_test_float", 1.0);
defaults.Add("config_test_bool", false);

Firebase.RemoteConfig.FirebaseRemoteConfig.DefaultInstance.SetDefaultsAsync(defaults)
  .ContinueWithOnMainThread(task => {

ধাপ ৩: আপনার অ্যাপে ব্যবহার করার জন্য প্যারামিটার মানগুলো সংগ্রহ করুন।

Now you can get parameter values from the Remote Config object. If you set values in the Remote Config backend, fetched them, and then activated them, those values are available to your app. Otherwise, you get the in-app parameter values configured using SetDefaultsAsync() .

এই মানগুলো পেতে, GetValue() ফাংশন ব্যবহার করুন এবং আর্গুমেন্ট হিসেবে `key` প্যারামিটারটি দিন। এটি একটি ` ConfigValue রিটার্ন করে, যেটিতে মানটিকে বিভিন্ন বেস টাইপে রূপান্তর করার জন্য প্রোপার্টি রয়েছে।

ধাপ ৪: প্যারামিটারের মান নির্ধারণ করুন

  1. Firebase কনসোলে, DevOps & Engagement > Remote Config- এ যান।

  2. Define parameters with the same names as the parameters that you defined in your app. For each parameter, you can set a default value (which will eventually override the in-app default value) and conditional values. To learn more, see Remote Config parameters and conditions .

ধাপ ৫: প্রয়োজন অনুযায়ী মানগুলো সংগ্রহ ও সক্রিয় করুন।

Remote Config ব্যাকএন্ড থেকে প্যারামিটার ভ্যালুগুলো আনার জন্য, FetchAsync() মেথডটি কল করুন। আপনি ব্যাকএন্ডে যে ভ্যালুগুলো সেট করেন, সেগুলো ফেচ করে Remote Config অবজেক্টে ক্যাশ করা হয়।

// Start a fetch request.
// FetchAsync only fetches new data if the current data is older than the provided
// timespan.  Otherwise it assumes the data is "recent enough", and does nothing.
// By default the timespan is 12 hours, and for production apps, this is a good
// number. For this example though, it's set to a timespan of zero, so that
// changes in the console will always show up immediately.
public Task FetchDataAsync() {
  DebugLog("Fetching data...");
  System.Threading.Tasks.Task fetchTask =
  Firebase.RemoteConfig.FirebaseRemoteConfig.DefaultInstance.FetchAsync(
      TimeSpan.Zero);
  return fetchTask.ContinueWithOnMainThread(FetchComplete);
}

পূর্ববর্তী কোডে, FetchComplete হলো এমন একটি মেথড যার সিগনেচার ContinueWithOnMainThread() -এর ওভারলোডগুলোর একটির প্যারামিটারগুলোর সাথে মেলে।

In the sample code that follows, the FetchComplete method is passed the previous task ( fetchTask ), which allows FetchComplete to determine whether it finished. The code uses Info.LastFetchStatus to then determine whether the finish was also successful. If so, Remote Config parameter values are then activated using ActivateAsync() .

private void FetchComplete(Task fetchTask) {
  if (!fetchTask.IsCompleted) {
    Debug.LogError("Retrieval hasn't finished.");
    return;
  }

  var remoteConfig = FirebaseRemoteConfig.DefaultInstance;
  var info = remoteConfig.Info;
  if(info.LastFetchStatus != LastFetchStatus.Success) {
    Debug.LogError($"{nameof(FetchComplete)} was unsuccessful\n{nameof(info.LastFetchStatus)}: {info.LastFetchStatus}");
    return;
  }

  // Fetch successful. Parameter values must be activated to use.
  remoteConfig.ActivateAsync()
    .ContinueWithOnMainThread(
      task => {
        Debug.Log($"Remote data loaded and ready for use. Last fetch time {info.FetchTime}.");
    });
}

Values fetched using FetchAsync() are cached locally when the fetch completes, but are not made available until ActivateAsync() is invoked. This lets you ensure that the new values are not applied mid-calculation, or at other times that might cause problems or strange behavior.

ধাপ ৬: রিয়েল টাইমে আপডেট শুনুন

After you fetch parameter values, you can use real-time Remote Config to listen for updates from the Remote Config backend. Real-time Remote Config signals to connected devices when updates are available and automatically fetches the changes after you publish a new Remote Config version.

অ্যান্ড্রয়েড এবং অ্যাপল প্ল্যাটফর্মের জন্য Firebase Unity এসডিকে v11.0.0+ এবং এর উচ্চতর সংস্করণ রিয়েল-টাইম আপডেট সমর্থন করে।

  1. In your app, add an OnConfigUpdateListener to start listening for updates and automatically fetch any new or updated parameter values. Then, create a ConfigUpdateListenerEventHandler to process update events. The following example listens for updates and uses the newly fetched values to display an updated welcome message.
// Invoke the listener.
void Start()
{
  Firebase.RemoteConfig.FirebaseRemoteConfig.DefaultInstance.OnConfigUpdateListener
    += ConfigUpdateListenerEventHandler;
}

// Handle real-time Remote Config events.
void ConfigUpdateListenerEventHandler(
   object sender, Firebase.RemoteConfig.ConfigUpdateEventArgs args) {
  if (args.Error != Firebase.RemoteConfig.RemoteConfigError.None) {
    Debug.Log(String.Format("Error occurred while listening: {0}", args.Error));
    return;
  }

  Debug.Log("Updated keys: " + string.Join(", ", args.UpdatedKeys));
  // Activate all fetched values and then display a welcome message.
  remoteConfig.ActivateAsync().ContinueWithOnMainThread(
    task => {
        DisplayWelcomeMessage();
    });
}

// Stop the listener.
void OnDestroy() {
    Firebase.RemoteConfig.FirebaseRemoteConfig.DefaultInstance.OnConfigUpdateListener
      -= ConfigUpdateListenerEventHandler;
}

পরবর্তী বার যখন আপনি আপনার Remote Config -এর কোনো নতুন সংস্করণ প্রকাশ করবেন, তখন যে ডিভাইসগুলিতে আপনার অ্যাপটি চলছে এবং পরিবর্তনের জন্য অপেক্ষা করছে, সেগুলি কমপ্লিশন হ্যান্ডলারকে কল করবে।

,
প্ল্যাটফর্ম নির্বাচন করুন: iOS+ অ্যান্ড্রয়েড ওয়েব ফ্লাটার ইউনিটি C++


You can use Firebase Remote Config to define parameters in your app and update their values in the cloud, allowing you to modify the appearance and behavior of your app without distributing an app update.

The Remote Config library is used to store in-app default parameter values, fetch updated parameter values from the Remote Config backend, and control when fetched values are made available to your app. To learn more, see Remote Config loading strategies .

এই নির্দেশিকাটি আপনাকে শুরু করার ধাপগুলো দেখিয়ে দেবে এবং কিছু নমুনা কোডও প্রদান করবে, যেগুলোর সবই firebase/quickstart-unity গিটহাব রিপোজিটরি থেকে ক্লোন বা ডাউনলোড করা যাবে।

ধাপ ১: আপনার অ্যাপে Remote Config যোগ করুন

Remote Config ব্যবহার করার আগে, আপনাকে যা করতে হবে তা হলো:

  • আপনার ইউনিটি প্রজেক্টটি রেজিস্টার করুন এবং ফায়ারবেস ব্যবহারের জন্য কনফিগার করুন।

    • আপনার ইউনিটি প্রজেক্টে যদি আগে থেকেই ফায়ারবেস ব্যবহার করা হয়, তাহলে এটি ফায়ারবেসের জন্য ইতোমধ্যেই নিবন্ধিত এবং কনফিগার করা আছে।

    • আপনার যদি কোনো ইউনিটি প্রজেক্ট না থাকে, তাহলে আপনি একটি স্যাম্পল অ্যাপ ডাউনলোড করতে পারেন।

  • আপনার ইউনিটি প্রজেক্টে Firebase Unity এসডিকে (বিশেষত, FirebaseRemoteConfig.unitypackage ) যোগ করুন।

Note that adding Firebase to your Unity project involves tasks both in the Firebase console and in your open Unity project (for example, you download Firebase config files from the console, then move them into your Unity project).

ধাপ ২: অ্যাপের মধ্যে ডিফল্ট প্যারামিটার মান সেট করুন

You can set in-app default parameter values in the Remote Config object, so that your app behaves as intended before it connects to the Remote Config backend, and so that default values are available if none are set in the backend.

To do this, create a string dictionary, and populate it with key-value pairs representing the defaults you want to add. If you have already configured Remote Config backend parameter values, you can download a file that contains these key-value pairs and use it to construct your string dictionary. For more information, see Download Remote Config template defaults .

( SetDefaultsAsync() কল করা হলে নন-স্ট্রিং প্রপার্টিগুলো তাদের নিজস্ব টাইপে রূপান্তরিত হবে)।

System.Collections.Generic.Dictionary<string, object> defaults =
  new System.Collections.Generic.Dictionary<string, object>();

// These are the values that are used if we haven't fetched data from the
// server
// yet, or if we ask for values that the server doesn't have:
defaults.Add("config_test_string", "default local string");
defaults.Add("config_test_int", 1);
defaults.Add("config_test_float", 1.0);
defaults.Add("config_test_bool", false);

Firebase.RemoteConfig.FirebaseRemoteConfig.DefaultInstance.SetDefaultsAsync(defaults)
  .ContinueWithOnMainThread(task => {

ধাপ ৩: আপনার অ্যাপে ব্যবহার করার জন্য প্যারামিটার মানগুলো সংগ্রহ করুন।

Now you can get parameter values from the Remote Config object. If you set values in the Remote Config backend, fetched them, and then activated them, those values are available to your app. Otherwise, you get the in-app parameter values configured using SetDefaultsAsync() .

এই মানগুলো পেতে, GetValue() ফাংশন ব্যবহার করুন এবং আর্গুমেন্ট হিসেবে `key` প্যারামিটারটি দিন। এটি একটি ` ConfigValue রিটার্ন করে, যেটিতে মানটিকে বিভিন্ন বেস টাইপে রূপান্তর করার জন্য প্রোপার্টি রয়েছে।

ধাপ ৪: প্যারামিটারের মান নির্ধারণ করুন

  1. Firebase কনসোলে, DevOps & Engagement > Remote Config- এ যান।

  2. Define parameters with the same names as the parameters that you defined in your app. For each parameter, you can set a default value (which will eventually override the in-app default value) and conditional values. To learn more, see Remote Config parameters and conditions .

ধাপ ৫: প্রয়োজন অনুযায়ী মানগুলো সংগ্রহ ও সক্রিয় করুন।

Remote Config ব্যাকএন্ড থেকে প্যারামিটার ভ্যালুগুলো আনার জন্য, FetchAsync() মেথডটি কল করুন। আপনি ব্যাকএন্ডে যে ভ্যালুগুলো সেট করেন, সেগুলো ফেচ করে Remote Config অবজেক্টে ক্যাশ করা হয়।

// Start a fetch request.
// FetchAsync only fetches new data if the current data is older than the provided
// timespan.  Otherwise it assumes the data is "recent enough", and does nothing.
// By default the timespan is 12 hours, and for production apps, this is a good
// number. For this example though, it's set to a timespan of zero, so that
// changes in the console will always show up immediately.
public Task FetchDataAsync() {
  DebugLog("Fetching data...");
  System.Threading.Tasks.Task fetchTask =
  Firebase.RemoteConfig.FirebaseRemoteConfig.DefaultInstance.FetchAsync(
      TimeSpan.Zero);
  return fetchTask.ContinueWithOnMainThread(FetchComplete);
}

পূর্ববর্তী কোডে, FetchComplete হলো এমন একটি মেথড যার সিগনেচার ContinueWithOnMainThread() -এর ওভারলোডগুলোর একটির প্যারামিটারগুলোর সাথে মেলে।

In the sample code that follows, the FetchComplete method is passed the previous task ( fetchTask ), which allows FetchComplete to determine whether it finished. The code uses Info.LastFetchStatus to then determine whether the finish was also successful. If so, Remote Config parameter values are then activated using ActivateAsync() .

private void FetchComplete(Task fetchTask) {
  if (!fetchTask.IsCompleted) {
    Debug.LogError("Retrieval hasn't finished.");
    return;
  }

  var remoteConfig = FirebaseRemoteConfig.DefaultInstance;
  var info = remoteConfig.Info;
  if(info.LastFetchStatus != LastFetchStatus.Success) {
    Debug.LogError($"{nameof(FetchComplete)} was unsuccessful\n{nameof(info.LastFetchStatus)}: {info.LastFetchStatus}");
    return;
  }

  // Fetch successful. Parameter values must be activated to use.
  remoteConfig.ActivateAsync()
    .ContinueWithOnMainThread(
      task => {
        Debug.Log($"Remote data loaded and ready for use. Last fetch time {info.FetchTime}.");
    });
}

Values fetched using FetchAsync() are cached locally when the fetch completes, but are not made available until ActivateAsync() is invoked. This lets you ensure that the new values are not applied mid-calculation, or at other times that might cause problems or strange behavior.

ধাপ ৬: রিয়েল টাইমে আপডেট শুনুন

After you fetch parameter values, you can use real-time Remote Config to listen for updates from the Remote Config backend. Real-time Remote Config signals to connected devices when updates are available and automatically fetches the changes after you publish a new Remote Config version.

অ্যান্ড্রয়েড এবং অ্যাপল প্ল্যাটফর্মের জন্য Firebase Unity এসডিকে v11.0.0+ এবং এর উচ্চতর সংস্করণ রিয়েল-টাইম আপডেট সমর্থন করে।

  1. In your app, add an OnConfigUpdateListener to start listening for updates and automatically fetch any new or updated parameter values. Then, create a ConfigUpdateListenerEventHandler to process update events. The following example listens for updates and uses the newly fetched values to display an updated welcome message.
// Invoke the listener.
void Start()
{
  Firebase.RemoteConfig.FirebaseRemoteConfig.DefaultInstance.OnConfigUpdateListener
    += ConfigUpdateListenerEventHandler;
}

// Handle real-time Remote Config events.
void ConfigUpdateListenerEventHandler(
   object sender, Firebase.RemoteConfig.ConfigUpdateEventArgs args) {
  if (args.Error != Firebase.RemoteConfig.RemoteConfigError.None) {
    Debug.Log(String.Format("Error occurred while listening: {0}", args.Error));
    return;
  }

  Debug.Log("Updated keys: " + string.Join(", ", args.UpdatedKeys));
  // Activate all fetched values and then display a welcome message.
  remoteConfig.ActivateAsync().ContinueWithOnMainThread(
    task => {
        DisplayWelcomeMessage();
    });
}

// Stop the listener.
void OnDestroy() {
    Firebase.RemoteConfig.FirebaseRemoteConfig.DefaultInstance.OnConfigUpdateListener
      -= ConfigUpdateListenerEventHandler;
}

পরবর্তী বার যখন আপনি আপনার Remote Config -এর কোনো নতুন সংস্করণ প্রকাশ করবেন, তখন যে ডিভাইসগুলিতে আপনার অ্যাপটি চলছে এবং পরিবর্তনের জন্য অপেক্ষা করছে, সেগুলি কমপ্লিশন হ্যান্ডলারকে কল করবে।