Does anyone know if it’s possible to use an ultrasonic cleaner to clean a waterproof device with a built-in battery (for example an electric razor, electric shaver or electric toothbrush)? And does it depend on the type of battery?
Seems OK to me. Ultrasonic means, above audio frequencies. It's not like you're shooting radio waves in and they will rectify and burn things up. You're shooting annoying sound in. It just jiggles a lot.
Still, it is a form of energy, so don't spend all day on one spot. You might warm it up too much. There is a thing called ultrasonic welding, used on plastic, but it's really focused. I don't think that's going to be your problem.
It might be a good idea to use distilled water because it is not conductive but not sure it would be necessary. I clean the electric razor head but haven't seen a need to put the whole shebang in the water. It is recommended to use a cleaner additive to the water which among other things has soap like additives to reduce surface tension allowing the water to get into the little nooks and crannies and rout out the grit and grime. And to be most effective the water should be heated and degassed to allow the US energy to work more effectively.