अपने उपयोगकर्ताओं को Firebase Performance Monitoring की सुविधा का इस्तेमाल करने के लिए सहमति देने या इससे ऑप्ट-आउट करने की अनुमति देने के लिए, अपने ऐप्लिकेशन को इस तरह कॉन्फ़िगर किया जा सकता है कि Performance Monitoring की सुविधा को चालू और बंद किया जा सके. ऐप्लिकेशन डेवलपमेंट और टेस्टिंग के दौरान, यह सुविधा आपके लिए फ़ायदेमंद साबित हो सकती है.
यहां कुछ विकल्प दिए गए हैं:
ऐप्लिकेशन बनाते समय, Performance Monitoring एसडीके को बंद किया जा सकता है. साथ ही, रनटाइम के दौरान इसे फिर से चालू किया जा सकता है.
आप Performance Monitoring एसडीके को चालू करके ऐप्लिकेशन बना सकते हैं. हालांकि, Firebase Remote Config का इस्तेमाल करके, रनटाइम के दौरान इसे बंद किया जा सकता है.
आप Performance Monitoring SDK को पूरी तरह से बंद कर सकते हैं. साथ ही, रनटाइम के दौरान इसे चालू नहीं किया जा सकता .
ऐप्लिकेशन बनाने की प्रोसेस के दौरान, Performance Monitoring की सुविधा बंद करना
ऐप्लिकेशन डेवलपमेंट और टेस्टिंग के दौरान, ऐप्लिकेशन के प्री-रिलीज़ वर्शन से परफ़ॉर्मेंस डेटा की रिपोर्टिंग से बचने के लिए, ऐप्लिकेशन बनाने की प्रोसेस के दौरान, Performance Monitoring की सुविधा बंद करना फ़ायदेमंद हो सकता है.
Apple के ऐप्लिकेशन के लिए, प्रॉपर्टी की सूची वाली फ़ाइल (Info.plist) में, Performance Monitoring की सुविधा बंद करने या डीऐक्टिवेट करने के लिए, इनमें से कोई एक कुंजी जोड़ी जा सकती है:
Performance Monitoring की सुविधा बंद करने के लिए, लेकिन रनटाइम के दौरान अपने ऐप्लिकेशन को इसे चालू करने की अनुमति देने के लिए, अपने ऐप्लिकेशन की
firebase_performance_collection_enabledफ़ाइल मेंfalseकोInfo.plistपर सेट करें.पूरी तरह से डीऐक्टिवेट करने के लिए Performance Monitoring, रनटाइम के दौरान इसे चालू करने के विकल्प के बिना, अपने ऐप्लिकेशन की
firebase_performance_collection_deactivatedफ़ाइल मेंtrueकोInfo.plistपर सेट करें.
रिमोट कॉन्फ़िगरेशन का इस्तेमाल करके, रनटाइम के दौरान अपने ऐप्लिकेशन को बंद करना 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 ConfigSwift
ध्यान दें: 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); } }];Performance Monitoring को Firebase कंसोल में बंद करने के लिए, अपने ऐप्लिकेशन के प्रोजेक्ट में 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 पैरामीटर बनाएं. इसके बाद, इसकी
वैल्यू