An earthquake hits and unleashes devastation - but what if you had a 30 second warning?

While it may not seem like much, it could be enough time to take cover – just 30 seconds could mean the difference between surviving and not surviving. It doesn’t take a large earthquake to threaten lives – or to cause billions in damage.

In recent months, there has been a lot of earthquake news. On Wednesday a 4.8 magnitude earthquake and a series of weaker quakes hit Kansas, Oklahoma and Arkansas. On Monday a powerful 7.4-magnitude earthquake erupted off of El Salvador.

As the Midwest quake shows, you don’t need to be near the infamous San Andreas Fault to experience an earthquake. A whopping 45 states/territories are considered at high to moderate risk for damaging earthquakes.

But there are a number of initiatives that aim to give Americans those critical seconds of advanced warning.

One of the most promising, ShakeAlert, performed well during the recent 6.0-magnitude Napa Valley quake. It gave residents a 10-second advance warning.

An app called QuakeAlert builds on ShakeAlert’s work and aims to give Americans 30 seconds of early warning that a quake is on its way.

Early Warning Labs has partnered with the U.S. government, universities and Geographic Information Systems (GIS) provider ESRI to make the next-gen app a widespread reality.

The company is also developing a physical detection and warning device for the home.

Wisely, QuakeAlert leverages smartphones to get the word out. With an early warning sent directly to phones, teachers, for example, could get their students to undertake safety measures like duck, cover, and hold.

How does it work?

In general, when early warning systems aim detect an earthquake they quickly estimate its projected intensity and issue a warning before the ground shaking kicks into high gear.

Typically, a seismic sensor network detects the ‘P-wave’ energy. P-wave, or primary wave, is the initial energy radiating from an earthquake. The earthquake location, magnitude and direction are then quickly evaluated as well is the estimated extent of ground shaking in specific areas.

The overall objective is to provide a warning before the secondary, or ‘S-wave’ hits. The S-wave is the strongest shaking that unleashes most of the damage.

Current systems issue warnings to key stakeholders, like local and state emergency response officials and those responsible for critical infrastructure. With an early warning, officials can then attempt a mass notification.

Early warnings are important because they can help mitigate damage and prevent casualties.

With sufficient warning, it becomes possible to deploy measures like stopping cars before they enter tunnels or cross bridges. The authorities can also halt trains and prevent planes from landing. It also means that defensive measures for potentially high-risk national infrastructure, like gas lines and nuclear reactors, can be initiated.

The QuakeAlert app focuses on providing a warning directly to anyone in the threat zone.

What is it?

The QuakeAlert team has been building on ShakeAlert’s progress.

ShakeAlert is the result of a partnership between the state of California, the U.S. Geological Survey and CalTech. ShakeAlert leverages a network of approximately 400 ground motion sensors and represents an advance from more conventional detection systems that relied on physical hardware to provide warnings.

QuakeAlert relies on a cloud-based system and sends warnings through the app to the user’s smartphone, rather than the ShakeAlert-style hardware.

The app uses typical smartphone functions like GPS and Wi-Fi to identify location data, as well as accelerometers and gyroscopes for working out movement. The magnetometer on phones can be leveraged to help work out direction.

Smartphones near the epicenter of the quake detect the threat and relay the data to a server. The server then passes along the data to all the phones with the app giving them advanced warning of the incoming tremors.

In a high-risk zone like California, this approach means that more than 16 million smartphones can be harnessed to provide residents with direct warning.

Anyone with the app will be able to receive data from their system.

The company says it will be the first time anyone can be warned that an earthquake is coming by a message on their phone – from a few seconds to minutes before it strikes.

In addition to sending warnings to individual smartphones, QuakeAlert can quickly get the word out in high-density populated spots like stadiums and concert venues. Linked to the speaker system, the app can immediately warn game or concert goers.

Similarly, in a hospital it could be used to instantly warn everyone. It could also be linked to the building’s essential systems, prompting a switch to emergency power.

Testing of the app will continue with users. If it proves successful, it could become freely available to users as soon as next year.

Ballet dancer turned defense specialist Allison Barrie has traveled around the world covering the military, terrorism, weapons advancements and life on the front line. You can reach her at wargames@foxnews.com or follow her on Twitter @Allison_Barrie.