Selloby: how we did elephants for Android

    Selloby is a Twitter-style private ad service and our very first Android project. Despite the relatively small amount of code (just over 8 KLOC), during the implementation of the Selloby project, we tried out a number of techniques and methodologies that were useful in further work. Selloby also gave us the opportunity to feel, albeit in miniature, how Twitter works, which, in addition to self-development, added interest to our work.

    The main idea of ​​the project is that all announcements in the system, like Twitter posts, are homogeneous, and the client, using a set of filters, receives information that is of interest to him from this stream.


    Most likely, the user will need only ads selected by certain criteria. For example, from his city and from any one category. For this, a search function by city and category is implemented. The feeds on the main screen have three display options:

    • all ads (if filters are not configured and the city is not specified)
    • Hash tag filters ads
    • city ​​specific ads

    There is one trick to hash tags. For the price, not the value is indicated, but the maximum and minimum acceptable prices. This additionally complicated the server logic, since they had to make a selection from a rather large amount of data not by exact match, but by entering the interval. I believe that someday our back-end developers will write a separate article about this.

    The current city can be determined automatically by GPS coordinates. This is one of those chips that we used in further development. On the server we have a dictionary of settlements. Using a simple web service, we send our current coordinates there and get the name and ID of the city. Well, or the village :)

    Create creatives and hash tags

    Of course, in addition to viewing ads, the user should be able to create them. Just in creating an ad, namely in the use of hash tags, lies the main similarity between Selloby and Twitter. Hash tags can be as follows:
    • ! - action (for example, “! Sell”, “! Buy”, “! Rent”, etc.)
    • # - object ("# phone", "# car", "# room")
    • @ - location ("@ Moscow", "@ Ufa")
    • $ or ruble symbol - the cost of a product, service or offer

    About the last tag, cost, it is worth talking separately. It is selected depending on the current locale. If the system language is Russian, then the ruble sign is put. Otherwise, put a dollar sign. For each tag there is an auto-substitution of the most frequently entered values.

    Up to three photos can be added to an ad. Photos can be downloaded either from the phone’s gallery or directly from the camera. Then suddenly it turned out that there is a bug in the android , and different phones work differently with the camera. Some eat up a photographed image in intent, others save it in a temporary directory. The problem was solved by a simple work-round .

    In addition to hash tags and location, each ad belongs to one of several dozen categories, which are grouped together (goods, work, real estate, services, tourism, etc.).

    Each ad can be added to favorites, which is convenient if there is a need later to return to the previously viewed ad.


    In addition to its own login mechanism, Selloby also implements authorization via Facebook and Twitter.

    The most difficult thing was to give us authorization via Twitter, because at that time there was no own sdk there. For this, we have raised a special web service that performed authorization. The mobile application connects to this service, and not to the Twitter server. By the way, authorization in the system is optional - you can view ads without entering a username and password. To work with Facebook, we used the Facebook Android SDK .


    In this application, we used the OrmLite library to work with the database . This entailed some difficulties in compiling complex queries and modifying the database, so in the next projects we abandoned it. And here is another library, RoboGuice - an IoC container for Android applications, has shown its best side, and its use has become mandatory for all Android applications developed in Parcsis. The PullToRefresh library was used to display a Twitter- like list .


    The first version of Selloby for Android was published on July 15, 2011. At the moment, the application is being finalized, and significant changes await it in the future. Follow our news!

    Also popular now: