© ICST Institute for Computer Sciences, Social Informatics and Telecommunications Engineering 2018.In most cases, human activity recognition (AR) with smartphones and smartwatches has been done offline due to the limited resources of these devices. Initially, these devices were used for logging sensor data which was later on processed in machine learning tools on a desktop or laptop. However, current versions of these devices are more capable of running an activity recognition system. Therefore, in this paper, we present SmokeSense, an online activity recognition (AR) framework developed for both smartphones and smartwatches on Android platform. This framework can log data from various sensors and can run an AR process in real-time locally on these devices. Any classifier or feature can easily be added on demand. As a case study, we evaluate the recognition performance of smoking with four classifiers, four features, and two sensors on a smartwatch. The activity set includes variants of smoking such as smoking while sitting, standing, walking, biking, as well as other similar activities. Our analysis shows that, similar recognition performance can be achieved in an online recognition as in an offline analysis, even if no training data is available for some smoking postures. We also propose a smoking session detection algorithm to count the number of cigarettes smoked and evaluate its performance.