Using Android SDK in the background


Hello ,

This is manikandan working in affectiva android SDK to capture the emotions of a human for a period of time. I have successfully implemented the SDK and its working fine.

Now my next goal is to run the SDK in background using background SERVICE or may be using ASYNC task. I do not know how to implement this situation.

My app should work like, It should run in the background and capture my emotions and i want to display the result on the display (layout), once it capture my emotions.

Please suggest.

Thanks ,
Manikandan Venkatesan.


Hi, take a look at the ServiceFrameDetectorDemo in the Android SDK samples repo on Github, that should give you some ideas.


Thanks a lot.
I also need to run this ServiceFrameDetectorDemo in such a way that, when i switch to other applications it should still capture my faces.
I s there anything you could help us in this


Can I get emoji as response in ServiceFrameDetectorDemo?


Sure. The demo app stops the service when the number of started Activities in the running app drops to 0, but your app doesn’t have to do that.


Please see the SDK documentation at

To get emoji results from the SDK, first enable emojis by calling frameDetector.setDetectAllEmojis(true); (prior to calling frameDetector.start()), and then process the returned emoji data in your onImageResults callback.