Android Code Snippet Version safe notification

Status
Not open for further replies.
Update: If you are using B4A v8.0+ then the standard notifications will work.
Make sure to call Notification.SetInfo as the last step before using the notification.

New class for more powerful notifications: NB6 - Notifications Builder class (2018)

<code deleted as it is no longer relevant>
 
Last edited:

Semen Matusovskiy

Well-Known Member
Licensed User
Hi, Erel --
Yes, I use B4A v8. The built-in notification object doesn't work like I need. Or I am wrong somewhere.
The program shoild work under Android 4+. The notification should be visible (popup) in foreground/background.

I began from your sample in https://www.b4x.com/android/forum/t...s-firebase-cloud-messaging-fcm.67716/#content and changed n.Initialize2 (n.IMPORTANCE_HIGH).

Under Oreo 8.0 all is nice, except I do not found an equalent of notificationbuilde largeicon. Is it possible to set ?

For Android 5, 6, 7 I used your code from this topic with small changes, because built-in notification doesn't work like I want.
This way more or less works, except I am not happy that Android draws small icon near large icon.
 
Last edited:

Semen Matusovskiy

Well-Known Member
Licensed User
Well, I removed "setChannelId" for API26+ (createNotificationChannel remains). Works in Oreo, if app is in foreground.

In background ...
Service.StartForeground in Oreo is limited by 5 seconds afrer Service_Create, To bypass this limitation I moved Service.StartForeground (...) to Service_Create subroutine.
In firebasemessagingInstance_MessageArrived event the program saves notification and restarts the service (StopService (Me) .. StartService (Me)).

Remains background problem in Android 4.
 
Last edited:

kuosda

Active Member
Licensed User
Longtime User
I've used the "#additionaljar: com.android.support: support-v4" but still wrong
Additional error messages (B.jpg) and TestNotification.zip please ask you how to correct
 

Attachments

  • NotificationTest.zip
    7.7 KB · Views: 286
  • A.jpg
    A.jpg
    18.5 KB · Views: 279
  • B.jpg
    B.jpg
    205.4 KB · Views: 285
  • android-support-v4.jar
    376.6 KB · Views: 255
Status
Not open for further replies.
Top