iOS Question How to show a notification

alimanam3386

Active Member
Licensed User
Longtime User
How can I show a notification when my app is in background? I used timer but it doesn't work when my app is in the background.
 

alimanam3386

Active Member
Licensed User
Longtime User

I can schedule notification in normal mode but when I use schedule notification in Timer_Tick event, it does not work.

this is my code :
B4X:
Private Sub tmrCheckClipboard_Tick
 
  Dim clipboard As Clipboard

  If AppActive = False Then
    
    If clipboard.StringItem.Length > 0 Then
      
      If clipboard.StringItem.IndexOf("example.com") > -1 Then

        txturl.Text  =  clipboard.StringItem
        
        Dim notify As Notification
        notify.Initialize(DateTime.Now)
        notify.AlertBody    =  "Download and save file easily"
        notify.PlaySound    =  True
        notify.Tag        =  clipboard.StringItem
        notify.Register
        
        clipboard.StringItem  =  ""
        
        Private NativeMe As NativeObject
        NativeMe  =  Me
        NativeMe.RunMethod("setAudioSession", Null)
        media.Initialize("vv")
        media.LoadVideo(File.DirAssets,"Gamma.mp3")
        media.Play
        NativeMe.RunMethod("register", Null)
        
        
      End If
      
    End If
    
  End If
 
End Sub
 
Upvote 0
Top