Hi there
I’m developing an app with the indoor sdk, the problem is when calling the Location list, this return a empty and i have 2 items, wath ican do? i´m use the following code for do the call.
SplashActivity.kt
val cloudCredentials = EstimoteCloudCredentials("findit-esq", "eb80ed8051e67a9271b760494f7eeaa5")
val cloudManager = IndoorCloudManagerFactory().create(applicationContext, cloudCredentials)
cloudManager.getAllLocations(object : CloudCallback<List<Location>> {
override fun success(locations: List<Location>) {
// Tomar ubicación y asignarlos a los identificadores
val locationIds = locations.associateBy { it.identifier }
// guarda las ubicaciones mapeadas
(application as IndoorApplication).locationsById.putAll(locationIds)
startMainActivity()
}
override fun failure(serverException: EstimoteCloudException) {
Toast.makeText(this@SplashActivity, "No se pueden obtener datos de ubicación de la nube. " +
"Verifique su conexión a Internet y asegúrese de haber inicializado el mapa", Toast.LENGTH_LONG).show()
}
})
private fun startMainActivity() {
startActivity(Intent(this, LocationListActivity::class.java))
}
LoctionListActivity.kt
var locations: List<Location> = ArrayList()
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_location_list)
mNoLocationsView = findViewById(R.id.no_locations_view) as TextView
mRecyclerView = findViewById(R.id.my_recycler_view) as RecyclerView
mRecyclerView.setHasFixedSize(true)
mLayoutManager = LinearLayoutManager(this)
mRecyclerView.layoutManager = mLayoutManager
mAdapter = LocationListAdapter(locations)
mRecyclerView.adapter = (mAdapter)
mAdapter.setOnClickListener { locationId ->
startActivity(MainActivity.createIntent(this, locationId))
}
override fun onStart() {
super.onStart()
val locations = (application as IndoorApplication).locationsById.values.toList()
if (locations.isNotEmpty()) {
mRecyclerView.visibility = View.VISIBLE
mAdapter.setLocations((application as IndoorApplication).locationsById.values.toList())
} else {
mNoLocationsView.visibility = View.VISIBLE
mRecyclerView.visibility = View.GONE
}
}
Best regard