First of all, I'm glad you're ok. There are some just plain rotten people in this world, and that can't be helped.
Now for my view on the subject. An ex-police chief for Ohio State University came to my high school years ago to tell us about safety at college. Being Ohio State, and having his position, I took his word as fairly credible. He said a few interesting things, and while I do not have the actual statistics, it is still fairly interesting.
1. Crooks look for people who look like easy victims. The first step not avoiding incidents is to not look vulnerable. Just saying you don't have the time and walking along would probably suffice in this situation.
2. Even if he has a gun, what are the real odds that he would shoot you? Would he really shoot to kill over a small electronic device? People as such are just using the weapon for intimidation. Their real weapon is fright, and the fact that you fear for your life. Plus, guns are noisy, and a dead give away to a crime scene.
So...
If he does indeed have a gun, this office said your best bet it to just turn and run as fast as you can. First of all, it is something the assailant isn't expecting. At this point, he must decide if he will just leave you alone (probably the case), or, if he will attempt to shoot you. This will probably take him a few moments to decide. Every second he uses making this decision, you are another step away. Every step you take, makes you a harder target to hit.
If he does decide to shoot at you, you must consider.
a. He has probably had no formal firearm training, and even under the best conditions is a poor shot.
b. He is undoubtedly nervous, again lowering his accuracy, concentration, and capability to use the weapon.
c. The target (you) is constantly moving away. Moving target, harder to hit accurately
d. If he does manage to hit you, the shot (according to this police officer) is very unlikely to kill you. Supposedly there are relatively few areas that mean instant death from a bullet, comparatively speaking. If you do manage to get hit, it will most likely be somewhere that is not fatal. Also, supposedly, gunshot wounds are fairly simple to treat, and although very painful, are most often an outpatient procedure.
Like I said, this all came from this police officer, and he had all sorts of statistics to back it up. i.e. Accuracy of hitting a moving target at 50 feet etc. etc. I perceived him as a reliable source because of his years of working in a field where he had experience such situations and was trained in handling them. I found it extremely interesting and helpful. Although I have never been in said situation, and hope to never be, I plan on keeping his words with me.
Pretty good insight/advice if you find yourself in a situation where you are unable to defend yourself. The running thing reminds me, if anybody ever tries to get you into a vehicle, even if they have a gun pointed at you or whatever, do whatever is in your power to resist and flee. It never ends well for the person that is being kidnapped. At least if you run you have a chance. At least that policeman didn't advocate curling up into a ball while being victimized like a chief in England did.
Anyway, I still recommend carrying pepperspray at all times.