A few weeks ago, a friend asked if I would advise the founders of Journey, an app development platform company based in South Africa. My first inclination was to say no — I’m in the business of reviewing apps, not advising people who make money from them — but then I found out that it was a free app designed to help fight Ebola, so I couldn’t say no.

Neither could Amazon.

Brothers Malan and Philip Joubert dropped by and explained how their app, Ebola Care, can help health care workers in affected West African countries photograph, geotag and track Ebola patients and provide the relevant data to aid organizations. The app records ambulance pickups and tracks the patients’ contacts as well as monitoring quarantines. It also tracks children orphaned by the death or illness of their parents and aids in educational and outreach efforts.

Because it’s running on a smartphone, aid workers can use it to take a picture of the patient and use the phone’s location awareness capabilities to plot the exact place where the patient is located. That’s important in a country such as Liberia, where some people are in places that don’t actually have a street address.

The app replaces paper forms, which can take weeks to process, Philip Joubert said.

“The advantage of using the app is to make information visible to decision makers in real time, to allow them to be much more proactive in dealing with the disease,” he said.

The app was based on expressed needs of aid groups in the region, who said that getting data quickly from the field is one of their biggest challenges.

For the Joubert brothers, the biggest challenge was to get enough phones to the region so aid workers could actually use the app. Although there is very high cellphone penetration throughout West Africa, there are still relatively few people with smartphones.

The app runs on both iOS and Android, but most aid workers, he said, have old-fashioned feature phones that aren’t capable of running Ebola Care or any other smartphone app. The pair donated as many phones as they could, but told me they needed 1,000 smartphones to fully equip the aid organizations they were working with.

By coincidence, the day we met was also the day that Amazon announced it was taking a $170 million write-down on its Fire phone related to unsold inventory. That made me realize that Amazon was probably sitting on thousands of unsold phones that could be put to good use.

I asked the Jouberts if their app could run on that phone and they said that it could. The Fire phone and Amazon’s Fire tablets use a modified version of Android, and although not all Android apps run on that operating system, the conversion process — if necessary — is very minor.

So, they reached out to Amazon, and the Seattle company agreed to donate 1,000 phones. The phones are being equipped with the app and other custom software and are being unlocked so that they can be used on local GSM carriers in the region.

One advantage of the Ebola Care app is that it can store data locally on the phone if there is no data connection and upload it to cloud servers when a connection is established. That’s important in West Africa because there may not always be a data connection, especially when used outside a city, or the aid organization may not be able to afford cellular service or the cost of uploading data. But once the phone does go online, either through a cellular or Wi-Fi connection, the data will be uploaded.

Amazon’s decision to donate those 1,000 phones to the cause is a great example of turning lemons into lemonade. The company may have lost a lot of money on its Fire phone, but I hope Amazon stockholders and employees are feeling a lot better about that loss, knowing those unsold phones will be used to help save lives.

Contact Larry Magid at larry@larrymagid.com. Listen for his technology chats on KCBS-AM (740) weekdays at 3:50 p.m.