Android Question App crashing when initializing a channel with the notification builder

Discussion in 'Android Questions' started by rleiman, Apr 21, 2018.

  1. rleiman

    rleiman Well-Known Member Licensed User

    Hi Everyone,

    I'm using the updated notification builder and the initialize statement is crashing my app. Does anyone know what I'm missing?

    Thanks.

    Code in the Process_Globals sub routine:
    Code:
    Private nBNotify As NotificationBuilder
        
    Private channel As NotificationChannelBuilder
    Code in a sub routine to initialize objects:
    Code:
    If channel.ChannelsSupported Then
            channel.Initialize(
    "Channel_1""My App Name", channel.IMPORTANCE_DEFAULT)
            channel.Build
        
    End If

        nBNotify.Initialize(
    "Channel_1")
     
  2. Peter Simpson

    Peter Simpson Expert Licensed User

    Here you go...
    Code:
    'Process_Globals
        Private Notification As NotificationBuilder
        
    Private Channel As NotificationChannelBuilder 'New object
        Private ChannelID As String = "Boo_Name" '"Channel_1"
        Private ChannelName As String = "Boo Name"

    'Code in Sub
        If Channel.ChannelsSupported Then
            Channel.Initialize(ChannelID, ChannelName, Channel.IMPORTANCE_HIGH)
            Channel.EnableLights = 
    True
            Channel.EnableVibration = 
    True
            Channel.Build
            
    Notification.Initialize(Channel.ID)
        
    Else
            
    Notification.Initialize(Null)
        
    End If
    Enjoy...
     
    rleiman likes this.
  3. rleiman

    rleiman Well-Known Member Licensed User

    Hi Peter,

    Thanks so much for the code sample. That will help a lot. ;)

    Cheers.
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice