I use a strong adhesive like liquid nails or equal.

I haven't found a way to extend the ceiling box down to be compliant with 314.20

shortcircuit