You don't need everyone to have it installed. Just getting a large proportion of people to use it would likely have quite a significant effect in reducing infection spread.
One compromise in making it semi-mandatory could be to reduce lockdown requirements for people using and carrying the app, because they'd be less dangerous.
That would be discriminatory, and run afoul of many constitutions and treaties. It could really only happen if anyone could get the device and required data bundle subsidized. “Less dangerous” is not enough to warrant such a huge breach in citizen's rights.
Really? 6 months ago I'd have said that putting the entire nation under house arrest won't fly in any healthy democracy, but here we are. Turns out no country is more democratic than China.
A friend of mine still uses a old Nokia from ~2009. Will he get a free smartphone? Who will check if he has it on him? What if he has it on it and the battery is empty? Or the screen is broken? What if suddenly everybody wants a free smartphone? What if suddenly everyone carries a broken old phone with them as a decoy with the police?
The answer to these questions is easy in a authotarian state: you assume they are bad actors and use the full force of the state on them – so people will go out of their way to do as if they comply with your rules even if they don't.
In any democratic nation with a culture of scepticism when it comes to the government it won't be that easy. If you force people to do things over here, you will get a considerable portion of people working actively against you in ways that you cannot prove. It might be easier, more efficient and fruitful to just make it voluntary.
In increasing degrees of difficulty, how does a government get:
* people who own an Android or IOS smartphone to install a required app? (Might work if Google or Apple pushes the software, but does this outlaw non-stock-Android and IOS operating systems on a smartphone? Will Apple/Google do this for every country with an app?)
* people who don't own a smartphone to buy one? (Subsidized? Black-box devices that only need to be charged at home as an alternative for this group? How do you deal with people who don't want one for valid reasons besides privacy? E.g., people who got rid of them because they are vulnerable to the addictive properties of smartphone apps? And of course people who can't afford them.)
* people who can't use a smartphone to carry one around? (The digitally or otherwise illiterate or mentally incapable, and people with physical limitations won't just disappear overnight. This includes many elderly; exactly the weakest group with this virus.)
Gradually. It will be used to provide your freedom back. Lockdown is still in place, but if you agree to use the app, you can go outside and chill in a park, maybe even meet up with family members (groups fewer than N). Then you can introduce checkpoints in public places (just like China did btw): wanna go to malls, cinemas or airports? Install the app. But no, you are not forced to do this. You can just sit at home if you'd like until the lockdown is fully lifted. But we can't tell you when it happens, nobody knows. Perhaps after everybody is vaccinated.
Surely, they can also add a smartphone-free version that is a huge pain in the ass to use. It checks the box "you can survive without smartphone", but makes it practically unreasonable.
It will be the same situation as with CCTV and bag searches nowadays. The vast majority of people will accept this as reality and perhaps even support this. London is full of CCTV and mostly people are okay with this because they believe it is for their own safety. Sure, you are not forced into this, feel free to live in mountains off-grid.
The bottom line is you just wait until the lockdown is normalized in people's minds and then reward them with freedoms if they agree to use the app. And 99% will be okay with this.
One compromise in making it semi-mandatory could be to reduce lockdown requirements for people using and carrying the app, because they'd be less dangerous.