B4A Code Snippet Starter service and the missing foreground service type crash - Erel    
Jul 30, 2025   
(17 reactions)I recommend adding these two snippets to avoid crashes that happen when the app is somehow started while the screen is turned off:
Add to manifest editor:
SetServiceAttribute(Starter, android:foregroundServiceType, shortService)
Add to starter service:
Private Sub Service_Timeout(Params As Map)
Service.StopForeground(51042) 'this is the id of the automatic foreground notification
End Sub
It will probably be added to the templates in the future....
B4A Tutorial Automatic Foreground Mode - Erel    
Jun 12, 2018   
(19 reactions)   
tags: Mode, service foreground, Automatic Foreground Mode, Automatic, Foreground, Services property is Service.AutomaticForegroundNotification. This allows you to change the notification... where we expect services to start even if the app is not in the foreground:
- Push notifications... to foreground mode.
This is now handled automatically in the B4A framework. When needed services...
link: ) -> Shows the app notification icon (upper on the device)
Service.AutomaticForegroundMode...
link: (123456789,GLO_NotificationSvc)
If I replace that code with this one:
Service.AutomaticForegroundMode...
B4A Question AutomaticForegroundMode without vibrating and notification sound - rleiman    
Apr 20, 2018.
Service.AutomaticForegroundMode = Service.AUTOMATIC_FOREGROUND_ALWAYS
...Hi Everyone,
Can we tell this statement not to vibrate the phone and not have a notification sound...
link: Hi Erel,
Thanks for the statement. Now my customers will be happy. ;)...
link: .AutomaticForegroundNotification = YourNotification
It doesn't matter how you build the notification....
link: there is a NotificationBuilder tutorial on the library so I can learn more about it....
Other B4A v8.0 has been released! - Erel    
Mar 20, 2018   
(59 reactions) is automatically held when a receiver receives an intent. The wake lock is released when the service starts.
Automatic foreground mode: https://www.b4x.com/android/forum/threads/automatic-foreground-mode.90546/
Notification object rewritten to work with targetSdkVersion 26. In most cases you don't need to change anything. Notification.SetInfo or Notification.SetInfo2 should be the last calls before... with targetSdkVersion 26 requirements.
Push notifications and other features that cause apps to start from...
B4A Question ShortService DataSync and Problems with SDK > 34 - Erel (first post)    
Sep 25, 202551042 is the id of the automatic foreground notification.
As you are disabling it with:
Service.AutomaticForegroundMode = Service.AUTOMATIC_FOREGROUND_NEVER
It will never show. I guess that you are calling StartForeground somewhere else and should then use the correct id....
link:
51042 is the id of the automatic foreground notification.
As you are disabling it with:
Service...
B4A Question Notification service and Service.StopAutomaticForeground : App icon popup - lucad (first post)    
Sep 12, 2018perfect! thanks. I'll keep the first call because my delay is actually there, it' due to an ...
link: It is unlikely to be noticeable without the Sleep(0) call (the behavior will probably exactly the sa...
link: Removed, thank you, however I have to keep the Service.StopAutomaticForeground at the beginning...
link: Just remove the call to Sleep(0). It is not needed....
B4A Question startForegroundService not allowed due to mAllowStartForeground - Erel (first post)    
Aug 31, 2025   
(2 reactions)Make sure not to call Service.StartForeground.
Add this to the manifest editor:
SetServiceAttribute(YourService, android:foregroundServiceType, shortService)
And to the service:
Private Sub Service_Timeout(Params As Map)
Service.StopForeground(51042) 'this is the id of the automatic foreground notification
End Sub
...
link: Service_Timeout(Params As Map)
Service.StopForeground(51042) 'this is the id of the automatic...
B4A Question Google Play is reporting "Missing foreground service type" - nyinyi (first post)    
Aug 5, 2025
https://www.b4x.com/android/forum/threads/starter-service-and-the-missing-foreground-service-type-crash.167999/
which one is better 👇
Sub Service_Start (StartingIntent As Intent)
Service.StopAutomaticForeground
End Sub
Or
Private Sub Service_Timeout(Params As Map)
Service.StopForeground(51042) 'this is the id of the automatic foreground notification
End Sub...
Other B4A v8.30 has been released - Erel    
Jun 12, 2018   
(59 reactions) the automatic foreground notifications tutorial then you should be aware to a significant behavioral...
B4A Tutorial [B4X] Firebase Push Notifications 2023+ - Erel    
Feb 11, 2026   
(32 reactions) the code references).
2. Download the attached project. Note the two subs added there (RemoteNotification and PushToken).
Notes
1. In iOS the notification popup only appears while the app is not in the foreground. You can UserNotificationCenter to change this behavior (search and you will find).
2...Google has deprecated the previous method of sending push notifications. It will stop working.... The notification is created in FirebaseMessaging receiver. Note that in debug mode, it will only work...
Page: 1  
2  
3  
4  
5  
6  
7