Urban dwellers are obviously going to need masks more often. I live in a city, but it’s not typically that crowded. I am, however, half tempted to wear one any time I have to take the Metro at rush hour. If it ever goes back to what it was before…sardine can.
You wouldn’t need contact tracing for the app you’re talking about. You could integrate it with something that estimates the community spread of, say, flu (such apps already exist, although they tend to skew low and need work), which would tell you the number of people and then cross reference it to the likely number of infected people in the crowd to give a chance of infection and a recommendation as to whether or not to wear a mask. It could be like air quality warnings, so it could have levels like “Safe,” “At risk groups should” “All should”. It’s not a terrible idea. People are bad at assessing risk and AIs are good at quantifying it…
(Do you get those in Nepal? I’d imagine Kathmandu has some pretty bad air days, looking at the surrounding geography. It looks like it might get some gnarly inversion layers).