अपने उपयोगकर्ताओं को 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 का इस्तेमाल करना लेख पढ़ें.
पक्का करें कि आपके
Podfileमें Remote Config का इस्तेमाल किया गया हो:pod 'Firebase/RemoteConfig'अपने ऐप्लिकेशन की
AppDelegateफ़ाइल में सबसे ऊपर, यह जोड़ें:Swift
ध्यान दें: Firebase का यह प्रॉडक्ट macOS, Mac Catalyst, और watchOS टारगेट पर उपलब्ध नहीं है.import FirebaseRemoteConfigObjective-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 पैरामीटर बनाएं. इसके बाद, इसकी वैल्यू को