What is prohibited is working, not income per se.
You have to report rental income when you file your U.S. taxes. Work visa holders are allowed to have rental income, but that income has to be passive. I can buy a house in the US, and rent it out, but I cannot manage the property -- I have to hire a property manager. If a pipe breaks in the house, I am not allowed to fix that pipe myself -- I must pay a U.S. citizen or green card holder to fix it.
The same rules apply for apps and other sources of passive income. If you do zero work on your app while you are in the U.S. (not make any updates to it, etc), you might be able to pass it off as "passive income". But like kspaans you absolutely need to hire a lawyer.
 Working for free is illegal as well. If you do something that is normally paid, for free, you will get deported and banned. (As some foreign students who do this for experience sadly find out.)
 Having any income reported to the U.S. government with your Social Security Number (SSN) by any company that is not your visa-sponsoring company puts you on a road to getting deported and banned.
Whoa, wait a second. What about open-source contributions? Are they banned as well? Open-source work can be, but is not "normally" paid though.
Quoting from http://www.cilawgroup.com/news/2013/10/15/unpaid-volunteer-w... :
"As a general rule of thumb, one should look at whether Americans would perform the same job without pay and under similar circumstances and if the answer is “yes,” then a foreign national in an employment-restricted status can volunteer and work without pay."