import { IonicNativePlugin } from '@ionic-native/core'; import { Observable } from 'rxjs'; /** * @name Firebase * @capacitorincompatible true * @description * This plugin brings push notifications, analytics, event tracking, crash reporting and more from Google Firebase to your Cordova project! Android and iOS supported (including iOS 10). * * @usage * ```typescript * import { Firebase } from '@ionic-native/firebase/ngx'; * * constructor(private firebase: Firebase) { } * * ... * * this.firebase.getToken() * .then(token => console.log(`The token is ${token}`)) // save the token server-side and use it to push notifications to this device * .catch(error => console.error('Error getting token', error)); * * this.firebase.onNotificationOpen() * .subscribe(data => console.log(`User opened a notification ${data}`)); * * this.firebase.onTokenRefresh() * .subscribe((token: string) => console.log(`Got a new token ${token}`)); * * ``` */ export declare class Firebase extends IonicNativePlugin { /** * Get the device token * @return {Promise} Note that token will be null if it has not been established yet */ getToken(): Promise; /** * Get notified when a token is refreshed * @return {Observable} */ onTokenRefresh(): Observable; /** * Get notified when the user opens a notification * @return {Observable} */ onNotificationOpen(): Observable; /** * Grant permission to receive push notifications * @return {Promise} */ grantPermission(): Promise; /** * Check permission to receive push notifications * @return {Promise<{isEnabled: boolean}>} */ hasPermission(): Promise<{ isEnabled: boolean; }>; /** * Set icon badge number. Set to 0 to clear the badge. * @param {number} badgeNumber * @return {Promise} */ setBadgeNumber(badgeNumber: number): Promise; /** * Get icon badge number * @return {Promise} */ getBadgeNumber(): Promise; /** * Subscribe to a topic * @param {string} topic * @return {Promise} */ subscribe(topic: string): Promise; /** * Unsubscribe from a topic * @param {string} topic * @return {Promise} */ unsubscribe(topic: string): Promise; /** * Unregister from firebase, used to stop receiving push notifications. * Call this when you logout user from your app. */ unregister(): Promise; /** * Log an event using Analytics * @param {string} type * @param {Object} data * @return {Promise} */ logEvent(type: string, data: any): Promise; /** * Log an Error using FirebaseCrash * @param {string} message * @return {Promise} */ logError(message: string): Promise; /** * Set the name of the current screen in Analytics * @param {string} name Screen name * @return {Promise} */ setScreenName(name: string): Promise; /** * Set a user id for use in Analytics * @param {string} userId * @return {Promise} */ setUserId(userId: string): Promise; /** * Set a user property for use in Analytics * @param {string} name * @param {string} value * @return {Promise} */ setUserProperty(name: string, value: string): Promise; /** * Fetch Remote Config parameter values for your app * @param {number} [cacheExpirationSeconds] * @return {Promise} */ fetch(cacheExpirationSeconds?: number): Promise; /** * Activate the Remote Config fetched config * @return {Promise} */ activateFetched(): Promise; /** * Retrieve a Remote Config value * @param {string} key * @param {string} [namespace] * @return {Promise} */ getValue(key: string, namespace?: string): Promise; /** * Retrieve a Remote Config byte array * @param {string} key * @param {string} [namespace] * @return {Promise} */ getByteArray(key: string, namespace?: string): Promise; /** * Get the current state of the FirebaseRemoteConfig singleton object * @return {Promise} */ getInfo(): Promise; /** * Change the settings for the FirebaseRemoteConfig object's operations * @param {Object} settings * @return {Promise} */ setConfigSettings(settings: any): Promise; /** * Set defaults in the Remote Config * @param {Object} defaults * @param {string} [namespace] * @return {Promise} */ setDefaults(defaults: any, namespace?: string): Promise; /** * Start a trace. * @param {string} trace Trace name */ startTrace(trace: string): Promise; /** * To count the performance-related events that occur in your app (such as cache hits or retries), add a line of code * similar to the following whenever the event occurs, using a string other than retry to name that event if you are * counting a different type of event: * @param {string} trace Trace name * @param {string} counter Counter */ incrementCounter(trace: string, counter: string): Promise; /** * Stop the trace * @param {string} trace Trace name */ stopTrace(trace: string): void; /** * Allows the user to enable/disable analytics collection * @param {boolean} enabled value to set collection * @returns {Promise} */ setAnalyticsCollectionEnabled(enabled: boolean): Promise; /** * Allows the user to set User Identifier for crashlytics reporting * https://firebase.google.com/docs/crashlytics/customize-crash-reports?authuser=0#set_user_ids * @param {string} userId value to set the userId * @returns {Promise} */ setCrashlyticsUserId(userId: string): Promise; /** * Sends an SMS to the user with the SMS verification code and returns the Verification ID required to sign in using phone authentication * @param {string} phoneNumber The phone number, including '+' and country code * @param {number} timeoutDuration (Android only) The timeout in sec - no more SMS will be sent to this number until this timeout expires * @returns {Promise} */ verifyPhoneNumber(phoneNumber: string, timeoutDuration?: number): Promise; /** * Clear all pending notifications from the drawer * @return {Promise} */ clearAllNotifications(): Promise; }