No.
Never put a battery operated device inside a wall unless it is specifically designed for that, which most will not be. It’s a fire hazard.
You can surface mount it on a wall, which some people have done. ( if you want to put it inside a project box and then surface mount it, that’s usually OK as long as the box is not airtight and rated for this purpose. Many batteries outgas, which is part of the fire hazard problem.)