<?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 FeatureLayer.addAttachment on unreliable cellular connection (Air) in ArcGIS API for Flex Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/featurelayer-addattachment-on-unreliable-cellular/m-p/349512#M8287</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I'm trying to solve an issue with uploading attachments (FeatureLayer.addAttachment) and an unreliable cellular connection on a tablet (Air 3.3 on Android, Flex API 2.5 online/offline app).&amp;nbsp; At first, long uploads were receiving a fault (Stream Error) after 30 seconds on the device and yet would finish successfully on the server without further notifcation.&amp;nbsp; This was solved with setting :&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;URLRequestDefaults.idleTimeout = LONGER_THAN_30SEC.&amp;nbsp; //FeatureLayer.requestTimeout was being ignored.&amp;nbsp; &lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;However, now I still have the edge case of the device losing connection before receiving a response from the server that the attachment was either successful or not (and with a long timeout, it just waits and waits because it never receives the response).&amp;nbsp; The main issue with this is that if I re-send the attachment after assumed failure, it creates a duplicate record.&amp;nbsp; In this scenario, I don't want the user to have to check to make sure the attachment is already there before re-sending either.&amp;nbsp; This also really applies to FeatureLayer.applyEdits as well - just more likely to send correctly since less data.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Possible solutions:&lt;/SPAN&gt;&lt;OL&gt;&lt;BR /&gt;&lt;LI&gt;Keep 30 second timeout and cancel the upload if timeout reached (There doesn't appear to be anyway to cancel the upload that I can find - there's no way to cancel underlying URLRequest).&lt;/LI&gt;&lt;BR /&gt;&lt;LI&gt;Make the app timeout roughly match the server timeout on the upload and assume if the app timeouts, then the server timed out and canceled the upload.&amp;nbsp;&amp;nbsp; I can't find a way to set that timeout - it doesn't appear that the "The maximum time a client can use a service:" setting in manager is adhered to for uploads.&amp;nbsp; Is there another place to set this timeout that could be limited to just the FeatureService in question?&lt;/LI&gt;&lt;BR /&gt;&lt;LI&gt;Create a proxy service wrapping the rest api and check for duplicates before inserting new record.&lt;/LI&gt;&lt;BR /&gt;&lt;LI&gt;Create a proxy service handling the upload using Air's File.Upload (which can be canceled) and then calling rest API through the proxy.&lt;/LI&gt;&lt;BR /&gt;&lt;LI&gt;Query attachments for existing filename already there before submitting attachment (i think this may be best bet, but would rather prevent needing this extra call to server).&lt;/LI&gt;&lt;BR /&gt;&lt;/OL&gt;&lt;SPAN&gt;Does anyone have any suggestions or ideas on the best way to handle this?&amp;nbsp; Is there something I'm missing?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Josh&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 21 Jun 2012 14:23:25 GMT</pubDate>
    <dc:creator>JoshWerts</dc:creator>
    <dc:date>2012-06-21T14:23:25Z</dc:date>
    <item>
      <title>FeatureLayer.addAttachment on unreliable cellular connection (Air)</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/featurelayer-addattachment-on-unreliable-cellular/m-p/349512#M8287</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I'm trying to solve an issue with uploading attachments (FeatureLayer.addAttachment) and an unreliable cellular connection on a tablet (Air 3.3 on Android, Flex API 2.5 online/offline app).&amp;nbsp; At first, long uploads were receiving a fault (Stream Error) after 30 seconds on the device and yet would finish successfully on the server without further notifcation.&amp;nbsp; This was solved with setting :&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;URLRequestDefaults.idleTimeout = LONGER_THAN_30SEC.&amp;nbsp; //FeatureLayer.requestTimeout was being ignored.&amp;nbsp; &lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;However, now I still have the edge case of the device losing connection before receiving a response from the server that the attachment was either successful or not (and with a long timeout, it just waits and waits because it never receives the response).&amp;nbsp; The main issue with this is that if I re-send the attachment after assumed failure, it creates a duplicate record.&amp;nbsp; In this scenario, I don't want the user to have to check to make sure the attachment is already there before re-sending either.&amp;nbsp; This also really applies to FeatureLayer.applyEdits as well - just more likely to send correctly since less data.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Possible solutions:&lt;/SPAN&gt;&lt;OL&gt;&lt;BR /&gt;&lt;LI&gt;Keep 30 second timeout and cancel the upload if timeout reached (There doesn't appear to be anyway to cancel the upload that I can find - there's no way to cancel underlying URLRequest).&lt;/LI&gt;&lt;BR /&gt;&lt;LI&gt;Make the app timeout roughly match the server timeout on the upload and assume if the app timeouts, then the server timed out and canceled the upload.&amp;nbsp;&amp;nbsp; I can't find a way to set that timeout - it doesn't appear that the "The maximum time a client can use a service:" setting in manager is adhered to for uploads.&amp;nbsp; Is there another place to set this timeout that could be limited to just the FeatureService in question?&lt;/LI&gt;&lt;BR /&gt;&lt;LI&gt;Create a proxy service wrapping the rest api and check for duplicates before inserting new record.&lt;/LI&gt;&lt;BR /&gt;&lt;LI&gt;Create a proxy service handling the upload using Air's File.Upload (which can be canceled) and then calling rest API through the proxy.&lt;/LI&gt;&lt;BR /&gt;&lt;LI&gt;Query attachments for existing filename already there before submitting attachment (i think this may be best bet, but would rather prevent needing this extra call to server).&lt;/LI&gt;&lt;BR /&gt;&lt;/OL&gt;&lt;SPAN&gt;Does anyone have any suggestions or ideas on the best way to handle this?&amp;nbsp; Is there something I'm missing?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Josh&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Jun 2012 14:23:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/featurelayer-addattachment-on-unreliable-cellular/m-p/349512#M8287</guid>
      <dc:creator>JoshWerts</dc:creator>
      <dc:date>2012-06-21T14:23:25Z</dc:date>
    </item>
  </channel>
</rss>

