Advocating Fragment Oriented Applications in Android

This is a series of 6 blog posts which explains about Fragment Oriented Architecture in Android applications. In this first post, I’m going to explain what is Fragment Oriented Architecture and why shall one care. In subsequent posts I’m going to talk about following topics.

Continue reading

 

User Phone Verification – A way to prevent fraud in e-commerce

Recently in one of our e-commerce projects we implemented phone verification for users to have authentic accounts at our website. The requirement was to have one account per user to avoid misuse of offers provided by our service on scenarios like signup, high-value purchase, referring a new user to shop at our site plus other special offers.

So we decided to verify users using phone number verification that seemed more reliable than email verification since having multiple phone numbers is not as easy and rare as compared to having multiple email accounts. We then chalked out a simple approach that came out ineffective and needed a renovation.

Initial Approach:

Save a phone number corresponding to a user that he can verify later by the one time verification code sent to his phone. We then ensure that the phone number is not verified against other account to have an account per user on verification request. Things seemed to go well but didn’t serve the purpose as expected.

During our revisit to the approach we found out that a user still could create multiple accounts. If you missed it too, here is how it goes:

Suppose, a user say, Haitham signs up with account A1 and verifies his account with number, N1. Now once he needs another account to avail more offers he can simply edit his number to say, N2 and not verify it. Then he can create another account say A2, and verify this new account using N1. As in the application’s use case of ‘referring a new user to shop at our site’, he could add himself as a referrer using account A1 for A2. Hence, the whole idea of fraud detection and prevention was deceived.

Magic Trick:

Don’t associate a number with a user until the user verifies the number.

The simple change above solved our issue to all possible levels.
Continue reading

 

Compiling native libraries for Android L

Preparing your app for Android L ?

While using native executables in our existing Android apps we observed that those executables were no more working with Android L. We came to know that Android has introduced one more security feature starting from Android L i.e
Executable must be PIE (Position independent executable).

To compile a library adhering to above security feature you just need to follow these steps:

  1. Set following LDFLAGS or linker flags : -pie -fPIE
  2. Add --with-pic option while configuring the library.

Some libraries might use different configure options to compile the code with PIC (Position Independent Code) so to check all available configure options for PIC you can use this command:

./configure -h | grep -i pic

If there is no PIC option in configure script then you can try passing -fPIC option with your CFLAGS.

Now, compile the project (make, make install) and it should generate PIE.

To check if you’ve successfully generated a Position Independent Executable (PIE)

You can use “hardening-includes” package on Ubuntu or Debian.

Continue reading

 

Bubble Validations

We were developing a Content Management System which is composed of different components, with each component having dependency on other components in the hierarchy.

Our CMS has the following structure :

  • Site has_many pages
  • Page has_many sections
  • Section has_many embedded_modules
  • EmbeddedModule has_many elements

Problem Statement

For any component to be publishable, we need to ensure that not only a particular component, but also its descendants(children) should satisfy the criteria of publishability.
In our case a Page could be publishable, if all sections belonging to it were publishable. A section would be publishable if all embedded modules belonging to it were publishable. A EmbeddedModule would be publishable if all elements belonging to it were publishable.

If at any step of the hierarchy the criteria fails, not only that component should be marked as unpublishable but also upchain should be notified of unpublishablity.
If any EmbeddedModule gets unpublished then it must unpublish the upper hierarchy i.e its associated section, page and site.

Our Solution

To achieve this we identified that a shared module would be needed which can handle publishability of a component and should also be able to notify the publishability change to its parent.
Continue reading

 

Spree Loyalty Points Extension

Most online stores thrive on customer satisfaction and their loyalty towards their stores. In order to improve the long term relationship with the customers and earn their loyalty, stores come up with different ideas to keep customers engaged. One such idea is to award loyalty points to the customer based on their purchases. These awarded points can be used by customers as a discount in their future purchases.

Understanding the need, we recently published this new extension “Spree Loyalty Points” which adds the loyalty points functionality into the existing e-commerce system. With this extension a new payment method gets quickly added to Spree e-commerce stores. It also automates two features (a) awarding of the loyalty points to the customers on the basis of the configuration done by admin and (b) updating the points based on each transaction done on Spree Commerce platform. It also allow the users to redeem earned loyalty points while placing new orders. Continue reading

 

Cross Compiling FFmpeg with x264 for Android

Recently we were working on a feature where we had to combine an image and audio to create a video on mobile devices. In iOS this can be done using AVAssetExportSessionthough – for detail see this link However, we could not find any native solution for this problem in Android.

FFmpeg is one such tool to tackle this problem but it is not available for Android officially. We tried few existing Android ports of FFmpeg but they were either outdated or didn’t work for us. So we planned to fold our sleeves and compile the library for Android.

Compiling libraries on Linux system is a fairly common task, download the source code of the library and run three commands:

./configure 
make 
make install

As we wanted to use the FFmpeg library on Android devices, we can’t just use the executable generated on the Linux machine directly because Android devices have different CPU architecture, different instruction sets and modified Linux kernel (OS). So we needed to cross compile FFmpeg library for Android

Cross Compilation ?

The process of building executable binaries on one machine, and running them on another machine when the CPU architecture or the Operating System are different is called “cross compilation”.

Continue reading

 

Vinsol Introduces ShopSpree: First iOS App for Spree Commerce

We understand the preferences of shoppers have changed globally. Today, consumers prefer shopping in the most convenient ways: anywhere, anytime and on the move. This changing landscape has given birth to the world of mobile and applications. The statistics prove the increase in mobile internet usage is on the rise, now standing at 65% globally.

ShopSpree0

Around 32% of all online purchases have been done through mobile. Mobile commerce is looking promising, and expects the spending to be $200 billion USD by the end of 2014, reaching an approximate 50% growth from 2013. Predictions indicate that by 2020, smartphones and tablets will account for more than 75% of global online commercial transactions, and more than 50% of spend.

The e-commerce market, which is now enhanced by mobile, is comprised primarily of e-commerce companies that have long held a web presence, but have gained even more with the transition from web to mobile.
Continue reading

 

Bank Transfer Extension for Spree

After we started using Spree for development of e-commerce stores for our clients, we often found the clients looking for different modes for achieving more conversion.

From statistics it was visible that end users need more convenience in their hands while shopping online, particularly in the developing nations where credit card penetration is relatively low. In such environment, Bank Transfer appears to be another practical way by which consumers shopping online can make payments for their order.

Vinsol is SpreeCommerce Premier Partner. View Vinsol’s Services

Bank Transfer or BT, is a payment method which gives user the freedom to do an offline/online transaction to the Merchant’s account directly. The user deposits the amount into Merchant’s bank account, which is specified on the checkout page. The end user, on the other hand, after transferring order amount into Merchant’s account, needs to login and provide the payment transaction details with the specific order. Continue reading

 

Custom model callbacks in RubyOnRails

RubyOnRails provides us with many model callbacks around the object’s lifecycle when object is being created, updated or destroyed. For example: before_create, after_create, before_update, after_destroy etc. We use them to write & run our code around the object’s lifecycle by defining a method and associating them as one of the callbacks.

But then how can we make a piece of code execute as a callback for any another defined method except create, update, save and destroy? For example, let’s say we have a model Article and we want to execute something just before and after an article is being published without hooking into model’s before_save and after_save callbacks?

RubyOnRails or more precisely ActiveRecord provides us with a module ActiveModel::Callbacks, which allows us to define and register custom callbacks using define_model_callbacks method. Lets have a look at the snippet below for the above scenario:
Continue reading

 

Reasons to consider Spree when choosing an e-commerce platform

Don’t select your next e-commerce platform without reading about these 13 factors first.

Online business has become a dominant and growing force. Global sales through e-commerce topped $1 trillion in 2012, with North American and Asia-Pacific nations accounting for nearly 70% of it. Projections are that global e-commerce sales will reach $1.5 trillion in 2016.

“Conduct better due diligence of the platform”

Over 60% of medium to large e-commerce site owners claim they should have done better due diligence on the platform they selected for their store. Much too often do businesses face constrained growth or incur significant losses due to misguided platform selections.

ecommerce-development

If you are ready to sell online, choosing the best e-commerce system for your business can be a challenging and confusing process. Based on our deep expertise of rails e-commerce and Spree development, this blog will help make sense of 13 factors you should be considering for selecting an e-commerce platform for your store and how spree stacks up against the competition on those factors.

1. License
There is no “enterprise” edition of Spree – its all the same software. Enterprise clients, small and medium sized businesses can use Open Source Spree for commercial purpose without paying any license fee.
Continue reading