In The Dark Knight a city-wide surveillance system resembling sonar is portrayed. What is the in-universe explanation of how Gotham's phone's speakers and microphones are able to be used to generate and interpret the waves used to operate Batman's surveillance system?
Because the absurd and unrealistic technology is not based in the phones, but in the computer that registers the sonar.
Once a mobile phone has been hacked into (which is reasonably simple, particularly for someone like Lucius Fox or Bruce Wayne), it is simple enough to program the phone's speaker to emit a specific noise with a specific frequency, then have the microphone pick up that noise as it is pinged back (echolocation).
The real problem comes from trying to analyze the data from thousands of phones simultaneously. Processing a single phone's echolocation in real-time would be hard enough, you would need a massive processing power in order to do it quickly.
You would need to register the sound returning from every direction, along with the respective times it takes for them to return. Then you would need to return this data to the computer to analyze, and print a 3D graphic onto a monitor. All within less than quarter of a second for real-time purposes (like in the fight with the Joker).
And then you need to do it a few thousand times.
As we see in the film, a massive computer is used. It is not unreasonable to believe that Bruce Wayne could buy or build a computer that size in order to be able to do it.
I realize that cellphone technology doesn't necessarily have the level of technology needed for this to work (3 different microphones that are more sensitive etc.).
However, this isn't an absurd or unrealistic technology, they could theoretically be created now. The general population having them, therefore, would fall into the realms of suspension of disbelief.
Per the screenplay
FOX : I had R and D work it up – it sends out high frequencies and records the response time to map an environment.