Remote-Konfigurationswerte geben für Flutter/Firebase-Anwendungen immer Null zurückAndroid

Forum für diejenigen, die für Android programmieren
Guest
 Remote-Konfigurationswerte geben für Flutter/Firebase-Anwendungen immer Null zurück

Post by Guest »

Ich versuche, in meiner Anwendung eine Meldung zum erzwungenen Update einzurichten. In Firebase Remote Config definiere ich:
  • latest_ios_app_version = 2.1.0
  • minimum_ios_app_version = 2.0.0
    latest_android_app_version = 2.1.0
  • minimum_android_app_version = 2.0.0
  • force_update_message = Es ist eine neuere Version der App verfügbar! Bitte gehen Sie zum App Store und aktualisieren Sie!
Alles davon sind Strings.
Ich habe eine VersionChecker-Klasse in dem ich die Remote-Konfiguration wie folgt initialisiere:

Code: Select all

  static Future initialize() async {
try {
final remoteConfig = FirebaseRemoteConfig.instance;

// Set configuration
await remoteConfig.setConfigSettings(
RemoteConfigSettings(
fetchTimeout: const Duration(minutes: 1),
minimumFetchInterval: Duration.zero,
),
);

// Fetch the values from Firebase Remote Config
bool fetchSuccess = await remoteConfig.fetchAndActivate();

if (!fetchSuccess) {
print('Failed to fetch and activate remote config');
}

// Add validation for empty values
final values = remoteConfig.getAll();
if (values.isEmpty) {
print('Warning: Remote config returned empty values');
}

print(
'Latest Android: ${remoteConfig.getString(LATEST_ANDROID_VERSION_KEY)}');
print('Min Android: ${remoteConfig.getString(MIN_ANDROID_VERSION_KEY)}');
print('Latest iOS: ${remoteConfig.getString(LATEST_IOS_VERSION_KEY)}');
print('Min iOS: ${remoteConfig.getString(MIN_IOS_VERSION_KEY)}');
return VersionChecker._(remoteConfig: remoteConfig);
} catch (e, stackTrace) {
print('Error initializing VersionChecker: $e');
print('Stack trace: $stackTrace');
rethrow;
}
}

Ich habe es vorerst bewusst vermieden, Standardwerte für diese Werte festzulegen, da jedes Mal auf diese zurückgegriffen wird.
Das Problem, das ich bekomme, ist Egal was ich versuche, die Remote-Konfiguration gibt immer keine Werte für diese Zeichenfolgen zurück.

Code: Select all

W/Parcel  ( 4201): Expecting binder but got null!
W/System  ( 4201): Ignoring header If-None-Match because its value was null.
D/TrafficStats( 4201): tagSocket(144) with statsTag=0xffffffff, statsUid=-1
D/FRCPlugin( 4201): Sending fetchTimeout: 60
I/flutter ( 4201): Warning: Remote config returned empty values
I/flutter ( 4201): Latest Android:
I/flutter ( 4201): Min Android:
I/flutter ( 4201): Latest iOS:
I/flutter ( 4201): Min iOS:
D/EGL_emulation( 4201): app_time_stats: avg=27.50ms min=3.98ms max=145.80ms count=35
I/flutter ( 4201): Remote config values: {}
I/flutter ( 4201): Error comparing versions: FormatException: Invalid number (at character 1)
I/flutter ( 4201):
I/flutter ( 4201): ^
I/flutter ( 4201): Error comparing versions: FormatException: Invalid number (at character 1)
I/flutter ( 4201):
I/flutter ( 4201): ^
I/flutter ( 4201): Is lower than minimum: false
I/flutter ( 4201): Is lower than latest: false
I/flutter ( 4201): ====================================
I/flutter ( 4201): No update required
I/flutter ( 4201): NotificationsService: Initialized
D/ProfileInstaller( 4201): Installing profile for com.foundermatcha.foundermatcha
D/EGL_emulation( 4201): app_time_stats: avg=428.58ms min=36.59ms max=2092.93ms count=6
count=4
Ich habe versucht, eine forceRefresh-Methode hinzuzufügen
Ich habe auch ein Bild meines RC in der Firebase-Konsole angehängt, ich glaube, ich habe es festgelegt Das ist richtig, aber vielleicht könnte hier das Problem liegen?
Image

Beliebig Hilfe dankbar, danke

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post