Your ignorance of technology is astounding. Adding a stun gun to a cellphone would not be a simple matter of adding a program (also known as an 'app') but would require adding capacitors, coils and the contacts, all of which would have to be insulated from the phone body or you'd burn out the phone and shock yourself silly with the first use. The battery would probably drop at LEAST one bar per use, if it didn't drain it completely, since it isn't designed for that kind of current load.
The result would be a much bulkier phone that would weigh about twice as much and cost 50-100% more. The difference would also be obvious to most people at first glance.