<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: locationDisplay.setAutoPanMode in ArcGIS Runtime SDK for Android Questions</title>
    <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/locationdisplay-setautopanmode/m-p/15748#M98</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have location services turrn off (for testing). &lt;/P&gt;&lt;P&gt;When i display the map i make these calls.&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;SPAN style="color: #660e7a; font-weight: bold;"&gt;locationDisplay &lt;/SPAN&gt;= &lt;SPAN style="color: #660e7a; font-weight: bold;"&gt;mMapView&lt;/SPAN&gt;.getLocationDisplay();
&lt;SPAN style="color: #660e7a; font-weight: bold;"&gt;locationDisplay&lt;/SPAN&gt;.setLocationDataSource( &lt;SPAN style="color: #000080; font-weight: bold;"&gt;new &lt;/SPAN&gt;AndroidLocationDataSource( &lt;SPAN style="color: #660e7a; font-weight: bold;"&gt;App&lt;/SPAN&gt;.getCurrentActivity(), LocationManager.&lt;SPAN style="color: #660e7a; font-weight: bold; font-style: italic;"&gt;NETWORK_PROVIDER&lt;/SPAN&gt;, &lt;SPAN style="color: #0000ff;"&gt;5000L&lt;/SPAN&gt;, &lt;SPAN style="color: #0000ff;"&gt;1 &lt;/SPAN&gt;) );
&lt;SPAN style="color: #660e7a; font-weight: bold;"&gt;locationDisplay&lt;/SPAN&gt;.setAutoPanMode( LocationDisplay.AutoPanMode.&lt;SPAN style="color: #660e7a; font-weight: bold; font-style: italic;"&gt;OFF &lt;/SPAN&gt;);
&lt;SPAN style="color: #660e7a; font-weight: bold;"&gt;locationDisplay&lt;/SPAN&gt;.startAsync();
&lt;SPAN style="color: #660e7a; font-weight: bold;"&gt;locationDisplay&lt;/SPAN&gt;.addLocationChangedListener( &lt;SPAN style="color: #000080; font-weight: bold;"&gt;this &lt;/SPAN&gt;);

then there is a button that will allow the user to start navigation mode between 2 points.
then i turn on auto pan.
&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;SPAN style="color: #660e7a; font-weight: bold;"&gt;locationDisplay&lt;/SPAN&gt;.setAutoPanMode( LocationDisplay.AutoPanMode.&lt;SPAN style="color: #660e7a; font-weight: bold; font-style: italic;"&gt;NAVIGATION &lt;/SPAN&gt;);&lt;/PRE&gt;this line crashes on me hard.&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 10 Dec 2021 20:37:49 GMT</pubDate>
    <dc:creator>BrianWeedman</dc:creator>
    <dc:date>2021-12-10T20:37:49Z</dc:date>
    <item>
      <title>locationDisplay.setAutoPanMode</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/locationdisplay-setautopanmode/m-p/15746#M96</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;this is crashing my application when i set AutoPanMode and gps on the device is turned off. &lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;SPAN style="color: #660e7a; font-weight: bold;"&gt;locationDisplay&lt;/SPAN&gt;.setAutoPanMode( LocationDisplay.AutoPanMode.&lt;SPAN style="color: #660e7a; font-weight: bold; font-style: italic;"&gt;NAVIGATION &lt;/SPAN&gt;);&lt;/PRE&gt;&lt;P&gt;I first set autopanmode off&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;SPAN style="color: #660e7a; font-weight: bold;"&gt;locationDisplay&lt;/SPAN&gt;.setAutoPanMode( LocationDisplay.AutoPanMode.&lt;SPAN style="color: #660e7a; font-weight: bold; font-style: italic;"&gt;OFF &lt;/SPAN&gt;);

and then allow the user to resume functions and if location services is off the app crashes.

how do i catch this or prevent this (without saying turn location services on).

I tried checking&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;SPAN style="color: #660e7a; font-weight: bold;"&gt;locationDisplay&lt;/SPAN&gt;.isStarted()

but this passes and the app still crashes.


03-14 15:03:54.934 11143-11143/cmdpoint.org A/art: sart/runtime/check_jni.cc:65] JNI DETECTED ERROR IN APPLICATION: JNI NewLocalRef called with pending exception 'java.lang.NullPointerException' thrown in unknown throw location
03-14 15:03:54.934 11143-11143/cmdpoint.org A/art: sart/runtime/check_jni.cc:65]&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; in call to NewLocalRef
03-14 15:03:54.934 11143-11143/cmdpoint.org A/art: sart/runtime/check_jni.cc:65]&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; from void com.esri.arcgisruntime.internal.jni.CoreLocationDisplay.nativeSetAutoPanMode(long, int)
03-14 15:03:54.934 11143-11143/cmdpoint.org A/art: sart/runtime/check_jni.cc:65] "main" prio=5 tid=1 Runnable&lt;/PRE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 20:37:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/locationdisplay-setautopanmode/m-p/15746#M96</guid>
      <dc:creator>BrianWeedman</dc:creator>
      <dc:date>2021-12-10T20:37:46Z</dc:date>
    </item>
    <item>
      <title>Re: locationDisplay.setAutoPanMode</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/locationdisplay-setautopanmode/m-p/15747#M97</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Brian,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can you give some more details on exactly what's happening in your code? I cant reproduce the crash with the v100.0.0 release currently. I have tried starting the LocationDisplay while location services are turned on, then turning them off, and then setting AutoPanMode; also tried with location services turned off to start with, and a few other workflows, but got no crash. Do you have any listeners (&lt;A class="link-titled" href="https://developers.arcgis.com/android/latest/api-reference/reference/com/esri/arcgisruntime/mapping/view/LocationDisplay.DataSourceStatusChangedListener.html" title="https://developers.arcgis.com/android/latest/api-reference/reference/com/esri/arcgisruntime/mapping/view/LocationDisplay.DataSourceStatusChangedListener.html"&gt;LocationDisplay.DataSourceStatusChangedListener| arcgis-android&lt;/A&gt;&amp;nbsp;,&amp;nbsp;&lt;A class="link-titled" href="https://developers.arcgis.com/android/latest/api-reference/reference/com/esri/arcgisruntime/mapping/view/LocationDisplay.AutoPanModeChangedListener.html" title="https://developers.arcgis.com/android/latest/api-reference/reference/com/esri/arcgisruntime/mapping/view/LocationDisplay.AutoPanModeChangedListener.html"&gt;LocationDisplay.AutoPanModeChangedListener| arcgis-android&lt;/A&gt;&amp;nbsp;,&amp;nbsp;&lt;A class="link-titled" href="https://developers.arcgis.com/android/latest/api-reference/reference/com/esri/arcgisruntime/mapping/view/LocationDisplay.LocationChangedListener.html" title="https://developers.arcgis.com/android/latest/api-reference/reference/com/esri/arcgisruntime/mapping/view/LocationDisplay.LocationChangedListener.html"&gt;LocationDisplay.LocationChangedListener| arcgis-android&lt;/A&gt;&amp;nbsp;) set up? Does your app already have Location permissions? What version of Android API are you running against?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Shelly&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Mar 2017 15:22:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/locationdisplay-setautopanmode/m-p/15747#M97</guid>
      <dc:creator>ShellyGill1</dc:creator>
      <dc:date>2017-03-15T15:22:43Z</dc:date>
    </item>
    <item>
      <title>Re: locationDisplay.setAutoPanMode</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/locationdisplay-setautopanmode/m-p/15748#M98</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have location services turrn off (for testing). &lt;/P&gt;&lt;P&gt;When i display the map i make these calls.&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;SPAN style="color: #660e7a; font-weight: bold;"&gt;locationDisplay &lt;/SPAN&gt;= &lt;SPAN style="color: #660e7a; font-weight: bold;"&gt;mMapView&lt;/SPAN&gt;.getLocationDisplay();
&lt;SPAN style="color: #660e7a; font-weight: bold;"&gt;locationDisplay&lt;/SPAN&gt;.setLocationDataSource( &lt;SPAN style="color: #000080; font-weight: bold;"&gt;new &lt;/SPAN&gt;AndroidLocationDataSource( &lt;SPAN style="color: #660e7a; font-weight: bold;"&gt;App&lt;/SPAN&gt;.getCurrentActivity(), LocationManager.&lt;SPAN style="color: #660e7a; font-weight: bold; font-style: italic;"&gt;NETWORK_PROVIDER&lt;/SPAN&gt;, &lt;SPAN style="color: #0000ff;"&gt;5000L&lt;/SPAN&gt;, &lt;SPAN style="color: #0000ff;"&gt;1 &lt;/SPAN&gt;) );
&lt;SPAN style="color: #660e7a; font-weight: bold;"&gt;locationDisplay&lt;/SPAN&gt;.setAutoPanMode( LocationDisplay.AutoPanMode.&lt;SPAN style="color: #660e7a; font-weight: bold; font-style: italic;"&gt;OFF &lt;/SPAN&gt;);
&lt;SPAN style="color: #660e7a; font-weight: bold;"&gt;locationDisplay&lt;/SPAN&gt;.startAsync();
&lt;SPAN style="color: #660e7a; font-weight: bold;"&gt;locationDisplay&lt;/SPAN&gt;.addLocationChangedListener( &lt;SPAN style="color: #000080; font-weight: bold;"&gt;this &lt;/SPAN&gt;);

then there is a button that will allow the user to start navigation mode between 2 points.
then i turn on auto pan.
&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;SPAN style="color: #660e7a; font-weight: bold;"&gt;locationDisplay&lt;/SPAN&gt;.setAutoPanMode( LocationDisplay.AutoPanMode.&lt;SPAN style="color: #660e7a; font-weight: bold; font-style: italic;"&gt;NAVIGATION &lt;/SPAN&gt;);&lt;/PRE&gt;this line crashes on me hard.&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 20:37:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/locationdisplay-setautopanmode/m-p/15748#M98</guid>
      <dc:creator>BrianWeedman</dc:creator>
      <dc:date>2021-12-10T20:37:49Z</dc:date>
    </item>
    <item>
      <title>Re: locationDisplay.setAutoPanMode</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/locationdisplay-setautopanmode/m-p/15749#M99</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;i think the issue is: if you try and change autopanmode before you ever get a location update it will crash. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Mar 2017 15:58:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/locationdisplay-setautopanmode/m-p/15749#M99</guid>
      <dc:creator>BrianWeedman</dc:creator>
      <dc:date>2017-03-15T15:58:05Z</dc:date>
    </item>
    <item>
      <title>Re: locationDisplay.setAutoPanMode</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/locationdisplay-setautopanmode/m-p/15750#M100</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Brian - thanks for the extra info - unfortunately I'm still not able to repro your issue. My device has location services turned off, the app has been granted Location permissions (as I'm running Android API 25), the LocationDisplay has been started as per your code, I've not got any calls to the LocationChangedListener yet, and I can set AutoPanMode without getting any crashes - when I do set it I get a&amp;nbsp;location changed call, the Location position is null (expected) at that point. &lt;SPAN style="background-color: #ffffff;"&gt;Does your app already have Location permissions? What version of Android API are you running against?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Shelly&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Mar 2017 12:08:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/locationdisplay-setautopanmode/m-p/15750#M100</guid>
      <dc:creator>ShellyGill1</dc:creator>
      <dc:date>2017-03-17T12:08:58Z</dc:date>
    </item>
    <item>
      <title>Re: locationDisplay.setAutoPanMode</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/locationdisplay-setautopanmode/m-p/15751#M101</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm running api 22 android 5.1.1.&lt;/P&gt;&lt;P&gt;i think i found the issue. when i set Auto Pan Mode on its calling&lt;/P&gt;&lt;PRE style="background-color: #ffffff; color: #000000; font-family: 'Courier New'; font-size: 9.6pt;"&gt;&lt;SPAN style="background-color: #e4e4ff;"&gt;onLocationChanged with no actual location data. So when i get the location point and try doing anything with it, it crashes.&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;it should not call on onlocationchanged if there is no location.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Mar 2017 13:08:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/locationdisplay-setautopanmode/m-p/15751#M101</guid>
      <dc:creator>BrianWeedman</dc:creator>
      <dc:date>2017-03-17T13:08:57Z</dc:date>
    </item>
  </channel>
</rss>

