Tech Archives - CrowdScores

CrowdScores at Google Play Playtime

Posted by | App News, Tech | No Comments

Google Play Playtime

Last Thursday, CrowdScores was kindly invited to Google Play Playtime at the National Centre for Circus Arts in Shoreditch, London.

The event was for leading Android developers to get tips and learn best practices for growing and succeeding on Google Play Store. It also provided an opportunity for developers to meet members of the Google Play team and share their feedback on the platform.

CrowdScores Android Google Play Playtime

The day began with a speech from Mark Bennett, the International Director at Google Play. He discussed a number of exciting new features, which included Instant Apps, Android Wear and Universal App Campaigns which are now a major part of our marketing strategy.

Up next was the Group Product Manager of Google Play, Ellie Powers. She discussed the more technical advancements we should look to expect from Android Studio and Firebase amongst other Google technologies.

Lunch brought about an opportunity for Google advocates to bond over Android shaped snacks or fight against one another in an Android style sumo suit. Needless to say, members of the CrowdScores team had a bout.

Google Play Playtime CrowdScores Sumo Wrestling

After lunch, sessions were split up into apps or mobile games. We opted for the app route which began with a session by Hugo Obi the Co-founder of Mailyo. Mailyo is a ‘premier gaming company’ that caters specifically for the African mobile market.

CrowdScores had 200,000 users from Africa in August 2016 so it was interesting to hear Hugo’s insight into the continent’s mobile usage behaviour. One statistic that particularly resonated with us was that 1 billion Android users will be using 2G on 2020. This means that for any application to be successful globally they need to be optimised for users with a limited mobile data budget.

Google Play Playtime CrowdScores Android

The day concluded with a panel of leading personalities in the mobile world, which featured representatives from King and Deliveroo. The main topic of discussion was the future of mobile and how they thought the industry would change in the future. It was fascinating to hear what they thought was in store for virtual reality, particularly regarding Google VR.

As passionate mobile developers, it was great to be given the opportunity to spend the day amongst so many like-minded people. We are extremely excited to build upon what we learnt at Google Play Playtime in order to improve our users’ experience at CrowdScores.

To see more of what went on at Google Play Playtime check out their hashtag #GooglePlaytime on Twitter.

Fastest Pi Scores

Posted by | Tech | No Comments

During our recent hackday I wanted to work on a project that utilized our public API to display football scores on a Raspberry Pi. Having worked in the technical services industry for the majority of my career I was interested in finding out what our customer’s experience was like building a basic client side prototype.
raspi
First things first, I needed to prepare a fresh Raspian Raspberry pi image. For those who haven’t done this before you can follow the instructions for your respective operating systems here.

I went with Wheezy because I knew the library I’d be using had worked on Wheezy before and I didn’t want to be troubleshooting dependency problems all day.

The Piface display has a nice packaged library that can be installed with the package manager. I wasn’t working in a virtual environment for this project so installing it this way was fine. I also had to enable the SPI interface for the screen to work after updating the OS. I usually just use the pi user for my projects but any sudoer would be fine.

sudo apt-get update && sudo apt-get upgrade -y
sudo raspi-config
#Advanced options
# - SPI
# - enable

At this point you could also enable ssh or a GUI login depending on your preferred way of working.

sudo reboot # to commit changes
sudo apt-get install python3-pifacecad -y

Once that was installed I pulled down my client library and installed dependencies.

git clone https://github.com/martyni/crowdscores_client.git
cd crowdscores_client
sudo pip-3.2 -r requirements.txt

I had written my client library on my laptop but, after having trouble with installing a geolocation library on the pi, I commented some of the dependencies out for this project as they weren’t really needed.

Next to authorize my requests I place a file in my user’s home directory called .crowdscores containing my API key.

echo “MY API KEY” > ~/.crowdscores

And to test this worked I ran my client script with an interactive python3 shell. If it works I should see my API key and be able to run some of the commands from the client.

python3 -i client.py
client.get_matches()

As the client library was working as expected I could concentrate on working on the code that controlled the display. There are 4 main parts to the script that controls it.

Screen Object – Directly controls what is displayed on the screen and formats the text so it gets shown correctly without any lingering “Ghost” characters or showing an ugly flashing cursor.

Game Object – This handles storing the score and team names of each game. It creates a screen instance for when it needs to display information.

Matches Object – The Matches object is responsible for interacting with the Crowdscores API and pulling down a list of matches to iterate over. It’s hard coded to check for matches that started within the last 3 hours although this was just an arbitrary figure I chose during the hack day to make sure that there were some games to display.

Main loop – It originally had some sleeps built in to display each of the scores for an arbitrary amount of time but as I finished this project with a couple of hours to spare I had some time to work on improving the project’s features.

As a bonus feature I wanted the scores to be read out loud, not just shown on the screen . After a quick google search, I came across a likely sounding library called pyttsx on an ActiveState blog post.

I couldn’t get it to pip install using pip-3.2 but worked fine installed as a python2 package.

sudo pip install pyttsx

By this time it was getting late in the day, so I opted to really put the hack in hackday and have the Game object write each game to a file then call a sys shell to run the “say.py” script (not exactly a best practises implementation). As the system call is blocking, and will wait for the say script to finish, I removed all of the previous sleep statements so the say script then became rate limiting step. Finally I needed to show the office my handiwork. Running the app is done by just running the screen code with a python3 prompt. If you’ve followed the instructions so far the one liner below should silently run it as log as your terminal sessions remains open.

python3 ~/crowdscores_client/screen.py >/dev/null &

wearable
First I demonstrated its application as a “wearable” using a mobile phone powerpack, some elastic bands and a pair of crowdscores branded gloves. Then showed its versatility by plugging it into a TV and having it announce the scores for all to hear.

I found that sometimes the pyttsx library wouldn’t work unless I had hard set the sound device as either HDMI or 3.5mm jack in the raspi-config settings.

sudo raspi-config
#Advanced options
#- Audio
# - either HDMI or 3mm Jack

Let me know if you have any thoughts or comments about this project via github. I don’t have any real plans to develop the screen or talking code further. I may make further changes to the API client code.


Github project