It may sound hard to attain focus on something that’s there one second and not the next, but the practice is far less difficult than you’d expect.
You’re actually focusing on the farthest thing from your smartphone, so select an object that’s far away from you – a building several kilometres away, or you see the moon in the night sky – and use these to set your focal distance.
If your phone camera allows you to change your focus type, try selecting ‘infinite’ to help you out here.
One with the night
Almost every smartphone camera provides a number of “scene” options, many of which include a “night” mode. If your smartphone camera also includes a “fireworks” scene, select that. If not, switch to the “night” mode and shoot normally.
These modes are designed to deal with the low ambient light conditions inherent to night-time shooting, so experiment with them to judge the results.