Inspiration

In Pakistan, livestock farming is a critical part of life for millions of families. But rural farmers face massive challenges everyday, like sudden animal diseases and extreme heat that can easily stop milk production. Because these rural areas have terrible internet connections, farmers cant simply search online or call a doctor for advice. I wanted to use modern tech to bridge this gap. This inspired me to build a smart mobile app that acts as an offline assistant, protecting both the animals and the livelihoods of hardworking farmers.

How I Built It

I built the application using a modern Android tech stack. For the frontend, I used Jetpack Compose to design a clean, bilingual user interface in English and Urdu. To make the app work without internet, I used an offline-first strategy with a local database called Android Room to save all animal profiles and vaccine histories directly on the phone. When the phone is online, the app connects to Google's Gemini AI for visual health scans and uses Retrofit to fetch weather statistics for real-time heat alerts.

To evaluate environmental danger accurately, I included the standard mathematical formula for the Temperature Humidity Index ($THI$). The app computes this directly using the temperature ($T$ in °C) and relative humidity ($RH$) to trigger heat stress alerts:

$$THI = 0.8 \cdot T + \left(\frac{RH}{100}\right) \cdot (T - 14.3) + 46.4$$

Challenges I Faced

The biggest challenge was designing a highly advanced AI system that could still be useful in remote areas with zero internet coverage. To solve this, I had to separate the app's features into two modes. I built the data storage to be 100% offline-first so farmers never lose their data in the field. Another massive challenge was making sure the app could run smoothly on cheap, budget Android phones that completely lack official Google Play services. I overcame this by writing a custom secure web-login fallback option so no user is left behind.

What I Learned

Through this project, I learned how to build a truly resilient, offline-first application architecture. I discovered how to inject local database context directly into a cloud-based AI system like Gemini to get highly personalized results. Most importantly, I learned that great software development is not just about writing complex code—its about deeply understanding the real-world accessibility needs of your users, such as providing larger touch targets and full native language support.

Built With

  • androidroom
  • firebase
  • geminiapi
  • jetpack
  • kotlin
  • okhttp
  • retrofit
Share this project:

Updates