Android Question Screen Notification Lighting

Discussion in 'Android Questions' started by aaronk, Aug 11, 2019.

  1. aaronk

    aaronk Well-Known Member Licensed User


    My friend showed me his Samsung S10+ and when a notification shows, it has a lighting effect that moves around the screen.

    I understand this is something Samsung has done to show this when a notification shows, however I am wanting to show something very similar in my app no matter what phone my app is running on. I was hoping to do it in B4A (and B4i as well).

    I am wanting to make it so that if you tap on a button it will show this animation, and not when a notification shows.

    I am happy for it to only happen when my app is open / showing on the screen. I was hoping for a choice of red, blue or green.

    Is there a way of creating the same effect in B4A (and B4i) ?

    Image was too big in size to upload.
    Here is a link to the image showing the effect I am after:
  2. Erel

    Erel Administrator Staff Member Licensed User

    I guess that it depends on one of the built-in settings. Try to set the importance level to HIGH.
  3. aaronk

    aaronk Well-Known Member Licensed User

    I think you missed the question.

    It is working fine on Samsung devices from what I can see, since Samsung devices support it.

    I was hoping there is an easy way in doing this effect in B4X so it will work on any device (like Pixel, LG, Sony etc) and not just Samsung devices.

    I understand it won't work on non-Samsung devices, but I was hoping we could make the same effect in B4X using a custom view. Not sure where to start on it.

    I installed the following app on my Nexus5x and it's doing the effect I want, but not sure how to do it in B4A (and B4i).

    I want to do the same thing in my app but when I press a button:
  4. Erel

    Erel Administrator Staff Member Licensed User

    Not exactly the same:


    B4J example:
    Sub Process_Globals
    Private fx As JFX
    Private MainForm As Form
    Private ImageView1 As ImageView
    Private BorderIndex As Int
    Private xui As XUI
    End Sub

    Sub AppStart (Form1 As Form, Args() As String)
       MainForm = Form1
    End Sub

    Sub MainForm_Resize (Width As Double, Height As Double)
    End Sub

    Sub CreateBorder(iv As B4XView)
       BorderIndex = BorderIndex + 
    Dim MyIndex As Int = BorderIndex
    Dim bc As BitmapCreator
       bc.Initialize(iv.Width / xui.Scale, iv.Height / xui.Scale)
    Dim brushbc As BitmapCreator
    Array As Int(xui.Color_Blue, xui.Color_White), brushbc.TargetRect)
    Dim brush As BCBrush = bc.CreateBrushFromBitmapCreator(brushbc)
    Dim trans As BCBrush = bc.CreateBrushFromColor(xui.Color_Transparent)
    Dim offset As Int = 2
    Do While MyIndex = BorderIndex
           brush.SrcOffsetX = brush.SrcOffsetX + offset
           brush.SrcOffsetY = brush.SrcOffsetY - offset
           bc.DrawRect2(bc.TargetRect, trans, 
           bc.DrawRect2(bc.TargetRect, brush, 
           bc.SetBitmapToImageView(bc.Bitmap, iv)
    End Sub
  5. aaronk

    aaronk Well-Known Member Licensed User

    Kind of, but aiming for it to be more like the sample I showed.
  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