App doesn't signal onOnlineStateChanged

698
3
06-27-2017 09:27 AM
KenGorton
Esri Contributor

My app is set up to give a notification when the network connection status changes. This works in Player but after Making and deploying it to a device it does not generate the notifications when I switch in and out of airplane mode. The issue, I believe, is not with the LocalNotification itself, but with the onOnlineStateChanged signal. I verified that notifications are enabled for this app in device settings, and indeed other notifications work correctly in my deployed app, just not the one in this signal handler; Here's my implementation: 

LocalNotification
{
   
id: notification
}

Connections
{
   target: AppFramework.network
   onOnlineStateChanged: {
      notification.schedule("Connection status:",online?"Connected":"Offline",0) //This notification appears in Player but not in deployed app.
   }
}

Is there something else I should do to enable this?

0 Kudos
3 Replies
SiddeshPillai1
Esri Contributor

Hi Ken,

Enable Network capability in Settings. 

Best,

Siddesh

0 Kudos
KenGorton
Esri Contributor

That was the first thing I checked and it was enabled. I disabled/reenabled it but no change in behavior. I'll try it again.

Kenneth R. Gorton | GIS Solution Engineer | Esri

Esri | 8615 Westwood Center Drive | Vienna, VA 22182 | USA<x-apple-data-detectors://0/1>

Lat,Lon: 38.927838, -77.247625

what3words: cloak.club.office

T 1 703-506-9515, ext. 8146<tel:1%20703-506-9515;8146> | M 1 571-294-0342<tel:1%20571-294-0342>

kgorton@esri.com<mailto:kgorton@esri.com> | esri.com<http://esri.com/>

Em 27 de jun de 2017, ?s 20:01, Siddesh Pillai <geonet@esri.com<mailto:geonet@esri.com>> escreveu:

GeoNet <https://community.esri.com/?et=watches.email.thread>

Re: App doesn't signal onOnlineStateChanged

reply from Siddesh Pillai<https://community.esri.com/people/SPillai-esristaff?et=watches.email.thread> in AppStudio for ArcGIS - View the full discussion<https://community.esri.com/message/696961-re-app-doesnt-signal-ononlinestatechanged?commentID=696961&et=watches.email.thread#comment-696961>

0 Kudos
KenGorton
Esri Contributor

So after spending some time researching this it seems iOS does not signal onOnlineStateChanged. I got around this by setting up a timer that regularly checks AppFramework.network.isOnline and calls my desired methods appropriately. In my case I have the app disable the map when network goes away and reenable it when the network comes back. This works just fine in AppStudio Player on the dev machine and on the device, but when I call Cloud Make and then deploy the app to a device this no longer works when I switch to airplane mode on the device.

Is there something different in this regard between AppStudio Player vs a deployed app? 

Thanks,

Ken

0 Kudos