Welcome Guest,Register Now
Log In

ANT Forum

Welcome guest, please Login or Register

   

ANT Radio Service restart

Rank

Total Posts: 19

Joined 0

PM

Occasionally my Android app stops receiving ANT messages. Restarting the app usually fixes this but I'd like the app to detect this problem and recover automatically.

I've noticed that if I stop the ANT Radio Service (via "Force Stop" in the Process Stats Developer option) my app no longer receives ANT messages (as you would expect). The ChannelService method onServiceDisconnected is called when the ANT Radio Service stops but the default ChannelService class doesn't implement any notification of service consumers (apart from calling onAllowAddChannel(false)).

Is it likely that the ANT Radio Service stopping is the cause of my problem?

Also is there a recommended way of restarting the ANT Radio Service and/or the ChannelService service or at least notifying the Service consumers that all is not well?

Thanks      
Rank

Total Posts: 19

Joined 0

PM

I've since worked out how to restart the ANT Radio service by stopping and restarting the ChannelService (as the service class is named in the ANT SDK samples).

I had been calling :
context.unbindService(mChannelServiceConnection);

but hadn't realised that a call to :
context.stopService(new Intent(context, ChannelService.class))
was also required.

I'm still interested to hear if it is common for the ANT Radio Service to stop and also if ANT Applications usually detect this and restart the service.      
Avatar
RankRankRankRank

Total Posts: 745

Joined 2012-09-14

PM

To my knowledge, I'm not aware of any issues with the ARS stopping without apps unbinding from it first unless it has crashed. If it is the ARS stopping, I would expect you to see "onServiceDisconnected()" and then "serviceConnected()" if Android attempts to restart it.

If the device moves out of range or loses connection you should see status changes come back as well.

You could see if multiple apps which have bound to the ARS drop out simultaneously, which would pinpoint the issue to the ARS.