So I have geofences which I fetch from firestore and add them to a list of geofences. I want to send this list from my logIn activity to my main activity so the geofences will be activated then. How do I send my geofences array to my main Activity?
            Asked
            
        
        
            Active
            
        
            Viewed 74 times
        
    2 Answers
0
            
            
        You can pass an Intent to your main Activity. If you need to put custom objects (such as your geofence info) in the Intent, make your custom class implement Parcelable
 
    
    
        Haroon
        
- 538
- 2
- 11
0
            
            
        first you will need to create a model to store data geofence such as: data class Geofence ()
Then in your start activity:
val intent = Intent(context, MainActivity::class.java)
        intent.putParcelableArrayListExtra("GEOFENCES", geofences)
        startActivity(intent)
Access that intent on next acitivy:
val geofences = intent.getParcelableArrayListExtra<Geofence>("GEOFENCES")
Remember your Geofence model have anotation @Parcelize
Hope this help!
 
    
    
        Chuong Le Van
        
- 274
- 1
- 8
