Short version: You can install EarthPing (optionally from its its F-Droid repository, to get updates) to receive earthquake early warnings on Android devices without Google Play Services. It's a completely unofficial, experimental app, not affiliated with Google: it connects to Google's servers to receive the same alerts Google sends to Android phones, and they may or may not arrive in time or apply to you and wake you up with a scary siren. If your phone has Google Play Services (most unmodified phones, except e.g. Huawei's and some other Chinese ones), you most likely don't need this: you already have Google's own alerts.
Long version: Google provides an earthquake early warning system out of the box on Android devices, which works in many countries, mainly based on phones themselves detecting vibrations and crowdsourcing data from that.
Here are some relevant links:
The problem is that my phone doesn't run the Google Mobile Services, because I run a custom ROM with https://microg.org/ and there are many reasons why I'd rather keep it that way. But thanks to AI (yes, that's how it is), I could get an implementation of this service on my device anyway. Google gets my rough location, with only a 40 km accuracy, plus another three "decoy" locations which can optionally be turned into additional areas I actually want to monitor, such as where a friend lives.
I've tested it mostly with "artificial" earthquakes in the Settings section of the app: you can try it yourselves to get an idea what sort of earthquake will warn you in what sort of way (there are essentially three layers: a heads-up notification, a full-screen alarm with a TTS countdown, and a full-screen alarm with an ear-piercing siren, and you can tweak which one will apply to a particular Mercalli intensity). Plus I received just one real earthquake in a monitored area the other day, and that's it.
So do keep your expectations low, and don't rely on it to save your life or anything like that, but could it help? I hope so. There are quite a few things one can do even in 10 seconds before an earthquake strikes, if nothing else by knowing it's coming instead of being caught by surprise. You probably already know that, since you're here.
If you like this app and would like to talk about it, its GitHub page does have a discussion section, and I'd definitely like to just hear about earthquakes being detected by it and seeing a screenshot or the like! Or just comment here, but keep in mind also that, sadly, this subreddit will become irrelevant soon due to Reddit's new bot policies.
That's also partly why I thought this would be a good time to bring this up. The app will only work in areas covered by Google's service, which the links above mention to some extent, but I don't have a completely up-to-date list and they're adding new countries all the time (Italy was recently added for instance), so again, reports on how the app does are welcome.