Hi
I am working on this map called Akaryoun in my Android Studio (Kotlin). This is the link
https://www.arcgis.com/apps/mapviewer/index.html?webmap=90522831f84048008015cfa83e686782
This is the code that I am using.
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.util.Log
import android.view.MotionEvent
import android.view.View
import android.widget.ImageView
import android.widget.Toast
import android.widget.ZoomControls
import androidx.databinding.DataBindingUtil
import androidx.lifecycle.ReportFragment.Companion.reportFragment
import androidx.lifecycle.lifecycleScope
import com.arcgismaps.ApiKey
import com.arcgismaps.ArcGISEnvironment
import com.arcgismaps.mapping.ArcGISMap
import com.arcgismaps.mapping.BasemapStyle
import com.arcgismaps.mapping.Viewpoint
import com.arcgismaps.mapping.view.MapView
import com.example.checkingakariyoun.databinding.ActivityMainBinding
import com.arcgismaps.portal.Portal
import com.arcgismaps.mapping.PortalItem
import kotlinx.coroutines.launch
import com.arcgismaps.data.ServiceFeatureTable
import com.arcgismaps.mapping.ViewpointType
import com.arcgismaps.mapping.layers.FeatureLayer
class MainActivity : AppCompatActivity() {
private val activityMainBinding: ActivityMainBinding by lazy {
DataBindingUtil.setContentView(this, R.layout.activity_main)
}
private val mapView: MapView by lazy {
activityMainBinding.mapView
}
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
// MapOptions option = new MapOptions(MapOptions.MapType type);
lifecycle.addObserver(mapView)
setApiKey()
setupMap()
// val back = findViewById<ImageView>(R.id.back)
// back.setOnClickListener { finish() }
// setupZoomControls()
}
private fun setupMap() {
// val map = ArcGISMap(BasemapStyle.Navigation)
// Set the map to be displayed in the layout's map view.
// mapView.map = map
// val latitude = 34.0270
// val longitude = -118.8050
// val scale = 72000.0
// set the viewpoint of the map view
// mapView.setViewpoint(Viewpoint(latitude, longitude, scale))
val portal = Portal("https://www.arcgis.com", Portal.Connection.Anonymous)
// val itemId = "41281c51f9de45edaf1c8ed44bb10e30"
val itemId = "90522831f84048008015cfa83e686782"
val portalItem = PortalItem(portal, itemId)
val map = ArcGISMap(portalItem)
map.minScale = 150000.0
map.maxScale = 0.0
mapView.map = map
// mapView.setViewpoint(Viewpoint(24.7136, 46.6753,150000.0))
lifecycleScope.launch{
println("Load Status1: "+mapView.map!!.loadStatus.value)
println("Load Status2: "+mapView.map!!.load().isSuccess)
println("Load Status3: "+mapView.map!!.load().exceptionOrNull()?.message)
println("Load Status4: "+mapView.map!!.loadStatus.value.isTerminal)
println("Load Status5: "+mapView.map!!.geotriggersInfo.loadStatus.value)
println("Load Status6: "+mapView.map!!.item?.name)
println("Load Status7: "+mapView.map!!.loadSettings.toString())
println("Load Status8: "+mapView.map!!.unsupportedJson.toString())
println("Load Status9: "+mapView.map!!.uri.toString())
println("Load Status10: "+mapView.map!!.tables.size)
println("Load Status11: "+mapView.map!!.item?.itemId)
println("Load Status12: "+mapView.map!!.operationalLayers.size)
println("Load Status13: "+mapView.map!!.version)
println("Load Status14: "+mapView.map!!.offlineSettings.toString())
println("Load Status15: "+mapView.map!!.floorManager?.loadStatus)
mapView.map!!.load().map {
println("Load Statussss1: "+map.loadStatus.value)
println("Load Statussss2: "+map.load().isSuccess)
}
}
// val initialViewpoint = Viewpoint(24.7136, 46.6753, 10.0)
// mapView.setViewpoint(initialViewpoint)
}
private fun setApiKey() {
// It is not best practice to store API keys in source code. We have you insert one here
// to streamline this tutorial.
// ArcGISEnvironment.apiKey = ApiKey.create("API_KEY")
ArcGISEnvironment.apiKey = ApiKey.create("API_KEY")
}
}
I am getting this in my load response:
message=Geodatabase field not found., additionalMessage=Insert values has a non-existent field., errorCode=3017
I am using this dependency
implementation ("com.esri:arcgis-maps-kotlin:200.3.0")
Can Anyone let me know what's the cause of this issue? This map is working fine in website, it just doesn't work in Android
Thanks