Best way to detect button connection in own app

  • I've been trying to find a reliable way check the connection status of a Flic-button in my own app.
    Every time the Flic app is updated or force-closed, my own app still thinks the Flic-button is connected (but the button is unresponsive).

    This is fixed by starting the Flic app up manually, but since I'm using the button as an alarm this is not a feasible solution.

    Does anyone know a good way to check if the flic button service is still active when opening my own app?
    I want the user to see a simple status message telling him if his Flic-button is connected/disconnected upon opening the app.

    Any help would be much appreciated!

  • @Emil Thank you very much for the detailed explanation!

    While I am able to fix these problems using force-closing or updating myself, less tech-savvy users using my app might not. This was the main reason I wanted to display a button-connection status.

    I was already using the getConnectionStatus(), but I think using the FlicManagerUninitializedCallback will solve some of the problem's I'm running in to.
    It's also good to hear there might be a way to get pending connection info in the future.

    As for the problems with the updated app: It used to update and reconnect without any problem, but last update I was signed out of the application. I had to manually login again to get it working. I'm not sure why I had to log in again (this wasn't the case before), but after I did the buttons automatically started working again.
    (I am using FlicBroadcastReceiver and FlicButtonCallbacks to get click events.)

  • FlicTeam

    You can use the getConnectionStatus() of the FlicButton object to get the current connection status if it is BLE connected or not. You have however a good point that there is something missing - if the button is connected there is no way of knowing whether the phone has a pending connection or not. If it has a pending connection it will automatically connect when the button is pressed and deliver the button press event. We'll release an update with possibility to get this information.

    About the Flic app has been force-closed or updated, if your app is running you can detect this by using the FlicManagerUninitializedCallback.
    If your app is not running AND the Flic app has been force-closed, then there is obviously no possible way to detect this (until you restart your app). However users force-closing apps probably know what they're doing...
    For the case when the Flic app is updated, it should be restarted automatically again and all buttons will be reconnected. Doesn't this work for you? Are you using the FlicBroadcastReceiver or FlicButtonCallbacks to get your click events?

  • @anton Good point, totally forgot to mention that...
    I am using the Android SDK.

  • FlicTeam

    Just a question, are you using the iOS or Android SDK?

Log in to reply