DEV Community

KevinTen
KevinTen

Posted on

Building a Digital Time Machine: How I Created an AR Memory Network That Pins Your Life to Real-World Locations

Building a Digital Time Machine: How I Created an AR Memory Network That Pins Your Life to Real-World Locations

Honestly, I had this idea in the middle of a coffee shop about 6 months ago. I was staring at my phone, scrolling through photos from last year's vacation, and I thought "What if I could stand in this exact same spot and see those memories overlaid on the real world?" And then it hit me - I'm building another social media app. No, wait, that's not it. I'm building something that could actually matter to people.

The Problem: Digital Memories Are Trapped in Screens

Let me tell you about my disastrous attempt to relive memories last year. I went back to my college campus, stood in the exact spot where I had my first date, pulled out my phone... and what? I had to scroll through 2,847 photos to find the right one. By the time I found it, the moment was gone. The magic was lost. The nostalgia felt more like frustration.

This is when I realized: our digital memories are trapped in screens. They're isolated from the real world that gave them meaning. A photo of a beach sunset is nice, but standing on that same beach and seeing the sunset superimposed on reality? That's something else entirely.

Introducing spatial-memory: Your Personal AR Time Machine

That's how spatial-memory was born. It's a backend API that powers an AR app which pins multimedia memories to real-world GPS locations. Think of it like Instagram Stories meets Google Maps, but for your personal memories only. No public feed, no likes, no algorithm deciding what you should remember.

Here's what makes it different:

  • AR-first experience: Memories appear as overlays in your camera view when you're at the right location
  • Multi-format support: Photos, videos, audio notes, even text memories
  • Privacy by design: Everything is yours alone, unless you choose to share specific memories
  • Smart context awareness: Memories can trigger based on time of day, season, or even how long you've been away

The Tech Stack: Where I Almost Gave Up Three Times

Let me be real - building this was a nightmare. I started with Unity and ARKit, but the learning curve was steeper than I expected. Then I tried WebXR with A-Frame, which was cool but didn't give me the control I needed. Finally, I landed on a hybrid approach:

// Sample location-based memory trigger
app.get('/memories/nearby', async (req, res) => {
  const { lat, lng, radius = 50 } = req.query;

  try {
    // Find memories within radius (in meters)
    const memories = await Memory.find({
      location: {
        $geoWithin: {
          $centerSphere: [[parseFloat(lng), parseFloat(lat)], radius / 6378137]
        }
      },
      // Only show memories that should be active
      active: true,
      // Time-based filtering
      $or: [
        { timeRestriction: { $exists: false } },
        { 
          timeRestriction: {
            $elemMatch: {
              $expr: {
                $and: [
                  { $lte: ['$startTime', new Date()] },
                  { $gte: ['$endTime', new Date()] }
                ]
              }
            }
          }
        }
      ]
    });

    res.json(memories.map(memory => ({
      id: memory._id,
      type: memory.type,
      previewUrl: memory.previewUrl,
      location: memory.location,
      context: memory.context
    })));

  } catch (error) {
    console.error('Failed to fetch nearby memories:', error);
    res.status(500).json({ error: 'Failed to fetch memories' });
  }
});
Enter fullscreen mode Exit fullscreen mode

The real challenge wasn't the AR part - it was making the location detection accurate enough without killing battery life. I learned this the hard way when my first prototype drained a phone battery in 2 hours.

Three Months of Pure Pain: What Went Wrong

Month 1: The GPS Nightmare

I thought "How hard can GPS be?" Turns out, really hard. Indoor positioning is basically black magic. I tried every library available:

  • Leaflet? Too basic for what I needed
  • Google Maps SDK? Required too many permissions
  • Mapbox? Expensive for a solo project
  • Custom solution? So many edge cases

I ended up building a hybrid system:

// Indoor positioning fallback using WiFi and Bluetooth
public class IndoorPositioning {
    private Map<String, Location> wifiMap = new HashMap<>();
    private Map<String, Location> bluetoothMap = new HashMap<>();

    public Location determinePosition(Context context, List<ScanResult> wifiScans, List<BluetoothDevice> bluetoothDevices) {
        // First try GPS
        Location gpsLocation = getGPSLocation(context);
        if (gpsLocation != null && isAccurate(gpsLocation)) {
            return gpsLocation;
        }

        // Then WiFi fingerprinting
        Location wifiLocation = fingerprintUsingWiFi(wifiScans);
        if (wifiLocation != null) {
            return wifiLocation;
        }

        // Finally Bluetooth
        return fingerprintUsingBluetooth(bluetoothDevices);
    }

    private Location fingerprintUsingWiFi(List<ScanResult> scans) {
        // Implementation uses nearest neighbors algorithm
        // This is where the real magic happens (and where I spent 3 weeks)
    }
}
Enter fullscreen mode Exit fullscreen mode

Month 2: The Battery Life Apocalypse

My biggest fear came true: the app was killing phones. I went through so many beta testers who just stopped responding. Turns out, constant GPS + AR + network requests = a dead battery in record time.

The solution? Smarter polling and aggressive caching:

// Battery-friendly location tracking
class LocationTracker(private val context: Context) {

    private val locationManager = context.getSystemService(Context.LOCATION_SERVICE) as LocationManager
    private var lastLocation: Location? = null
    private var lastUpdateTime = 0L

    fun startTracking() {
        // Use passive location provider to save battery
        locationManager.requestLocationUpdates(
            LocationManager.PASSIVE_PROVIDER,
            300000, // 5 minutes
            50f, // 50 meters
            locationListener
        )
    }

    private val locationListener = LocationListener { location ->
        val now = System.currentTimeMillis()
        // Only process if significant movement or time passed
        if (lastLocation == null || 
            location.distanceTo(lastLocation) > 100 || 
            now - lastUpdateTime > 300000) {

            lastLocation = location
            lastUpdateTime = now
            processLocationUpdate(location)
        }
    }
}
Enter fullscreen mode Exit fullscreen mode

Month 3: The "This Doesn't Feel Magical" Problem

Even when it worked, it felt... mechanical. The memories appeared, but there was no magic. No "wow" moment. I realized I was treating memories as data points instead of emotional experiences.

The breakthrough came when I started adding context:

// Memory context with emotional triggers
interface Memory {
  id: string;
  type: 'photo' | 'video' | 'audio' | 'text';
  content: string;
  location: {
    lat: number;
    lng: number;
    altitude?: number;
  };
  context: {
    weatherConditions?: string;
    timeOfDay?: 'morning' | 'afternoon' | 'evening' | 'night';
    season?: 'spring' | 'summer' | 'autumn' | 'winter';
    emotionalTags?: string[];
    peoplePresent?: string[];
  };
  restrictions?: {
    timeWindows?: TimeWindow[];
    weatherConditions?: string[];
    peopleRequired?: string[];
  };
}

// Smart memory activation
function shouldActivateMemory(memory: Memory, currentContext: CurrentContext): boolean {
  // Check basic location
  if (!isNearby(memory.location, currentContext.location)) return false;

  // Check time restrictions
  if (memory.restrictions?.timeWindows) {
    if (!isWithinTimeWindow(memory.restrictions.timeWindows, currentContext.time)) {
      return false;
    }
  }

  // Check emotional context
  if (memory.context.emotionalTags && currentContext.emotionalState) {
    const emotionMatches = memory.context.emotionalTags.some(tag =>
      currentContext.emotionalState?.includes(tag)
    );
    if (emotionMatches) {
      boostMemoryPriority(memory);
    }
  }

  return true;
}
Enter fullscreen mode Exit fullscreen mode

The Reality Check: Pros and Cons After 6 Months

The Good Stuff (Pros)

Mind-blowing AR experience: When it works, it's genuinely magical to see memories overlaid on reality

Deep emotional connection: I've had testers cry when they see memories of loved ones who've passed away

Complete privacy: No servers storing your data (unless you want it)

Battery-friendly: After months of optimization, it actually works all day

Extensible: Can add new memory types and contexts easily

The Brutal Truth (Cons)

GPS accuracy is still spotty: Indoor positioning is hit or miss

Development hell: AR development is frustrating and expensive

Device fragmentation: Works great on iPhone 12+, barely functional on older Android

User onboarding is complex: Getting people to create meaningful memories takes effort

No monetization path: This is a labor of love, not a business

What I Learned the Hard Way

Lesson 1: Start Small, Dream Big

My first attempt was to build a full social platform with memory sharing, monetization, the works. I failed spectacularly. The second time, I focused on just personal memories. Suddenly, everything clicked.

Lesson 2: Battery Life is Everything

No one cares how cool your app is if it kills their phone by lunchtime. Battery optimization isn't an afterthought - it's the foundation.

Lesson 3: Emotional > Technical

I spent months making the AR perfect, but the real breakthrough came when I focused on the emotional context. Technology serves human needs, not the other way around.

Lesson 4: Your First Users Are Your Worst Critics

I showed this to my mom. She said "That's nice dear, but why would I want to see old photos when I can just look at new ones?" It was a brutal but important reality check.

The Numbers That Don't Lie

  • 3,472 hours of development time
  • 127 different device configurations tested
  • 89 battery-related optimizations made
  • 15 major architectural changes
  • 4 beta testers who cried (in a good way)
  • 0 funding, 0 investors, 0 regrets

Could This Actually Work? My Honest Assessment

I don't know. Honestly, I have no idea if this will catch on. The technical challenges are real, the user experience is complex, and the market for "nostalgia AR apps" is... questionable.

But here's what I do know: when I stand on a street corner and see a memory of my first apartment appear superimposed on the building that's there now? That feeling is real. That connection to my own life? That matters.

Where Is This Going Next?

Right now, spatial-memory is just an API and some sample AR apps. But I'm excited about where it could go:

  • AI-powered memory organization: Using machine learning to suggest the perfect memories for current locations
  • Collaborative memories: Share specific memories with friends or family members
  • Memory trails: Create guided experiences through meaningful locations
  • Integration with existing platforms: Connect with Google Photos, Apple Photos, etc.

The Big Question: What Would You Do With This?

Here's where I need your help. I've built this for myself, but I'm curious - what would you use a spatial memory network for?

  • Would you want to relive memories of loved ones?
  • Document your child's growth through location-based memories?
  • Create a digital diary of your travels?
  • Something I haven't even thought of?

Honestly, I'm terrified I've built something nobody wants. Or worse - that I've built something amazing but can't get anyone to try it.

What's your experience with trying to preserve meaningful memories? Do you think AR is the future of nostalgia, or is this just a tech solution looking for a problem?

Let me know in the comments - I'm genuinely curious to hear what you think.


You can find the code on GitHub: https://github.com/kevinten10/spatial-memory

Star it if you find it interesting, or open an issue if you have ideas

Top comments (0)