If a magnet needs to be fastened to a device, you can use either mechanical means, or adhesives to secure the magnet in place.
Adhesives are often used to secure magnets in place. If magnets are being adhered to uneven surfaces, you will need an adhesive with plenty of "body" so that it will conform to the uneven surface. Hot glues have been found to work well for adhering magnets to ceramics, wood, cloth, and other materials. For magnets being adhered to metal, "super-glues" can be used very effectively. ( our Resource Desk and links to adhesives often used in assembling magnets.)
We can supply Flexible magnets with an adhesive already attached to the magnet: all you need to do is to peel off the liner and attach to your product.
As with all adhesive applications, it is very important to ensure that all surfaces being bonded are clean and dry before bonding.