Check photon lost wifi connection in android app

Hi all

I’m doing my own project with Android apps

I’m assuming that, is there any example code or project in Android to check the wifi connection of Photon in background/broadcast receiver or service. I want to pop up Notification, or simply a button to check whenever Photon lost wifi connection ; wifi lost = button grey out ; wifi connected = button enabled.

Please give me advice for this case

Thank you all !

The actual online/offline indication on UDP devices is currently undergoing a rework as it is causing some confusion since the introduction of the Electron (also UDP based).
Hence I’d rather defer to someone how knows the roadmap and the current state of development in that regard (e.g. @mstanley or @rickkas7).

For the time being the best option you have is to try pinging the device and see whether it responds or not.

Thanks @ScruffR . The online status indicator is indeed being reworked and I believe there were plans to roll it out soon. However, in light of our current incident, we are prioritizing engineering efforts towards unblocking customers whose devices are still in a bad state. Once the dust has settled here, this will likely be something on our roadmap in the nearer term.

For now, ScruffR’s solution of pinging the device is likely the best short term solution.

1 Like

Dear @mstanley and @ScruffR

Thank you for your information, I know what to do now

Anyway, I have another question (do I have to create a new topic ?..) :slight_smile:

How can I call a multiple function in android app without call AsyncTask every single time for only one function.

Many thanks

You don’t have to but it would make sense as it would help others to easier find the answer via the forum search.

However, while I can’t say it wouldn’t be possible I’d say it doesn’t make a lot of sense in general to have multiple function calls in one task for several reasons

  • each individual function may take different times to complete
  • there is no harm in having multiple parallel async tasks as you can treat them as fire and forget calls
  • if you have multiple functions that should be called at once, why not wrap all the functionality in one function or create a “dispatcher” function which you can call as one
  • what would be the return value the task should hand back if one or more function calls fail but others succeede?