How to temporarily disable collisions of a PhysicsBody?

I have two PhysicsBodies A and B, which sometimes I want them to collide, but other times I do not.

When I want to disable collisions of A with B, I try to set the category, collision, and contactbitmasks to 0, but it seems that they still collide (Before disabling, A is resting on B, but after disabling, A does not seem to pass through B, it just remains where it was).

What is the correct way to temporarily disable collisions of a physics body with ALL other objects ? - Once I figure out how to disable collisions with all other objects then disabling with specific objects should make sense.

I use the update() or onContactBegin(), onContactEnd() to make my decisions of when things collide and when they don’t but I do this based up object type and other flags in the game.

Makes sense, but one thing I don’t understand: isn’t using onContactBegin() enough ? Why would you use onContactEnd - by then the collision should be finished right?