Is it possible to clear the incaller?

barx

Well-Known Member
Licensed User
Longtime User
Hi not sure if I can explain this properly or not I might need more time to even figure out what i'm trying to explain. lol

On a notification I set a 'tag' and use the following code to check if this tag is passed from the incaller on the activity_resume

B4X:
   If inCaller.HasExtra("Notification_Tag") Then
      If inCaller.GetExtra("Notification_Tag") = "add_new" Then
         Globals.NoteID = 0
      Else
         Globals.NoteID = inCaller.GetExtra("Notification_Tag")
      End If
   End If

Which works very well.

But, If I then open another activity in my app which opens a list and a selection from the list sets Globals.NoteID, upon closing that activity and this main activity resuming again it still acts like there is an incaller and the above code re-iterates and changes the var in the 'Else' part.

So, is there a way to clear the incaller so that the .HasExtra will return false when I return from my other activity.

Thanks
 

barx

Well-Known Member
Licensed User
Longtime User
I had got round it by declaring a process global boolean variable (named InternalCall, not that it matters) Then set it to True when returning from an activity.

Then, added extra check,

B4X:
If InternalCall = False Then
      If inCaller.HasExtra("Notification_Tag") Then
         If inCaller.GetExtra("Notification_Tag") = "add_new" Then
            Constant.NoteID = 0
         Else
            Constant.NoteID = inCaller.GetExtra("Notification_Tag")
         End If
      End If   
   End If
    InternalCall = False

Setting to False after ready for the next incoming call.

Works a treat and also means if the last inCaller happens again, it won't be ignored.

Thanks.
 
Upvote 0
Top