They could miniaturize a specialized spectrometer of some sort I suppose. I don't know. If I knew, I'd be doing it now - that's quite literally tens of billions of dollars that people would throw at you faster than you'd be able to catch it.
'January 2017 at the Consumer Electronics Show in Las Vegas, the company unveiled the Changhong H2 with NIR spectrometer', not sure if this was ever released, but suggests miniature spectrometry is a thing...
E.g. https://iopscience.iop.org/article/10.1088/1757-899X/104/1/0...