Socket Programming : How to Integrate java Client in your Android App without Maven


I needed to implement Websockets between my android app and a web application to efficiently stream real-time text data (values that change over 10 times per second .. or more). Normally, most applications connect to a server using http calls which establishes a connection to the server, processes the request, provides a response and closes the connection. This is a problem for high-speed streaming requirements as new connections need to be established for each “chunk” of data sent. This is both wasteful and slow. What I needed was a protocol to implement continuous streaming!

Enter Websockets protocol, which enables full duplex continuous exchange between a server and a client (web-browser, mobile device) over a single TCP connection [See this article for more on how Sockets Work].  Also enter which is an awesome Node.js extension that implements the WebSockets protocol in an easy to use manner. Amazing!!

Luckily there is also a client port in android but it has dependencies which are designed to be installed using the Maven (or Gradle) build tool. Bummer!

I have minimal Maven experience (and I don’t use Gradle at this moment) and did spend the greater part of a day struggling to get my eclipse android application to build (compile and install dependencies) using Maven. Each time I added a Maven Nature to my android project, the compile process got garbled and I was left with the following error …

06-14 18:39:53.185: E/AndroidRuntime(5551): Caused by: java.lang.ClassNotFoundException: Didn’t find class “com.example.sockettest.MainActivity” on path: DexPathList[[zip file “/data/app/com.example.sockettest-2/base.apk”],nativeLibraryDirectories=[/vendor/lib, /system/lib]]

Continue reading

Posted in Tutorials | Tagged , | 1 Comment

How to Connect Android App with a Local Web Sever [Localhost] using Tethering/Portable Hotspot


When developing and testing apps that make calls to a web server (e.g mysql data storage ), you’ll likely need a  connection between your android device and a web server running on your PC.  Existing approaches have tried to explore creating adhoc wireless connections on a PC or installing virtual routers. These approaches do not work very well … and I really wanted to avoid the hassle of exposing my traffic to 3rd party wireless router software. Turns out there’s a simple solution –  create a wireless hotspot on my android device and connect my PC to it. Worked like a charm.

While the android hotspot feature was created mainly to share a mobile data connection with other devices (tablets, gps, pc), it will also function as a “wireless router”. You can simply turn off “Data” on your device if you don’t want to share your data plan . I am currently testing this on a device without a SIM card. Works just fine.

Note: If you already have your android device and your pc connected on the same local network (i.e you can successfully ping your mobile device from your pc), they you may just skip to the last step.

Continue reading

Posted in Android Tutorials | Tagged | Leave a comment

Getting Started with Streaming Data from a Microsoft Band to Your Android App


This post covers the steps needed to start streaming data from a Microsoft Band to your android app. There are numerous applications for this – including using this data as an input source as well as building nice use cases based on the data collected. It was surprisingly easy to actually stream data from a Microsoft Band to my app! Great Job Microsoft Developer Team!! The only thing is that in order for your app to successfully connect to the band, you need to have the Microsoft Health App installed. This is because the Health App installs the Microsoft Band Service which is constantly streaming data from your band .. and which can make this available to your app. After pairing my band to Microsoft Health It took less than 5 minutes to from zero to displaying data  . Continue reading

Posted in Microsoft, Wearables | Tagged | Leave a comment

Samsung to Release a New Gear Device – Right About Time!!


Image : Samsung Developers

Two likely things – a circular watch interface, and more sensors.

Today I got an email from Samsung hinting at an all new innovative gear device they are about to release. I was invited to join the Gear SDK Early Access Program. To me, Samsung leads the smartwatch innovation train and have released 5 iterations of their smartwatch in just under 3 years.  From the look of things, I imagine Samsung will expand its SDK in two main ways – first it may be looking to support the circular watch interface which has been all the rave (and which I don’t believe will translate to a better user experience), and also its new devices will likely sport a more accurate and more diverse set of sensors. Samsung watches till date have used a rectangular physical watch interface and the Gear S has had the richest set of sensors (pressure, uv, light, heartrate, gps, accelerometer, gyroscope) . There is opportunity to further innovate with sensors such as skin conductance, eeg , skin temperature (as seen on the microsoft band), barcode scanner, IR etc.

The device will also run  Tizen, and it will feature a Super AMOLED display, a rotating bezel, Exynos processor, Wi-Fi, cellular connectivity, Bluetooth, and calling support.

Interested in how to get started developing apps for the Samsung Gear? See some tutorials here.

We are waiting Samsung!

Posted in Reflections, Wearables | Tagged | Leave a comment

Research Internship – So It Begins.


This post summarizes my early thoughts regarding my upcoming internship, what preparations have been like and what goals I have in mind.


This has meant multiple things for me. It has meant going through the paper work at my university here in Hong Kong  (City University, HK) that ensures I am able to stay away for multiple months without contravening any law. It’s meant ensuring my departmental duties (teaching, invigilation etc) have been fully satisfied or delegated where possible. It has meant applying for and obtaining a J1 visa. It has meant early meetings with my internship supervisor and doing some mental lifting to identify a challenge worth dedicating the entire summer to. It has meant getting through almost two weeks of (stress induced) flu and attempting to make up for that. It has meant a really challenging attempt to find accommodation in the USA whilst living in Hong Kong – at some point, a kind landlord offered to rent his “garage/homeoffice” to me for $800 per month (kitchen and bathroom were on the second floor of the main house building which was several yards from said garage). Continue reading

Posted in PhD, Reflections, Research | Tagged , | Leave a comment

How do I make my app successful ?


Short Answer : You localize it and you use more permissions (wisely of course).

As the number of apps within platform ecosystems  such as Google Play, iTunes, Windows app store begin to cross the million apps mark, there’s a question that’s increasingly of concern to developers (individual and coporate) – How do we make our apps successful ? The notion of app success can refer to both financial success of an app (amount of revenue generated) or simply number of downloads, depending on the business model of the app and the goals of the developer.  The interwebs is full of anecdotal and practical suggestions regarding app success such as  those from adweek (partnerships, promotions, and better distribution can improve app financial success) and forbes (built-in virality, great user experience, market segmentation can improve success). Many of these suggestions hint at the importance of marketing, promotion and “virality”. Many times, developers struggle with non-existent marketing budgets and virality can have a huge element of luck. To further understand factors influencing success, I conducted a study (using data from the Windowsphone mobile app store) that sought to examine what application attributes (which developers could implement apriori) were related to success.  I identified app diversity/localization (the number of geographic locales an app is built to support) is of particular significance as a potential driver of app success  and app cohesivity (a measure of integration with the platforms services) is positively associated with app success (its download count/rank within the platform). Interestingly, both relationships appear to be moderated by the pricing scheme (free vs paid) adopted by publishers for that app. And that’s what this post is all about.

Minimizing Search Costs with Increased Diversity (Localization)

Here, I consider app diversity as the number of geographical locales which a given app supports. As software platforms are globally available to vast user audiences across such multiple locales, it is important to consider the effect of such a variable. From a related perspective, diversity of open source project teams has been identified as a driver of the success of open source projects . In the case of users within platform ecosystems, the transaction costs required to successfully install an application resides primarily with the search and information costs of finding the applications usually within the platform distribution channel. Continue reading

Posted in Research | Leave a comment

IBM Research Internship – Application Process


For research students in the area of computer science, computational social sciences and just plain social sciences, a research internship can constitute a MAJOR aspect of the grad school experience. You learn a whole lot, build a great network of friends, mentors collaborators, work on an exciting research project and usually get a publication at the end. If you are reading this, a likely question you are seeking to get pointers on would be “How do I get accepted into IBM Research ?” or “What are the requirements for acceptance into IBM Research ?” or “What is the IBM Research Internship application timeline like ?” .. or some other variant of this question. I have recently interviewed for a Summer 2015 internship at IBM Research (Thomas J Watson Yorktown Heights) and I also had similar questions before the interview. This post aims to provide some timeline information and tips .

Continue reading

Posted in Research | Tagged , , , , | Leave a comment

And some of my work is featured on the Wall Street Journal


Yay!! Some of my work on wearables has been featured on the Wall Street Journal (WSJ) ! I am very much humbled and thankful for the opportunity. Ofcourse, these are simple apps, but are actually the beginning of some more complex HCI research work I am conducting with wearables. A few months ago, ( summer 2014), in line with my mantra of learning a new language/platform technology each year, I decided to feed my growing interest in wearables. I made a few apps for the Samsung Gear smartwatch line (Gear 2 Gear 2 Neo and Gear S) , and a few of them were ranked as the top 200 finalist apps in the 2014 Gear App Challenge . It was a huge learning experience, and some of the lessons learned whilst working on these apps have been summarized in the these slides – here and here.

Without further ado .. here’s the video cover.

Continue reading

Posted in Reflections, Research, Wearables | Tagged , | Leave a comment

How to Scrape/Crawl Research Data Using Selenium WebDriver – and Java


As a researcher, there are many times you will need to assemble a dataset of information in the public domain (on websites) for research studies. E.g you want to analyse thousands  comments on a forum, or download and process hundreds of .csv files from an online databank etc. You can get some research assistants  to manually download this data (poor guys), or you could use a web scraper!

In such situations (and when it works), Web Scraping feels like the next best thing since sliced bread.

Web scraping (web harvesting or web data extraction) is a computer software technique of extracting information from websites. Usually, such software programs simulate human exploration of the World Wide Web by either implementing low-level Hypertext Transfer Protocol (HTTP), or embedding a fully-fledged web browser, such as Internet Explorer or Mozilla Firefox. This post details the process of using java and the selenium webdriver to scrape data and assemble a dataset. Continue reading

Posted in PhD, Research | Tagged , , | Leave a comment

Gidigames Android Board Game is Going Open Source [Happy New Year!]


Hurray and Happy New Year All! Gidigames is now OPEN SOURCE. You can download the Source code from Github and use it as you wish.

Brief description of Gidigames

Gidigames is a suite of simple (board) games that we’ve always played – and we’ve always loved! Gidigames has 3 simple titles contained in it.

Screenshot_2015-01-01-13-23-44 Screenshot_2015-01-01-13-24-17

Lexis – Lexis is a [fruit ninja concept]  local language learning game aimed at helping players learn new languages. Current functionality includes a play mode that enables players learn youruba, ibo, hausa (or any other) words by slashing at the correct English translation of the highlighted words.
Puzzlemania – Remember the number slider puzzle we all played as kids? Puzzlemania brings back the exact same experience! Picture, letter and Picture slider puzzles.
Tic-Tac-Toe – A.ka. X’s and O’s, Noughts and Crosses, Wick Wack Woe, Pencil and Paper game … Continue reading

Posted in Android Tutorials, Cocos2d, Cocos2D for android, Education | Tagged , | 1 Comment