Android Question B4A Notification - SetInfo => How to change the activity?


Active Member
Licensed User
Longtime User
Hi all!

Next little problem in my app:

I have realized a "no action service" which is active when user do nothing in my app. This can be happen on every activity in my app.

But after the initialization of my notification object with ...

    Dim notification As Notification
    notification.Sound        = False
    notification.Insistent    = False
    notification.Vibrate      = False
    notification.Icon         = "icon"
    notification.Light        = False
    notification.OnGoingEvent = True
    notification.AutoCancel   = True
    notification.SetInfo("MyApp", "Hallo World!", MyActivity)

... and after the using in this command ...

Service.StartForeground(1, notification)

... I cannot change the target activity.

So I tried to stop the foreground service by this first ...


... in order to build a new notification object and a new "StartForeground" command with new activity "MyActivity2".

But when I click on this notification object in the notification bar, there is always a jump to "MyActivity" activity, as created before.

Is there any other way to "replace" the target activity in such a notification object?

The big problem is: When I click on the notification object, the already opened activity remains opened and will not be closed.

I also inform my dynamic service about my current activity.

For this I use always the "Me" object in each activity.

Question: Is this the correct object in each activity or should I take "Activity" in order to get the current activity object?

I am thankful for all help here!

Last edited:


Active Member
Licensed User
Longtime User
Oh I think, this was my mistake!

I worked on a wrong notification object.

Now it is correct ... After creating a new notification object ... and stopping the old service and creating a new foreground service ... it works.

But I can see that the notification icons is flickering :-( ..... based on the fact that the service is stopped and newly created.

Puh.... I guess that I cannot realize my idea.
Upvote 0