Challenges in Cross-platform Mobile App Development That I Wish I Knew Before

There’s a buzz around cross-platform mobile app development lately. From start-ups to entrepreneurs, everybody’s looking into the potential of cross-platform frameworks. While many are enticed with the speed of development and simplicity of having to manage a single code base, wider reach is a big draw for companies.

What’s tricky is that the mobile app development landscape is constantly evolving, with new frameworks and updates constantly being added. Ionic apparently is not great for gaming apps, while React Native is just not what you would want for large products or heavy industry applications. Flutter is the youngest, yet very powerful and popular platform. So how do you determine the way forward? While the choices can be overwhelming, you will need a perfect solution for your business yet not too much for your development teams to handle. 

The shift from native to cross-platform development may make good business sense, but you should be ready with hard facts to know it’s worth diving into. You will have to ask the right questions, understand things from a developer’s perspective without losing sight of your business objectives. A developer will be more inclined to choose a framework based on ease of development, programming language prerequisites, and the libraries offered. However, the organization may be keen on having something agile, effective, cost-efficient, and easy to maintain.

Cross-platform solutions for mobile app development

Cross-platform mobile app development continues to offer countless benefits to developers and users alike. User engagement with an app often depends on the ease of use associated with app navigation. Intuitive user experience increases the popularity of an app and, in turn, leads to better conversions. If you are battling with the native versus cross-platform dilemma to deliver fluid user experiences, you are not alone. 

While native and cross-platform strategies are strong contenders, cross-platform are gaining popularity and mobile time with apps that promise consistent user experience across mobile platforms, smoothness, efficiency, and flexibility. What’s more, they are a huge help while integrating phone functions and ensuring shorter time-to-market. A report by Statistica1 suggests Flutter is the most popular cross-platform mobile framework used by 42 percent of software developers, followed by React Native in popularity.

Things are often easier to manage at the start, with few features and user requirements. As the apps scale, new features are added and user needs grow, the development complexities and operational limitations emerge.  A classic case in point is Airbnb, which decided to invest in React Native to enhance agility and experience. In its post on Medium, the company highlighted the challenges they faced and called it immature compared to native iOS and Android. They grappled with JavaScriptCore inconsistencies, maintenance issues, and other challenges they were least prepared for, ultimately deciding to go back to native.

Native apps promise superlative performance since they are created for a particular platform and are fast and responsive. But developers need to code in 2 different languages for Android and iOS. Maintaining feature parity and consistent user experience across the two code bases is the biggest challenge – Invariably, there are situations where some features are available on Android, but not iOS, and vice versa. Version management and feature upgrades are doubled with 2 independent code bases. 

So how would you know if choosing cross-platform would be the right decision for your business?

Cross-platform solutions for mobile app development would be great for you if:

  • You need to target a large user base via multiple platforms.
  • If you wish to build it with a small team of developers using a single codebase. 
  • You want to build an app quickly and ensure that it hits the market fast.
  • You want an app that can be amended easily for changes and updates. 
  • You wish to save money with reusable codes that save development time as well as cost.
  • You want flawless cloud integration for better compatibility and versatility.
  • The app does not require high-performance access to device resources like GPS, camera, accelerometer, etc. unlike gaming and AR/VR apps.

Of course, there will be challenges, but none that cannot be fixed with proper preparation in the planning and design phase. 

Some of the top challenges include:

Coding issues in cross-platform mobile app development

Developers often use JavaScript objects for cross-platform frameworks that cause issues while using reusable codes. Finding and fixing issues in the entire code becomes an arduous task that eventually increases the development time as well as cost.

Also, there is the problem of slow code. It happens when inexperienced developers resort to cross-compliance while developing cross-platform apps. This results in sluggish code and a slower application.

A lengthy integration process

While using cross-platform, the integration process with local settings can take a long time. This further increases the development time. The integration issues with certain operating systems often impede performance due to the lack of compatibility between the native and non-native components of different devices.

User experience (UX) concerns

While cross-platform aids in ensuring feature parity and user experience, access to device-specific resources involves overheads. This slows the app load time and dampens the user experience. App abandonment is a major concern and the inability to deliver the perfect UX can be detrimental. As per Statistica2, 25 percent of the apps downloaded by users worldwide were accessed only once.

 Limited updates

The operating system may not always support all the features of a framework and thus affect the overall experience. For instance, every time there is an iOS update or a new feature gets added, you can use it only after updating the iOS version of your app. But until Google releases the same update or feature, you will not be able to update the Android version.

Security

Every app is vulnerable to cyber-attacks. While frequent updates give native apps the power to rectify loopholes, cross-platform apps struggle on the security front due to limited updates. Organizations that need to deal with colossal amounts of business data on a daily basis, therefore, are less inclined to use cross-platform apps. Cross-platform app development companies are now relying on cutting-edge tools and architecture to address this issue and enhance the security of their apps.

Understanding the unique challenges of iOS and Android

When considering native application development, companies must have the right skills. Both iOS and Android apps are expected to be identical in looks, functionality, aesthetics, and experience but the structural building blocks of both these applications are completely different. Besides, these apps need to be built for different devices and need very experienced developers to build flawless apps. Apps are being used on smartphones, laptops, and tablets which means the challenge is not limited to multiple operating systems but involves varying screen sizes too.

It is important to look into their user interface (UI) and user experience (UX) peculiarities and understand the acceptance criteria laid down by official app marketplaces. Apple is known for having very strict guidelines to ensure a certain look and feel of iOS apps. Apps that fail to adhere to these guidelines are often rejected by the App Store. On the other hand, Google Play Store despite not being so rigid does not offer much relief either. This is mainly because Android users are accustomed to a certain level of experience and performance from their apps and anything that strays from these de facto levels is likely to get low ratings.

Even UI rendering and hardware features for both these platforms differ. Each OS renders UI standards differently and calls for unique coding approaches. Having one codebase to manage all these requirements can be extremely challenging. Hardware features too are realized differently and each feature will work differently on multiple platforms. While a certain feature may be accessible on one platform, it may not be on another. The fact that both Android and iOS are constantly evolving further adds to the challenge of forcing developers to play catch-up all the time.

A robust team of developers that has adequate experience in using modern tools and frameworks can however build the perfect cross-platform app despite all these challenges. You need to determine the essential features you would like to include in your app based on customer needs and then work on other aspects such as timelines and budget.

The cross-platform mobile app development frameworks dilemma 

Among the many cross-platform frameworks available today, React Native, Flutter, Xamarin, and Ionic are some of the most popular ones. Greater device compatibility and faster development make them a dependable choice for building enterprise-grade apps.

The biggest challenge for a developer however is choosing the right cross-platform framework, especially since there are many distinct pros and cons.

Alibaba and Google Ads, for instance, use Flutter for their apps. It supports Android, iOS, Windows, and Mac, and its architecture is based on reactive programming. But it comes with limited libraries and extensive application size. React Native, on the other hand, used by Facebook and Skype, comes with native functionalities and platform-specific code. However, its navigation is not as seamless as Flutter.

Companies like Pinterest and Slack rely on Xamarin which complies with native code for better performance and experience. But it has platform-specific limitations that hinder multi-touch functionality and platform-specific gestures. 

Others like Node.JS, Ionic, NativeScript, PhoneGap, and Sencha Touch are distinct and useful. It takes an expert to know what’s best for your unique business objectives.

Cross platform development services – Work with experts

If the whole idea of developing an app is overwhelming for you, you may consider partnering with app development experts. There will be crucial decisions to make both before and during app development. For instance, with windows becoming passé, how equipped is your app to serve Android and iOS users? Cross-platform technologies like Flutter, React Native, and Xamarin are all very popular, which one’s right for you? 

You need a development partner who not only understands app development but also your market to give you a competitive advantage. The experienced ones know exactly how to optimize to save costs. For example, the Facebook mobile app merely extends the same set of features as its web counterpart.

The development partner you choose can do the same for your company by extending your existing software’s logic and components to your mobile app using APIs. This ensures a consistent connected customer experience while keeping the development cost low.

 Build high-performing Omnichannel apps 

Enterprises are aware of the role apps play in augmenting their business revenue. You need a large user base to do so, and that will happen only when you are able to reach a broader audience in cost-effective ways with an app that offers excellent performance and experience. Industry experts believe cross-platform apps ensure a better reach. 

The only way to build a high-performing cross-platform app is to research, analyze, and choose the proper framework. What’s easier is to reach out to experts who know the app landscape like the back of their hands.

Build your app and customer base with Trigent

Trigent has been a tech partner for several organizations in diverse sectors offering unique solutions tailor-made for them. We leverage advanced tools and technologies to keep you on top of your game. 

We can assist you too in building your app to increase customer acquisition while minimizing development costs. 

Call us today for a business consultation

Keychain – An effective way of securing sensitive information on iOS mobile apps

Mobile devices are a significant propellant for modern-day digital technology. Mobile devices are compact and the quickest mode to establish instant communication, eclipsing long distances. The underlying element that enables this exchange between individuals using their mobile devices is data. It is data exchanged between two or more devices that make communication or any other activity possible.

The digital mobile technology baseline is a vast data collection, stored either locally or remotely, sharing numerous information fields for multiple purposes. Flexible Image Transport System or FITS is a digital file format useful for storing, transmission, and processing data that in common parlance refers to information or data related to people such as photos, audio, video, text formats, travel itineraries, or shopping details. Private data can never be seen in a silo. It has to coexist with privacy policies that ensure optimal data security.

Mobile devices are inevitable in modern life, and securing mobile data is a critical concern in a digitally-driven world for quite. While there is increasing awareness among individuals to safeguard their data, cybercriminals are always on the lookout for loopholes. There are umpteen safeguards in place to thwart cybercrime, but the slightest of negligence can be an invitation to trouble such as phishing or data theft.

This post is a DIY for iOS developers to enable Keychain wrapper to secure small chunks of data on applications and secure services.

Before we get into the nitty-gritty of setting up a keychain wrapper for your iOS app, here’s what Apple has to say about the keychain wrapper API.

‘The keychain services API helps you solve this problem by giving your app a mechanism to store small bits of user data in an encrypted database called a keychain. When you securely remember the password for them, you free the user to choose a complicated one.

Keychain – An effective way of securing sensitive information on iOS mobile apps

Keychain wrapper can be considered to be one of the most secure technologies to store sensitive data, such as passwords, authentication tokens, or session data. Its security stems from the automatic encryption of data that is enabled before the file is stored in the system without the need of building encryption algorithms.

Following are the details on how to use keychain wrapper in mobile application development.

Install SwiftKeychainWrapper framework either by cocoapods or carthage. Sample code for few of the common usages are as follows

Add data value to keychain:
let saveThe Data: Bool = KeychainWrapper.standard.set(“Some String”, forKey: “myKey”)
Retrieve data value from keychain:
let retrieveTheData: String? = KeychainWrapper.standard.string(forKey: “myKey”)
Removedata value from keychain:
let removeTheData: Bool = KeychainWrapper.standard.removeObject(forKey: “myKey”)

Developers can do the following in Keychain Wrapper:

“Service Name” – used to customize bundle identifier value. By default, app Bundle ID is used to store the data in keychain
Data can be shared between applications using keychain by “Access Group”
By default, all items saved to keychain can only be accessed when the device is unlocked. To change this accessibility, an optional withAccessibility param can be set on all requests to select the accessibility level desired
To access the data in keychain in all the different devices used by the users, we can synchronize the data in iCloud
Unlike “User Defaults” – Data stored in Keychain will not get deleted while app cleared from cache (or) uninstalled from the device

Are you looking at developing an iOS application with robust security features? Trigent’s expert developers with decades of experience in iOS app development can help you with end to end development of secure and robust applications. Here’s a solution that was developed with an emphasis on personal data security.

Twitter propels its mobile business using progressive web apps

Pattern of app usage among users – prevailing scenario

The smartphone user base has experienced an exponential boom in the past few years to reach 2.97 billion users worldwide. A recent study notes that an average US adult spends about 3 hours 10 minutes on his phone every day. 90% of mobile time is spent on applications. The increase in smartphone users and their usage pattern indicates that the mobile screen is the more preferred screen than the computer. The usage pattern is also a clear indicator that businesses vying for their customers’ attention must adopt a mobile strategy.

The world of native applications – challenges galore

Though users spend 90 percent of their mobile time on applications, they are quite picky. Users spend 77% of their time on only three apps. What’s more, 96% of that time is spent on their ten favorite apps. The interest in applications makes the mobile application space highly competitive. The chunk of these applications is native applications primarily categorized into Android or iOS apps. Statista 111 thousand applications are released on the Google Play Store every month, making it the most prominent online store for applications. Following toe is the Apple App Store, which has an approx 1.8 million applications available for download. The numbers are proof of the stiff competition applications face to garner interest among users and survive. Besides the stiff competition, many other reasons can sometimes weigh against building a native application. One of the foremost considerations a business looking to upgrade their mobility capabilities the native way has to address is cost followed by compatibility. Native applications are platform-specific as they are developed for a specific platform, either Android or iOS, and can limit your reach to a particular platform user set. Maintenance and upgrades can again have a significant impact on your spending.

A progressive mobile experience – the solution

Progressive Web Apps – PWA has been a boon for businesses trying to make immense in the mobile age. A PWA is built and lives on the web but has capabilities similar to the native apps. The look and feel or how the app behaves is quite similar to native apps.

Progressive web apps provides easy optimization of your website to enable mobile experience for your users irrespective of the platform. It renders a seamless experience across iOS and Android platforms and does not require uploading on any app stores. This also eliminates the need for users to install updates on their phones. Every time there is a new version of the app, it just needs to be deployed on the webserver and is automatically available to the users when they visit next.

Benefits

World-renowned businesses utilizing PWAs are reaping some impressive benefits that demonstrate that PWAs are an excellent proposition for online entities looking to initiate their journey and association with their users on their mobiles. Businesses are looking at an economical solution to make their foray on the mobile or companies already having a native app but looking to expand their reach using a web-based mobile app.

The following compilation lists out the businesses that have adopted progressive web apps to garner impressive gains.

Renowned publisher – Forbes

Renowned Publisher

Headquartered in New York, Forbes is an American business biweekly. Steve Forbes is the editor-in-chief of the widely recognized magazine. Two of its distinct offerings are the Forbes 400 that lines out the richest people in the world and Forbes 500 that lists out the top performing companies in the world. Forbes launched its mobile PWA couple years ago and has experienced a favorable outing.

  • 0.8 seconds average load time, faster loading
  • 100% increase in user engagement
  • 43% more time spent in user session
  • Increase in scroll depth by 3 times
  • Advertisement views up by 20%
  • Average size of web pages reduced from 2MB to 30KB

Social media biggie – Twitter

Microblogging Site

A popular microblogging platform launched in 2006, Twitter is the second most successful social media platform after Facebook. Twitter introduced Twitter Lite, a PWA variant for smartphone users. An optimized version of the app Lite requires less data and storage space and loads quicker even on slower connections. The app occupies 1 Mb space on the device.

  • 65% increase in pages per session
  • 75% increase in tweets
  • 20% decrease in bounce rate
  • Loads quickly on 2G and 3G networks
  • Enables optimal utilization of data by only downloading content that the users clicks on
  • Significantly smaller size of the PWA app at 600 Kb compared to the size of the 23.5 Mb native app

Global coffee house chain – Starbucks

Global Coffee House Chain

Starbucks, an international coffee house chain and a popular brand, wanted to create a web based application. An app with dynamic functionalities and a native feel. They wanted to integrate a user-friendly ordering that could be seamlessly accessed through a url without having to install the app. Starbucks foresightedness to invest in a progressive app provided it with some healthy benefits.

  • High on performance, intuitive app for its users
  • Ability of the app to function across regions with low or inconsistent internet connectivity

There are many other international businesses that have benefited going the PWA route. You can read about them here. Do you know of a business that has benefited immensely using progressive web applications? Share it with us in the comments section.

The progress of PWA (Progressive Web Applications) mobile apps

The first part of a two blog series on Progressive Web Application introduces the easily adaptable and popular PWA and a very distinct history behind it. It also lines out the future and advantages of the web-based application. The second blog post will line out the adoption of PWAs among some of the recognized businesses and the benefits they have incurred.

The two blog posts will help digital business owners make up their mind on utilizing PWA to either make a foray into the mobile screens of their user base or complement their native app offering to reach out to a wider audience.

The first time the idea of Progressive Web Applications (PWA) was coined way back in 2007. Albeit, it was not christened PWA then. At the launch of the iPhone, the legendary Steve Jobs shared his idea of web apps developed in HTML5 using AJAX architecture that would be fully integrated into the device through the safari browser engine.

In 2015 Frances Berriman and Alex Russell, senior engineers with Google, observed a new class of websites providing a better user experience than traditional web applications. These applications rated high on user experience were independent of the browser tab and lived on their own while maintaining their ubiquity and linkability. Berriman and Russell named this new breed of applications as Progressive Web Applications.

Eric Bidelman, Senior Staff Developers Programs Engineer, introduced PWA at the Google I/O event in 2016.

The potential of PWAs can be gauged in the fact that two of the world’s biggest tech rivals Microsoft and Google, joined hands to make room for the technology.

Since becoming a widely recognized term in technology, PWA’s have made rapid strides towards widespread acceptance. Apple Inc., whose founder had first proposed web-based mobile applications, is actively pursuing it but calling it by a different name. They use the term: “HTML5 Apps” and “Home Screen web apps” instead.

Inside PWAs

A PWA is built and lives on the web but has capabilities similar to the native apps. Be it the look and feel or the way the app behaves it is quite similar to native apps.

A progressive web application leverages the website, adds some extra features that enhance the web properties to drive capabilities on mobile. In technical parlance, that would mean serving your web site over HTTPS and having a service worker and manifest.json file to turn your website into a PWA.

A service worker or a JavaScript enables the website to function in the absence of an internet connection. The service worker acts like a proxy server and acts as a bridge between the browser and the network and helps intercept network requests and serve custom responses.

PWA – How it works

PWA provides easy optimization of your website to enable mobile experience for your users irrespective of the platform. Simply put it renders a seamless experience across iOS and Android platforms and does not require uploading on any app stores. This also eliminates the need for users to install updates on their phones. Every time there is a new version of the app, it just needs to be deployed on the webserver and is automatically available to the users when they visit next.

PWAs are in demand and for legit reasons

Talk of PWAs and the discussion invariably steers towards a comparison between a native application and PWA capabilities. Listed below are a few factors enticing businesses to take a plunge into the mobile-first world with a PWA. It also is a viable option for businesses looking to complement their existing native application to expand their reach across devices and platforms.

  • Truly progressive: PWAs work for every user irrespective of the browser or the platform because the base is built with progressive enhancements.
  • Highly responsive: Progressive web applications are highly responsive and seamlessly adapt to the various screen sizes be it desktops, different mobile devices, and tablets.
  • Closely replicating native apps: The user experience and interface match up to that of native applications.
  • Easily and regularly updated: The process of running updates is convenient thanks to the data update process offered by service workers.
  • Secure: As PWAs run through HTTPS, it ensures safety in content delivery and content interaction.
  • Searchable: Indexed by search engines PWAs show up in Google search results.
  • Installable: Installing PWA applications is an easy affair as it does not require users to download it from the app store or play store, consuming little space.
  • Linkable: A clickable link is all it takes to install or share the application among users.
  • Offline functionality: PWAs work without the internet connection leveraging data cached from the last instance the user interacted with the application

We are confident that with the evolution of PWAs there will be many more benefits that may come to the fore. Are there benefits or interesting facts about PWA that you have come across and would like to share with us? Drop it here in the comments section.

Read the next blog on the adoption of PWAs among some of the recognized businesses and the benefits they have incurred.

How to Programmatically Make your Android Phone Look Like an iPhone

In Android Operating System (OS) based on mobile phone or devices, the UI screen that appears first after the user presses the ‘Power on’ button is called the “Android Launcher Screen”. It is possible in Android to construct a custom launcher application, which can be used as a replacement for the default launcher application that comes along with Android phones. Unlike the iPhone, this is one of Android’s best features which lets you design your phone’s interface.

Android Launcher concept

The Launcher falls into one of two categories: ‘design’ or ‘smart’.

Design launchers focus on User Interface. You can change the entire layout of your Android phone’s home screen, application icon shape, icon drag and drop concepts, image gallery etc. You can customize everything it has to offer, including the themes, animations, layout, shortcuts and colors. Some of its interesting features include unlimited scrolling, customize app drawer layout, download-able themes and widget customization.

Smart Launchers learn the most relevant information about you which can be your wake up time, head out on your commute, work at the office, most favorite spot of city etc. You also can add custom gestures to your phone such as double-tapping the screen to open a specific application, web-page or specific setting.

Requirement

You need to have the following installed and configured on your development machine:

  • Android SDK and platform tools
  • Android Studio
  • An emulator or Android device running Android 2.2 or higher

Project Manifest.xml File Modification

In manifest.xml file add two activities. First activity displays the home screen and the second activity needs to display the applications that are installed on user’s device. It is also responsible for launching the installed applications. We don’t need any special configuration for this Activity.

Add the following two categories in Manifest.xml file to the intent-filter group. This intent-filter is associated with the Activity.

 <category android_name="android.intent.category.HOME" />
 <category android_name="android.intent.category.DEFAULT" />

We also need to set the android:launchMode to “singleTask” to make sure that only one instance of this Activity is held by the system at any time. To show the user’s wallpaper, set the theme to

android:theme=”@android:style/Theme.Wallpaper.NoTitleBar.Fullscreen”

 <activity
 android_name="ah.hathi.simplelauncher.HomeScreenActivity"
 android_label="Simple Launcher Home"
 android_theme="@android:style/Theme.Wallpaper.NoTitleBar.Fullscreen"
 android_launchMode="singleTask"
 android_stateNotNeeded="true">
 <intent-filter>
 <action android_name="android.intent.action.MAIN" />
 <category android_name="android.intent.category.HOME" />
 <category android_name="android.intent.category.DEFAULT" />
 </intent-filter>
 </activity>

Add one more activity in Manifest.xml file for displaying the applications that are installed on user’s device.

<activity
 android_name="ah.hathi.simplelauncher.AppsListActivity"
 android_theme="@android:style/Theme.NoTitleBar.Fullscreen" > </activity>

Launcher Main Activity Layouts

Add UI design code in Activity_HomeScreen.xml file. Here layout has a single Button that responds to click events. Clicking the button takes the user from home screen to the list of applications.

<RelativeLayout xmlns_android="http://schemas.android.com/apk/res/android"
 xmlns_tools="http://schemas.android.com/tools"
 android_layout_width="match_parent"
 android_layout_height="match_parent"
 tools_context=".HomeActivity" >

<Button
android:id=”@+id/home_screen_apps_button”
android:layout_width=”wrap_content”
android:layout_height=”wrap_content”
android:layout_alignParentRight=”true”
android:layout_alignParentTop=”true”
android:layout_marginRight=”10dp”
android:layout_marginTop=”10dp”
android:text=”Show Apps”
android:onClick=”showApps”
/>
</RelativeLayout>

Next is to create an XML file for the AppListActivity class in the project’s res/layout folder and name it as activity_apps_list.xml. The layout contains a ListView that takes up the entire screen.

<?xml version="1.0" encoding="utf-8"?>
 <LinearLayout xmlns_android="http://schemas.android.com/apk/res/android"
 android_layout_width="match_parent"
 android_layout_height="match_parent"
 android_orientation="vertical" >

<ListView
android:id=”@+id/apps_list”
android:layout_width=”match_parent”
android:layout_height=”match_parent”
>
</ListView>

</LinearLayout>

Finally, create a third XML file in the same location and name it as list_item.xml. This file defines the layout of an item in the ListView

 <?xml version="1.0" encoding="utf-8"?>
 <RelativeLayout xmlns_android="http://schemas.android.com/apk/res/android"
 android_layout_width="match_parent"
 android_layout_height="match_parent"
 android_padding="10dp"
 >

<ImageView
android:id=”@+id/item_app_icon”
android:layout_width=”wrap_content”
android:layout_height=”wrap_content”
android:layout_alignParentLeft=”true”
android:layout_centerVertical=”true”
/>

<TextView
android:id=”@+id/item_app_label”
android:layout_width=”wrap_content”
android:layout_height=”wrap_content”
android:layout_toRightOf=”@+id/item_app_icon”
android:paddingLeft=”10dp”
/>

<TextView
android:id=”@+id/item_app_name”
android:layout_width=”wrap_content”
android:layout_height=”wrap_content”
android:layout_below=”@+id/item_app_label”
android:layout_toRightOf=”@+id/item_app_icon”
android:paddingLeft=”10dp”
/>

</RelativeLayout>


Implementing the HomeScreenActivity Classes

With the layouts of the application created, it is time to create two Activity classes. When creating the two classes, make sure the name of each class matches the one you specified in the project manifest file earlier.

Create a new class named HomeScreenActivity and set android.app.Activity as its superclass.

Add this code in your HomeScreenActivity class or your main Activity class in onCreate method.

selectButton.setOnClickListener(new View.OnClickListener() {
 @Override
 public void onClick(View view) {

Intent i = new Intent(this, AppsListActivity.class);
startActivity(i);

}
});


We create an Intent for the AppsListActivity class and start it.

AppsListActivity Class

Create another Activity class named AppsListActivity and set android.app.Activity as its superclass. In the class’s onCreate method, we invoke setContentView, passing in the activity_apps_list layout we created earlier.

import android.app.Activity;
 import android.content.Intent;
 import android.os.Bundle;
 import android.view.View;

public class AppsListActivity extends Activity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_apps_list);
}

}

AppDetail.java class file

Create a class named AppDetail that will contain the details of an application, its package name, label, and application icon. The interface is pretty basic as you can see below.

public class AppDetail {
 CharSequence label;
 CharSequence name;
 Drawable icon;
 }

Fetching installed Applications

In the LoadApplication method of the AppListActivity class, we use the queryIntentActivities method of the PackageMangaer class to fetch all the Intents that have a category of Intent.CATEGORY_LAUNCHER. The query returns a list of applications that can be launched by a launcher. We loop through the results of the query and add each item to a list named Apps.

private PackageManager manager;
 private List<AppDetail> apps;

private void loadApplication(){

manager = getPackageManager();
apps = new ArrayList<AppDetail>();

Intent i = new Intent(Intent.ACTION_MAIN, null);
i.addCategory(Intent.CATEGORY_LAUNCHER);

List<ResolveInfo> availableActivities = manager.queryIntentActivities(i, 0);
for(ResolveInfo ri:availableActivities){
AppDetail app = new AppDetail();
app.label = ri.loadLabel(manager);
app.name = ri.activityInfo.packageName;
app.icon = ri.activityInfo.loadIcon(manager);
apps.add(app);
}
}

List of Applications

The Apps variable containing all the details we need, we can show the list of applications using ListView class. We create a simple ArrayAdapter and override its getView method to render the list items. We then associate the ListView with the adapter.

private ListView list;
 private void loadListView(){
 list = (ListView)findViewById(R.id.apps_list);

ArrayAdapter<AppDetail> adapter = new ArrayAdapter<AppDetail>(this,
R.layout.list_item,
apps) {
@Override
public View getView(int position, View convertView, ViewGroup parent) {
if(convertView == null){
convertView = getLayoutInflater().inflate(R.layout.list_item, null);
}

ImageView appIcons = (ImageView)convertView.findViewById(R.id.item_app_icon);
appIcons.setImageDrawable(apps.get(position).icon);

TextView appLabels = (TextView)convertView.findViewById(R.id.item_app_label);
appLabels.setText(apps.get(position).label);

TextView appNames = (TextView)convertView.findViewById(R.id.item_app_name);
appNames.setText(apps.get(position).name);

return convertView;
}
};

list.setAdapter(adapter);
}

ListView OnClickListener Method for List item

When the user clicks an item in the ListView, corresponding application will be launched by our launcher. We use the getLaunchIntentForPackage method of the PackageManager class to create an Intent with which we start the application.

private void addonClickListener(){
 list.setOnItemClickListener(new AdapterView.OnItemClickListener() {
 @Override
 public void onItemClick(AdapterView<?> av, View v, int pos ,long id) {
 Intent i = manager.getLaunchIntentForPackage(apps.get(pos).name.toString());
 AppsListActivity.this.startActivity(i);
 }    
 });<br > }

Putting It All Together

We need to invoke loadApplication, loadListView and AddClickListener in the onCreate method of AppsListActivity class as shown below.

protected void onCreate(Bundle savedInstanceState) {
 super.onCreate(savedInstanceState);
 setContentView(R.layout.activity_apps_list);

loadApplication();
loadListView();
addClickListener();
}

Conclusion

Build and run your application once more to see the result. You should now be able to see the applications that can be launched when you click a button on the home screen of our launcher. Click on an item to launch the corresponding applications. That’s it! Now, try to mimic the UI look and feel of iPhone in your launcher application as you have got complete control over everything!

Here’s a quick read to help you update Android apps outside of Google Play.