Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to search and send notifications to people nearby in flutter firebase app?

I need a way to search for people nearby and send them a push notification. Doesn't seem like I can use topics for this, so probably need a way to query for users?

like image 272
user39587 Avatar asked Mar 04 '23 05:03

user39587


1 Answers

  1. save users locations in firestore (using geolocator plugin)

  2. get current user location (using geolocator plugin)

  3. Calculate the distance between the user and other users (using geolocator plugin)

    Geolocator().distanceBetween();
    
  4. Put a condition as example if(distance < 200) show users

  5. send a notification to the selected user (Firebase Cloud Messaging)

Sorry I couldn't give more details because they are many questions.

like image 156
SUX Avatar answered Mar 06 '23 08:03

SUX