Hybrid Apps or Cross-Platform? The right strategy for Retail Mobile Apps in 2021

In the digital world of today, it’s impossible to run any business without a mobile application. But developing multiple apps for different platforms is challenging and expensive. 2020 saw a surge in mobile adoption as consumers went mobile to learn, work, and shop to cope up with the pandemic. The spending on mobile apps touched a whopping $143 million indicating a 20% rise as compared to 2019.

But even before the pandemic, popular Dutch lingerie designer brand Marlies Dekkers saw more than 75% of their revenue through mobile. Brands like Nike and many others had already started diversifying business practices to avert the retail apocalypse. Walmart had begun consolidating multiple apps into a centralized one to bring in greater choice and diversity to consumers. Leading eCommerce major Shopify achieved 10 years’ worth of growth in just 90 days. Retailers are having to roll out new features faster in their mobile app experiences while ensuring feature parity across the different platforms. To meet this challenge, popular brands such as Amazon, Apple, Remote POS, and Baskin Robbins have gone the hybrid way.

Enhancing the experience further with cross-platform

A hybrid app is your best bet if you wish to launch your mobile app quickly. According to a recent report, 74% of the top iOS retail apps are hybrid apps. These statistics might defy the conventional wisdom that was once in the favor of native apps for their superlative performance and the seamless user experience. After perfecting the infrastructure built for the web for several years, it didn’t make much sense to rebuild it for mobile. That would duplicate effort and result in a huge loss of time and resources. But then, the game changed altogether with hybrid apps. While offering total value for your investments, hybrid proved to be a smart choice thanks to low-code development tools. A hybrid app would mean 60-80% savings as compared to a native app with a 234% ROI.

But despite being a time and money savior, hybrid does pose a challenge in achieving the ideal UI and UX. These overheads of having to develop separate native apps for iOS and Android are effectively addressed by cross-platform apps that offer an elegant means to code once for both platforms.

Today, there is a growing inclination towards cross-platform apps that ensure feature parity and work equally well for all platforms such as Android, iOS, and Windows. Hybrid apps followed by cross-platform apps have ushered in so much functionality that both strategies are adopted as needed. The world clearly cannot stop raving about cross-platform apps. So if you are wondering if a cross-platform app is right for your retail business, here’s what you should know.

The shift to cross-platform

The truth is that you get to experience just the tip of the iceberg when you download an app. The infrastructure behind the app is evident only after you start using it as you browse through product catalogs, access purchase history, view shipping information, etc. The modern cross-platform apps now respond and react as quickly as their native counterparts providing users everything they need. With a full-fledged native-quality mobile experience, retailers are now jumping onto the cross-platform app bandwagon.

Experience matters

A bad mobile experience will drive away customers. A cross-platform app offers the perfect solution to the changing needs of businesses. It is a single-codebase app created using tools like Flutter, Kotlin, Xamarin, React Native, etc. and common examples of this app include Facebook Ads Manager, Airbnb, Reddit, and Zipcar. Cross-platform app development is now gaining a lot of momentum allowing hybrid mobile app development companies to create cross-platform apps that deliver exceedingly well on the performance front too.

Benefits for migrating toward cross-platform:

  • Efficient use of developer resources – Developers need to maintain just a single code base when building these apps thereby saving a huge amount of time typically required by native apps
  • Maintain Feature Parity across platforms. Brands can ensure common experience and functionality independent of the platform capabilities
  • Faster Time To Market: Once app development teams learn how to handle the OS differences or platform-specific store publication procedures effectively, the design-to-launch time will drastically reduce. Cross-platform apps also enable simpler and quicker updates, a boon considering the speed with which updates keep coming up.
  • Lower development and maintenance cost – They are easy to create and maintain with simple tools that can be used in-house thereby eliminating the need for hiring new talent for the job.
  • Consistent User experience – Due to the cross-platform approach with just one codebase running on desktop, web, and mobile, redundancies across channels are removed ensuring better design and UX consistency across platforms.

Wrapping up

A mobile app is rarely made for just one platform since users would want to use them across devices and platforms. Unlike a native approach that requires separate apps for each mobile platform and sometimes with very specific customization for tablets and smartphones, the cross-platform approach offers adaptive styling to ensure that the look and feel of your retail app automatically adapts to each platform. It enables retailers to reach out to a wider audience while saving cost and ensuring platform consistency. With immense potential, it serves as the perfect gateway to opportunities for custom mobile app development companies. Accelerating your mobile app development with cross-platform therefore makes a lot of sense.

Build with Trigent

As you re-evaluate your Mobile App strategy to address the scale and speed expected by your consumers, consider the Hybrid & Cross Platform alternatives. We, at Trigent, have powered apps for some of the coolest companies out there. We choose the right architecture, the ideal cloud computing platform, and an appropriate technology stack to ensure that the cost of building and maintaining an app is minimal while the experience is seamless. We also pay a lot of attention to security and compliance testing to ensure you get a secure, high-performing cross-functional app.

Embark on a software development journey with our experts. Contact us today to give your retail business a digital high.

Kotlin on Android – Is it Good for Developers?

After the Android team’s announcement of first class support for Kotlin in the Google I/O keynote in 17th May 2017, Kotlin came to limelight and Android developers started thinking of using Kotlin as the programming language instead of Java (ADT).

Kotlin is a statically-typed programming language developed by Jet Brains that runs on the Java virtual machine (JVM) and also can be compiled to JavaScript source code or uses the LLVM (Low Level Virtual Machine) compiler infrastructure. It is designed to interoperate with Java code and is dependent on Java Class Library, such as the collections framework. Kotlin is a fully supported programming language on Android. Kotlin was written by the same folks who created Android Studio, so its background comes from the mobile industry.

According to jetBrains, following are the reasons to use Kotlin for Android development.

  • Concise – Drastically reduces the amount of boilerplate code. More concise than Java. The code looks clean and easy to understand.
  • Interoperability – Use any existing library on the JVM, as there’s 100% interoperability. Target either the JVM or JavaScript.
  • Safe – Prevents more kinds of errors than Java and avoid entire classes of errors like null pointer exception.
  • Simpler – Way simpler than Scala! For a Java developer, getting started with Kotlin is very easy. The automated Java to Kotlin converter included in the Kotlin plugin helps with the first steps.
  • Performance – Compiles as fast as Java.
  • Small footprints – Kotlin has a very compact runtime library, which can be further reduced through the use of ProGuard. In a real application, the Kotlin runtime adds only a few hundred methods and less than 100K to the size of the .apk file. This means Kotlin adds just a little to .apk file size.

Installation:

The Kotlin plugin is bundled with Android Studio starting from version 3.0. If you use an earlier version, you’ll need to install the Kotlin plugin.

  1. Go to File | Settings | Plugins | Install JetBrains plugin…
  2. Then search for and install Kotlin.
  3. You’ll need to restart the IDE after this completes.
  4. After restarting, Android studio will prompt to configure the Kotlin plugin, select the latest version and click OK.
  5. It will again prompt to sync the gradle, click on sync.

Create a Project or convert existing project:

  1. Create a project normally.
  2. If you have existing code and want to convert in Kotlin then press ctrl+shift+A to find action.
  3. Write convert Java file to Kotlin file and press enter or press the shortcut ctrl+alt+shift+K (this will convert only the current file).

Related: Collaboration, Communication & Connectivity for future-ready organizations, leveraging mobility to create inclusivity, speed and cohesiveness.

4. Or start writing code with Kotlin to call methods written in Java or vice-versa as it is 100% interoperable with Java.

Everything is now ready to build the application and run it on an emulator or device. You can make a release or build an APK of the application and sign it similarly. Kotlin compiler produces byte-code, thus there really is no difference in terms of look and feel of Kotlin applications versus those written in Java.

Nice features of Kotlin:

1. Completely Null safe:

Kotlin completely removes null references by making all datatypes non-nullable (by default) i.e. the compiler won’t let you to use a non-initialized, non-nullable variable. To declare the type as nullable, add a question mark after the type. The compiler will enforce a null-check before accessing the variable. This practice drastically reduces bugs.

You can check if it’s nullable variable in two ways.
(a).The first is a traditional if statement:

if (nullVar != null)
 nullVar.fooboo();

(b).The second is with NULL safe call operator:

nullVar?.fooboo()

For example:

println(nonNullVar.substring(0, 3)) //prints first 3 characters
 println(nullVar?.substring(0, 3)) //prints first 3 characters if the string is not null, prints null otherwise

In some cases programmer may need to test the code if it is null pointer exception or not ,or if he knows the variable is nullable. Then he can use it as the compiler will not check for the null, and if it is null then throws null pointer exception.

println(nullVar!!.substring(0,3)) //prints first 3 characters if the string is not null, crashes with a NullPointerException otherwise.

2. Extension functions:

With an extension function, you can call a function from an object as if it were a part of its class. Kotlin lets you extend a class by adding additional functions to it without manipulating the original definition. Such functions are known as extension functions. The names of these functions should be preceded by the names of the classes they extend.

For example, to add an extension function isTeenager to the Student class, you write the following code outside the class:

fun Student.isTeenager(): Boolean {
 // If age falls in the range
// 13-19 return true
 return age in 13..19 //range
}

In Kotlin, it is compiled to a static function that returns a boolean value. You’d call it as if it were a member function, like

var student = Student()
 student.isTeenager()

as if it is a member function of Student class

3. Data Classes:

We all know that most of our apps are data dependent, we often find ourselves creating model classes to hold data. In Java, this can be very tedious task, generating getter and setter functions for each field. With Kotlin, we can declare the class and all its properties in a single line. The compiler will generate all getter and setter functions, as well as the equality members, toString() and a copy() function.

For example, take this in Java:

public class Student{
 private String name;
 private int age;
 public User(String name, int age) {
 this.name = name;
 this.age = age;
 }
 public void setName(String name) {this.name = name;}
 public String getName() {return this.name;}
 public void setAge(int age) {this.age = age;}
 public int getAge() {return this.age;} 
}

To run the same function in Kotlin, all we need is:

data class Student(var name: String, var age: Int?)

You just have to add data keyword before class keyword and the compiler will take care of generating constructor and getter setters.

4. Singleton: Kotlin doesn’t support static member for class. So, how can we create singleton class in Kotlin?

A thread safe singleton design pattern

In Java if it is like:

public class SomeSingleton {
 private static SomeSingleton instance = null; private SomeSingleton(){
 }
 private synchronized static void createInstance() {
 if (instance == null) {
 instance = new SomeSingleton();
 }
 }
 public static SomeSingleton getInstance() {
 if (instance == null) createInstance();
 return instance;
 }
 }

In Kotlin, it is

object SomeSingleton

The object will be instantiated and its init blocks will be executed lazily upon first access, in a thread-safe way as constructors are private and in case programmer need to initialize something.

With an object declaration, you are getting a safe and efficient singleton class.

object SomeSingleton {
 init {
 println("init called")
 }
 }

5. More features that will save you from some more keystrokes:

(a). Type aliases: Assign an alias to any given type. This is most useful for long types with many generic parameters.

E.g.

typealias MofL = Map<String, List> fun useMap(map: MofL) { }

(b). Clicklistners:

Consider this click listener

In Java:

view.setOnClickListener(new View.OnClickListener() {
 @Override
 public void onClick(View v) {
 // perform click event
 }});

In Kotlin:

view.setOnClickListener { // perform click event }

(c). Semi colons: It is sufficient for Kotlin to sense the end of the statement through a line break. So if you forget to add semicolon at the end of the line, it’s okay!

(d). Constructors: Kotlin’s syntax to create a constructor is very compact. You don’t need to write a constructor separately to initialize member variables but you can add it to the class header only like in the example shown:

class Person(var name: String, var age: Int, var school: String?) {}

If you don’t need to write anything in class then you don’t even need curly braces.

You can add other constructors as well and are known as secondary constructors but you have to delegate it to the primary constructor using this keyword.

constructor(name: String, age: Int, school: String?, email: String) : this(name, age, college) {
 this.email = email
 }

Limitations:

Whenever a new programming language is launched, it takes some time to get into the market. When Kotlin launched, it wasn’t as mature and proper as it is now. Looking at the limitations, as it is new in town, you will not get proper tutorials and learning stuff. Programmers who already worked with Java can pick up Kotlin in a day just by going through the documentation. Kotlin has its own library that will be added on top of Java’s standard library, so file’s build size increases by 100kb and gradle build also takes little more time.

Conclusion:

So you can saw that Kotlin doesn’t have any ground breaking characteristics. While the goal was not to create something revolutionary, but to provide something that is usable and familiar to modern enterprise developers. Kotlin helps us in avoiding some common pitfalls which are common with Java like null references, which increases code efficiency and product quality and it is 100% interoperable with Java.

The What, When & Why of Mobile Interrupt Testing

Read an overview of mobile app testing.

Mobile Interrupt Testing is a form of mobile application testing that deals with the behavior of an application when it is interrupted in the foreground and resumes to a state before the interruption.

Interrupt Testing, on the other hand, applies to any application type, i.e. web, mobile, stand-alone, etc. However, the variety of devices, networks, configurations, etc. makes this form of testing appropriate for mobile applications.

What is Mobile Interrupt Testing?

We all have our daily interruptions in day-to-day life. Consider a real-life example of being interrupted by a call when reading a newspaper. Some of us may notice the call, ignore it and continue to read the paper, some see the call, acknowledge it, and continue reading, a few more might attend the call, and then resume reading the paper. However, in all the above instances, one’s thought process when reading the paper has been interrupted or lost. To translate this to mobile technology, Interrupt Testing tries to find out which behavior your application exhibits when an interruption occurs.

Given below are a few examples of interruptions in smartphones:

  • Battery low
  • Battery full – when charging
  • Incoming phone call
  • Incoming SMS
  • Incoming alert/push notification from another mobile application
  • Plugged in for charging
  • Plugged out from charging
  • Device shut off
  • Application update reminders
  • Alarm or calendar reminders
  • Network connection loss
  • Network connection restoration

This list is not exhaustive and only includes the most common scenarios.

Before we move on let us understand the phrases, ‘application running in the foreground’ and ‘application running in the background’.

The application running in the foreground is the app on which the user has direct control and which will be seen on the smartphone screen.

Background applications are those apps running on the smartphone but on which the user will not have direct control until it is brought to the foreground. Apps running in the background are expected to resume to the last controlled screen/action when called to the foreground.

Usually, an app goes to the background when we open multiple apps and then we toggle between apps based on our need without closing/quitting the app. The app which is in the background will be using the memory of the phone till it is quit by killing.

The application needs to handle the interruptions adequately to meet user requirements. The expected behavior of an app for these interruptions might resemble the following:

  1. Run in the background: The interruption takes over while the application goes to the background. It gains control after the interruption ends. For example, A phone/WhatsApp/Skype call that you attend while you are reading/playing a game on the smartphone. When the call ends the game or the activity you were involved with, should resume to the state it was in, before the interruption.
  2. Show alert. Alert disappears, and you work as usual. ‘SMS received’- messages appear in the header. The user does not bother about it and continues working with the application as normal. Other mobile app alerts, such as a new friend request on Facebook or WhatsApp messages, also fall into this category. But if the user decides to read the message, the behavior described in Point 1 is followed. If ignored, the application’s state is unchanged.
  3. Call to Action: Alarms have to be turned off or snoozed before you continue working. The same thing applies to app update messages. You either have to ‘Cancel’ or ‘Accept’ the changes before you proceed. Another example is that of the low battery alert – You can choose to continue as usual or go into a low power mode (if the device allows it).
  4. No impact: An example is: if a network connection becomes available and your device connects to it. Also, when you plug your device in for charging, no alert or call to action step is necessary. It will probably do its job while you continue using your application.

Thus, depending on the interruption you are testing for, understand the behavior, and see if your application satisfies it.

Also, the behaviors described above need not be the same for all applications and devices. Be sure to find out specific details about your particular Mobile App.

Now that we understand what Interrupt Testing is and what to validate when conducting it, it is time to talk about how to do it.

How to Conduct Mobile Interrupt Testing

Look at this scenario: Google Chrome or any browser app for that matter has to run in the background when the user receives an incoming phone call.

Would you not call this a functional requirement of the google chrome app? I know, I would.

So, Interrupt Testing is a subset of Mobile Application Functional Testing. And, to conduct Interrupt Testing, you would follow the same Mobile Application Test Frameworks and Tools. It is the skill of the tester to conceive these scenarios. Once done, you would design the test cases and execute them in the same way as any other test. And do not get confused with the interrupt testing with the recovery testing. The recovery Test is to validate the restoration from a failure. Interrupt Testing is not necessarily a failure. It is a mere distraction.

The need for interrupt testing with various scenarios is very much necessary in this mobile app enriched world where competition between similar apps is at its peak. The best app with excellent usability is always talked about, referred to, and chosen by users.

Need help with your mobile application testing requirements? Trigent’s experienced quality assurance and testing team ensure your product is market-ready within stipulated timelines.