Beta B4A 8 Beta#1: Service Notification icon corruption with style macro

Discussion in 'Android Questions' started by Alessandro71, Mar 19, 2018.

  1. Alessandro71

    Alessandro71 Member Licensed User

    I'm converting my project to B4A 8 and I have this issue:
    I'm running a service, other than Starter, that gets started from the Main activity upon user action.
    In the start sub, I set an icon and put it in foreground

    Code:
    Sub Service_Start (StartingIntent As Intent)
        
    'more code
            Dim n As Notification
            n.Initialize
            n.Icon = 
    "icon"
            n.Sound = 
    False
            n.Vibrate = 
    False
            n.Light = 
    False
            n.OnGoingEvent = 
    True
            n.SetInfo(
    "Title","Body", Main)
            
    Service.StartForeground(1, n)
        
    'more code
    End Sub
    Manifest file:
    Code:
    AddManifestText(
    <uses-sdk android:minSdkVersion=
    "14" android:targetSdkVersion="19"/>
    <supports-screens android:largeScreens=
    "true" 
        android:normalScreens=
    "true" 
        android:smallScreens=
    "true" 
        android:anyDensity=
    "true"/>)
    'more code
    SetApplicationAttribute(android:theme, "@android:style/Theme.Material.Light.DarkActionBar")
    'more code
    Using this configuration, the notification icon is correctly displayed

    While transitioning to the new features, I updated the manifest with the theme macro as follows:

    Code:
    AddManifestText(
    <uses-sdk android:minSdkVersion=
    "14" android:targetSdkVersion="24"/>
    <supports-screens android:largeScreens=
    "true" 
        android:normalScreens=
    "true" 
        android:smallScreens=
    "true" 
        android:anyDensity=
    "true"/>)
    'more code
    CreateResourceFromFile(Macro, Themes.LightTheme)
    'more code
    With this config, the notification icon is displayed as a mask: transparent pixels are transparent, while non-transparent pixels are all gray.
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    Peter Simpson likes this.
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