अपने उपयोगकर्ताओं को Firebase Performance Monitoring का इस्तेमाल करने के लिए ऑप्ट-इन या ऑप्ट-आउट करने की अनुमति देने के लिए, आपको अपने ऐप्लिकेशन को कॉन्फ़िगर करना पड़ सकता है. इससे Firebase Performance Monitoring को चालू और बंद किया जा सकता है.Performance Monitoring ऐप्लिकेशन डेवलप करने और उसकी टेस्टिंग के दौरान भी, यह सुविधा आपके काम आ सकती है.
यहां कुछ विकल्प दिए गए हैं:
ऐप्लिकेशन बनाते समय, Performance Monitoring SDK टूल को बंद किया जा सकता है. हालांकि, रनटाइम के दौरान इसे फिर से चालू किया जा सकता है.
Performance Monitoring SDK टूल को चालू करके, ऐप्लिकेशन बनाया जा सकता है. हालांकि, Firebase Remote Config का इस्तेमाल करके, रनटाइम के दौरान इसे बंद किया जा सकता है.
Performance Monitoring SDK टूल को पूरी तरह से बंद किया जा सकता है. हालांकि, रनटाइम के दौरान इसे चालू करने का कोई विकल्प नहीं होता.
ऐप्लिकेशन बनाने की प्रोसेस के दौरान, Performance Monitoring को बंद करना
ऐप्लिकेशन बनाने की प्रोसेस के दौरान Performance Monitoring को बंद करने से, आपको इन स्थितियों में मदद मिल सकती है: ऐप्लिकेशन डेवलपमेंट और टेस्टिंग के दौरान, ऐप्लिकेशन के प्री-रिलीज़ वर्शन से परफ़ॉर्मेंस डेटा की रिपोर्टिंग से बचने के लिए.
Performance Monitoring को बंद करने या निष्क्रिय करने के लिए, Apple ऐप्लिकेशन की प्रॉपर्टी लिस्ट फ़ाइल (Info.plist
) में इनमें से कोई एक कुंजी जोड़ी जा सकती है:
Performance Monitoring को बंद करने के लिए, लेकिन अपने ऐप्लिकेशन को रनटाइम के दौरान इसे चालू करने की अनुमति देने के लिए, अपने ऐप्लिकेशन की
Info.plist
फ़ाइल मेंfirebase_performance_collection_enabled
कोfalse
पर सेट करें.Performance Monitoring को पूरी तरह से बंद करने के लिए, अपने ऐप्लिकेशन की
Info.plist
फ़ाइल मेंfirebase_performance_collection_deactivated
कोtrue
पर सेट करें. ऐसा करने पर, रनटाइम के दौरान इसे चालू करने का विकल्प नहीं मिलेगा.
Remote Config का इस्तेमाल करके, रनटाइम के दौरान अपने ऐप्लिकेशन को बंद करना
Firebase Remote Config की मदद से, ऐप्लिकेशन के काम करने के तरीके और लुक में बदलाव किया जा सकता है. इसलिए, यह आपके लिए Performance Monitoring को बंद करने का सबसे सही तरीका है. ऐसा ऐप्लिकेशन के डिप्लॉय किए गए इंस्टेंस में किया जा सकता है.
अगली बार Apple ऐप्लिकेशन शुरू होने पर, Performance Monitoring डेटा कलेक्शन बंद करने के लिए, यहां दिए गए उदाहरण कोड का इस्तेमाल करें. Apple ऐप्लिकेशन में Remote Config का इस्तेमाल करने के बारे में ज़्यादा जानने के लिए, Apple प्लैटफ़ॉर्म पर Firebase Remote Config का इस्तेमाल करना लेख पढ़ें.
पक्का करें कि Remote Config का इस्तेमाल आपके
Podfile
में किया गया हो:pod 'Firebase/RemoteConfig'
अपने ऐप्लिकेशन की
AppDelegate
फ़ाइल में सबसे ऊपर यह कोड जोड़ें:Swift
ध्यान दें: Firebase का यह प्रॉडक्ट, macOS, Mac Catalyst, और watchOS टारगेट पर उपलब्ध नहीं है.import FirebaseRemoteConfig
Objective-C
ध्यान दें: Firebase का यह प्रॉडक्ट, macOS, Mac Catalyst, और watchOS टारगेट पर उपलब्ध नहीं है.@import FirebaseRemoteConfig;
अपनी
AppDelegate
फ़ाइल में,application:didFinishLaunchingWithOptions:
इंस्टेंस केlaunchOptions
स्टेटमेंट में यह कोड जोड़ें:Swift
ध्यान दें: यह प्रॉडक्ट macOS, Mac Catalyst, और watchOS टारगेट पर उपलब्ध नहीं है.remoteConfig = RemoteConfig.remoteConfig() // You can change the "false" below to "true" to permit more fetches when validating // your app, but you should change it back to "false" or remove this statement before // distributing your app in production. let remoteConfigSettings = RemoteConfigSettings(developerModeEnabled: false) remoteConfig.configSettings = remoteConfigSettings! // Load in-app defaults from a plist file that sets perf_disable to false until // you update values in the Firebase console. remoteConfig.setDefaultsFromPlistFileName("RemoteConfigDefaults") // Important! This needs to be applied before FirebaseApp.configure() if !remoteConfig["perf_disable"].boolValue { // The following line disables all automatic (out-of-the-box) monitoring Performance.sharedInstance().isInstrumentationEnabled = false // The following line disables all custom monitoring Performance.sharedInstance().isDataCollectionEnabled = false } else { Performance.sharedInstance().isInstrumentationEnabled = true Performance.sharedInstance().isDataCollectionEnabled = true } // Use Firebase library to configure APIs FirebaseApp.configure()
Objective-C
ध्यान दें: Firebase का यह प्रॉडक्ट, macOS, Mac Catalyst, और watchOS टारगेट पर उपलब्ध नहीं है.self.remoteConfig = [FIRRemoteConfig remoteConfig]; // You can change the NO below to YES to permit more fetches when validating // your app, but you should change it back to NO or remove this statement before // distributing your app in production. FIRRemoteConfigSettings *remoteConfigSettings = [[FIRRemoteConfigSettings alloc] initWithDeveloperModeEnabled:NO]; self.remoteConfig.configSettings = remoteConfigSettings; // Load in-app defaults from a plist file that sets perf_disable to false until // you update values in the Firebase console. [self.remoteConfig setDefaultsFromPlistFileName:@"RemoteConfigDefaults"]; // Important! This needs to be applied before [FIRApp configure] if (!self.remoteConfig[@"perf_disable"].numberValue.boolValue) { // The following line disables all automatic (out-of-the-box) monitoring [FIRPerformance sharedInstance].instrumentationEnabled = NO; // The following line disables all custom monitoring [FIRPerformance sharedInstance].dataCollectionEnabled = NO; } else { [FIRPerformance sharedInstance].instrumentationEnabled = YES; [FIRPerformance sharedInstance].dataCollectionEnabled = YES; } // Use Firebase library to configure APIs [FIRApp configure];
ViewController.m
या आपके ऐप्लिकेशन में इस्तेमाल की गई किसी अन्य फ़ाइल में, Remote Config की वैल्यू फ़ेच और चालू करने के लिए, यह कोड जोड़ें:Swift
ध्यान दें: Firebase का यह प्रॉडक्ट, macOS, Mac Catalyst, और watchOS टारगेट पर उपलब्ध नहीं है.//RemoteConfig fetch and activation in your app, shortly after startup remoteConfig.fetch(withExpirationDuration: TimeInterval(30.0)) { (status, error) -> Void in if status == .success { print("Config fetched!") self.remoteConfig.activateFetched() } else { print("Config not fetched") print("Error \(error!.localizedDescription)") } }
Objective-C
ध्यान दें: Firebase का यह प्रॉडक्ट, macOS, Mac Catalyst, और watchOS टारगेट पर उपलब्ध नहीं है.//RemoteConfig fetch and activation in your app, shortly after startup [self.remoteConfig fetchWithExpirationDuration:30.0 completionHandler:^(FIRRemoteConfigFetchStatus status, NSError *error) { if (status == FIRRemoteConfigFetchStatusSuccess) { NSLog(@"Config fetched!"); [self.remoteConfig activateFetched]; } else { NSLog(@"Config not fetched"); NSLog(@"Error %@", error.localizedDescription); } }];
Firebase कंसोल में Performance Monitoring को बंद करने के लिए, अपने ऐप्लिकेशन के प्रोजेक्ट में perf_disable पैरामीटर बनाएं. इसके बाद, इसकी वैल्यू को
true
पर सेट करें.perf_disable एट्रिब्यूट की वैल्यू
false
पर सेट करने पर, Performance Monitoring एट्रिब्यूट चालू रहता है.
डेटा अपने-आप इकट्ठा होने या कस्टम डेटा कलेक्शन की सुविधा को अलग-अलग बंद करना
ऊपर दिखाए गए कोड और Firebase कंसोल में कुछ बदलाव किए जा सकते हैं. इससे, आपको कस्टम मॉनिटरिंग से अलग, अपने-आप (आउट-ऑफ़-द-बॉक्स) होने वाली सभी मॉनिटरिंग को बंद करने की सुविधा मिलती है.
application:didFinishLaunchingWithOptions:
इंस्टेंस के तरीके के लिए ऊपर दिखाए गए कोड के बजाय,launchOptions
स्टेटमेंट में यह कोड जोड़ें:Swift
ध्यान दें: Firebase का यह प्रॉडक्ट, macOS, Mac Catalyst, और watchOS टारगेट पर उपलब्ध नहीं है.remoteConfig = FIRRemoteConfig.remoteConfig() let remoteConfigSettings = FIRRemoteConfigSettings(developerModeEnabled: true) remoteConfig.configSettings = remoteConfigSettings! // Important! This needs to be applied before FirebaseApp.configure() if remoteConfig["perf_disable_auto"].boolValue { // The following line disables all automatic (out-of-the-box) monitoring Performance.sharedInstance().isInstrumentationEnabled = false } else { Performance.sharedInstance().isInstrumentationEnabled = true } if remoteConfig["perf_disable_manual"].boolValue { // The following line disables all custom monitoring Performance.sharedInstance().isDataCollectionEnabled = false } else { Performance.sharedInstance().isDataCollectionEnabled = true } // Use Firebase library to configure APIs FirebaseApp.configure()
Objective-C
ध्यान दें: Firebase का यह प्रॉडक्ट, macOS, Mac Catalyst, और watchOS टारगेट पर उपलब्ध नहीं है.self.remoteConfig = [FIRRemoteConfig remoteConfig]; FIRRemoteConfigSettings *remoteConfigSettings = [[FIRRemoteConfigSettings alloc] initWithDeveloperModeEnabled:YES]; self.remoteConfig.configSettings = remoteConfigSettings; // Important! This needs to be applied before [FirebaseApp configure] if (self.remoteConfig[@"perf_disable_auto"].numberValue.boolValue) { // The following line disables all automatic (out-of-the-box) monitoring [FIRPerformance sharedInstance].instrumentationEnabled = NO; } else { [FIRPerformance sharedInstance].instrumentationEnabled = YES; } if (self.remoteConfig[@"perf_disable_manual"].numberValue.boolValue) { // The following line disables all custom monitoring [FIRPerformance sharedInstance].dataCollectionEnabled = NO; } else { [FIRPerformance sharedInstance].dataCollectionEnabled = YES; } // Use Firebase library to configure APIs [FirebaseApp configure];
Firebase कंसोल में यह तरीका अपनाएं:
- अपने-आप मॉनिटर होने की सुविधा को बंद करने के लिए, अपने ऐप्लिकेशन के प्रोजेक्ट में perf_disable_auto पैरामीटर बनाएं. इसके बाद, इसकी वैल्यू को
true
पर सेट करें. - कस्टम मॉनिटरिंग की सुविधा बंद करने के लिए, अपने ऐप्लिकेशन के प्रोजेक्ट में perf_disable_manual पैरामीटर बनाएं. इसके बाद, इसकी वैल्यू को
true
पर सेट करें.
- अपने-आप मॉनिटर होने की सुविधा को बंद करने के लिए, अपने ऐप्लिकेशन के प्रोजेक्ट में perf_disable_auto पैरामीटर बनाएं. इसके बाद, इसकी वैल्यू को