Configuring the plugin

You can override the default Notification Plugin config to set values used to process certain notification events. For example, the channelFeeLimitMsat value can be set to limit the maximum fee paid in the case where a channel will be opened during receiving a payment with LNURL-pay.

import BreezSDK

fileprivate let appGroup = ""

class NotificationService: SDKNotificationService {
    private let channelSetupFeeLimit: String = "CHANNEL_SETUP_FEE_LIMIT"

    // Override the `getServiceConfig` function 
    override func getServiceConfig() -> ServiceConfig? {
        // Get the fee limit for opening a new channel from the `UserDefaults`
        let channelFeeLimitMsat = UInt64(UserDefaults(suiteName: appGroup)!.integer(forKey: channelSetupFeeLimit))
        return ServiceConfig.init(channelFeeLimitMsat: UInt64(channelFeeLimitMsat))
package com.example.application

import android.content.SharedPreferences
import breez_sdk_notification.ForegroundService
import breez_sdk_notification.ServiceConfig
import org.tinylog.kotlin.Logger

class ExampleForegroundService : ForegroundService() {
    companion object {
        // Your own shared preferences name or `FlutterSharedPreferences` for Flutter
        private const val SHARED_PREFERENCES_NAME = ""

    // Override the `getServiceConfig` function 
    override fun getServiceConfig(): ServiceConfig? {
        try {
            val sharedPreferences: SharedPreferences = applicationContext.getSharedPreferences(
            // Get the fee limit for opening a new channel from the shared preferences
            val channelFeeLimitMsat =
                sharedPreferences.getLong(CHANNEL_SETUP_FEE_LIMIT, 0).toULong()
            return ServiceConfig(channelFeeLimitMsat = channelFeeLimitMsat)
        } catch (e: Exception) {
            Logger.tag(TAG).error { "Failed to get service config: ${e.message}" }

        return ServiceConfig.default()