Category: Mobile App Development

AI Pair Programmer - CIO Guide

Accelerating IT Development with AI Paired Programming: A CIO’s Guide

Accelerating IT Development with AI Paired Programming: A CIO’s Guide

Pair programming is a technique where two programmers work together on the same code, one writing the code and the other reviewing it. Pair programming can improve the quality, efficiency and creativity of software development, as well as enhance the skills and satisfaction of the programmers.

However, pair programming also has some challenges, such as finding a compatible partner, coordinating schedules and communication styles, and dealing with conflicts and distractions. Moreover, pair programming may not be feasible or desirable for some projects or tasks that require more individual work or privacy.

This is where Artificial Intelligence (AI) can come in handy. AI can act as a virtual pair programmer that can assist you with various aspects of software development, such as:

Code completion: AI can suggest relevant code snippets or fill in missing parts of your code based on the context and your preferences.

Code review: AI can analyze your code for errors, bugs, style issues, security vulnerabilities, performance bottlenecks, and best practices, and provide feedback and suggestions for improvement.

Code refactoring: AI can help you restructure your code to make it more readable, maintainable, reusable, and scalable, by applying design patterns, renaming variables, extracting methods, simplifying expressions, etc.

Code testing: AI can generate test cases and test data for your code, run automated tests, and report the results and coverage.

Code documentation: AI can generate comments and documentation for your code based on its functionality and structure.

Code generation: AI can create new code from scratch or from natural language specifications or examples.

By using AI as a pair programmer, you can benefit from:

Increased productivity: AI can help you write code faster and more accurately, by reducing the cognitive load and the need for manual work.

Enhanced quality: AI can help you improve the quality of your code by detecting and fixing issues early and enforcing standards and best practices.

Improved learning: AI can help you learn new skills and technologies by providing guidance, feedback, and examples.

More creativity: AI can help you explore new ideas and solutions by generating alternatives and variations for your code.

More flexibility: AI can adapt to your preferences and needs, and work with you anytime and anywhere.

Using AI as a pair programmer can be a rewarding experience that can boost your software development skills and outcomes. However, you should also be aware of the limitations and challenges of using AI in this context. For example:

Trust: You should not blindly trust the suggestions or feedback from AI without verifying their correctness and suitability for your project. You should also be aware of the potential biases or errors that may affect the performance of AI.

Communication: You should communicate clearly and explicitly with AI about your goals, expectations, and preferences. You should also provide feedback to AI to help it learn from your behavior and improve its service.

Ethics: You should respect the ethical principles and guidelines for using AI in software development. You should also consider the social and environmental impacts of your code and how it may affect other stakeholders.

Using AI as a pair programmer is an exciting opportunity to leverage the power of AI for software development. By following some best practices and precautions, you can enjoy the benefits of using AI as a pair programmer while avoiding the pitfalls. Happy coding!

Take the Next Step: Accelerate IT Development with AI

Looking for ways to accelerate your IT development process? Let us show you how AI paired programming can help – get in touch with us today.

5 Best ways on how mobile app can make your business successful

Mobile apps have made technology and business smarter. Smartphones have drastically changed the mode of communication which has become faster, better and accessible anywhere anytime.

Technology being accessed at your fingertips; mobile apps have made lives better and easier. Ordering food online, shopping online, payments to be made, ticket booking, news updates, name anything you have an app which can be accessed from your comfort zone. Inspite of having mobile friendly websites, mobile apps are considered to drive better traffic and revenue as the content consumed is higher in an app than browser.

A quick look into the app land stats:

  • Mobile apps are expected to generate $189 billion in revenue by 2020.
  • The Apple App Store has 2.2 million apps available for download.
  • There are 2.8 million apps available for download in Google Play Store.
  • 49% of people open an app 11+ times each day.
  • 57% of all digital media usage comes from mobile apps.
  • The average smartphone owner uses 30 apps each month.
  • Worldwide app downloads to reach 258.2 billion.

How mobile apps can help your business to grow?

With the above statistics we can see that mobile apps have created humungous opportunities for businesses wherein entrepreneurs can leverage the mobile apps to enhance their business. So, building a mobile app requires immense groundwork and certain key areas to be focused on which include:

  • Who is your target audience?
  • Why do you want a mobile app for a business?
  • What is the uniqueness in the app or what different are you offering over the competitors?

 

Here are the best ways mobile apps help grow your business: (5 best ways)

 

                                                                                         Increase your lead generation

Modern Customers prefer an app over a website as it is easier to browse through the products, has better information, easier to place orders which ultimately boosts the retail orders. This will enhance the growth of the business in terms of revenue as well as profits. Also, the payment options are safe, secure and easy as a customer can save his payment details and the next time the process becomes just a few clicks away.

 

Boost customer experience

A business having an app needs to understand the customer preferences
and build the features accordingly. Responding to your customer queries and having user friendly features is when your customers get converted which ultimately leads to enhanced customer experience.

 

 

                                                                                        Brand Visibility

If the business app is built in a way which serves the purpose and satisfies the customer needs, your brand will be recognized at the top of customer choices. Though your business has good online presence, to increase the potential of your brand build an app to reach out to masses.

 

 

Unique offers

Offers and launches is another way to grow your business with mobile apps. You can create offers based on customers searches, upcoming festivals, cashback offers, discount coupons and more. Intimating your regular customers through messages, mails or app updates about offers or new launches will get them prepared for the purchases. Customers happy with their purchasing experience will share the feedback with friends and family which in turn helps in the success of the business.

                                                                                    

                                                                                       Easily accessible content

As we all know that content is king in the internet space, mobile apps with content which can be easy to understand and accessible will have greater value. Even if there are no sales in an app but is only a learning or information portal content should be genuine and easier to access.

 

 

These are just a few apart from various other benefits which mobile apps offer a business. It is not only the big business conglomerate, but also small organizations or startups that can benefit from mobile apps.

Learn how AgilizTech helps in building mobile application irrespective of your business niche to help in the growth strategy. You need a mobile app, but if the cost and resources are hindering in building one then we are here to help you out.

Customizing Notification Content in iOS before displaying to user

In this blog post, we piece together the steps involved in customizing notification content in iOS before displaying it to the user. Essentially, we will show how a chat application message can be customized to display a name for the sender’s number.

The need

In certain applications, for example chat apps, the server only saves the user’s numbers only. This is because the server cannot maintain the equivalent name of the mobile number as it is saved differently on each device. For example, the name Mr. Adam Smith can be saved as Adam, Adam Smith, Dad, Adam Smith 2, etc. Therefore, it is not possible for server to retain a name. Hence, it is upon the client, that is, the mobile app needs to display names and numbers appropriately, in notifications sent from server.

Developers can enable the application to find the equivalent name for a phone number that has sent you the message, by customizing the notification content in iOS using service and content extensions.

Let’s explore what extensions are and how to configure them, in the next few sections.

What is an extension?

Extensions are background applications, running independently from the app. They are around even when the app is not in the foreground. Service and Content extensions offer powerful new tools for customizing the notification information.

Service Extension

This object intercepts the push payloads from apps and helps developers to change content in the notification before it is presented.

Content extension

An object that presents a custom interface for a delivered local or remote notification. If you want to customize the UI of your notification you can use the content extension.

Note: Before getting started with notification extensions, the developer must be familiar with creating local and remote push notification.

 

Service Extension Setup

In the User Notifications framework, Apple introduced the Notification Service Extension. It’s a small program running in the background of your device that intercepts payload before notification center presents the push notification. In the Service Extension, you can modify your content with a UNMutablenotificationContent object modifying your content. That can be decrypting an encoded message or grabbing data in the userInfo to modify the content.

Setting up Service Extension

Here are steps to get started with the Service Extension:

  1. To set up the Notification Service Extension, you’ll need a new target in your application. In Xcode, go to File > New > Target.
  2. In the menu box that appears, select iOS. In the list that appears, select Notification Service Extension.

Notification Content in iOS

  1. Click Next and enter the product name. it is a good practice to suffix ServiceExtension to the app name (that gives more clarity) – for example, yourProductName ServiceExtention.

Notification Content in iOS

  1. Click Finish to complete setup.
  2. A dialog box appears seeking permission to activate the Service Extension Click Activate.

Using Service Extension

In the navigator a new group appears, which is the Service Extension. This group contains two files. Select the NotificationService.swift file.

This file consists of two functions and two properties. The core method used is the didReceive (Request: withContentHandler). This method assigns the content handler closure to one of the two properties. The other property, bestAttemptContent is a mutable copy of the push notification’s content. In this method, you change the content for the push notification, loading all that rich content you couldn’t fit in the payload, or do any change to the content you wish.

For example, Apple’s default template changes the title.   You can go ahead and customize your title by changing “bestAttemptContent.title”.

override func didReceive(_request: UNNotificationRequest, withContentHandler contentHandler:
@escaping (UNNotificationContent) -> Void)
{
self.contentHandler = contentHandler
bestAttemptContent = (request.content.mutableCopy() as? UNMutableNotificationContent)

let contactName = “Surya”
if let bestAttemptContent = bestAttemptContent {

// Modify the notification content here…
bestAttemptContent.title = \(contactName)”
contentHandler(bestAttemptContent)

}
}

 

Making changes in payload

Now that we have made adequate settings in the Service Extension, we will initiate changes in the payload. Ensure that you possess the key value pair in your payload’s aps directory.

 

“mutable-content”:1

Navigate to payload and add this key value pair. The result should look like this:

{
“aps”:{
“alert”:{
“title”:”9909912345″
},
“badge”:1,
“sound”:”default”,
“category”:”notification.category”,
“mutable-content”:1
},
“subtitle”: “How are you??”
}

You can test with this payload by using any 3rd party push testing tool. Here we are using NW pusher.
Notification Content in iOS

Configuring the Service Extension with user info

Follow the steps given below to configure the Service Extension:

  1. In Service Extension, click NotificationServiceExtension.swift file

The file has two functions – didReceive with contentHandler and serviceExtensionTimeWillExpire

  1. Place the custom information in the didReceive function. For example, you can change the notification title by editing this line:
bestAttemptContent.title = “custom Title”

 

  1. Place the custom information into the body, giving a list of the order, and add the subtitle to the subtitle property.

 

Note: You’ll need the userInfo dictionary. Let’s make referring to the dictionary easier by making it a constant in the function, casting it to the JSON dictionary type of [String:Any].

 

Here’s how it is done:

//get the dictionary
let userInfo = bestAttemptContent.userInfo as! [String:Any]

 

  1. Subtitles are user info in a payload but are a property of UNMutableNotificationContent, so they need to be transferred. Since it’s a dictionary entry, we’ll unwrap it and check for nil. If not nil, then we have a subtitle and can update the value. Let’s downcast the value to String when assigning it the subtitle content, since the dictionary has the value as Any.
//change the subtitle
if userInfo[“subtitle”] != nil{
bestAttemptContent.subtitle = userInfo[“subtitle”] as! String
}

 

For Example:

override func didReceive(_ request: UNNotificationRequest, withContentHandler contentHandler:
@escaping (UNNotificationContent) -> Void) {
self.contentHandler = contentHandler
bestAttemptContent = (request.content.mutableCopy() as?UNMutableNotificationContent)
 
if let bestAttemptContent = bestAttemptContent {
// Modify the notification content here…
// bestAttemptContent.title = “Custom Title”

//Contact number from push payload has been received and the equivalent name of that number should be determined, and that name should be displayed as a notification title

let userInfo = bestAttemptContent.userInfo as! [String:Any]
guard let apsDict = userInfo[“aps”] as? [String:Any] else {return}
guard let alertDict = apsDict[“alert”] as? [String:Any] else {return}

if let contactNumber = alertDict[“title”] as? String {
let notificationTitle = findContactName(phoneNumber: contactNumber)
bestAttemptContent.title = \(notificationTitle)”
}

//change the subtitle
if userInfo[“subtitle”] != nil{
bestAttemptContent.subtitle = userInfo[“subtitle”] as! String
}
bestAttemptContent.subtitle = “How are you??”
contentHandler(bestAttemptContent)
}
}

 

Here findContactName(phoneNumber: contactNumber) is the custom method which retrieves the contact name from our contact list by comparing the mobile number which has been pushed from our payload

 

With this step we are ready with the Service Extension. In the next section, we need to configure info.plist

The Property List

We’ve a few more steps to complete before running the notification:

  1. Go back to Xcode. There one more file in the service extension we’ve yet to look at.
  2. Click on the info.plist and open NSExtension.
  3. Open the NSExtensionAttributes and access the UNNotificationExtensionCategory
  4. Content extensions run on categories, so whatever category this property is, that will be the category of the notification found in content.category. Change it to category.

 

This extension will run for only the notification.category notifications. If an extension has another category, it will not run. Remember to do this. If you forget this, the extension will not work for you.

Run the Notification

You are ready to run the notification. When you add extensions, Xcode often defaults to the run scheme for the extension. Check to make sure you are on your device run scheme for the app.

Results

In our payload we gave phone number and while receiving the notification we are getting the customized name.

Notification Content in iOS

 

References

  1. https://developer.apple.com/documentation/usernotifications/unnotificationserviceextension
  2. https://developer.apple.com/documentation/usernotificationsui/unnotificationcontentextension
  3. https://www.pushwoosh.com/docs/ios-10-rich-notifications-integration
stealing your personal data

Are apps stealing your personal data? Part Three

In the last two posts, we explored how some mobile apps were malicious in nature and indulged in stealing your personal data for their gains. We also looked at a few steps that mobile app developers can undertake to bring stronger, more resilient mobile apps that don’t support dangerous activities of hackers.

In this final part, we will understand what you as an end user can do to stay vigilant and prevent mobile apps from stealing your personal data.

Note to end users – How to hackproof your smartphone

Fingerprints can be lifted. Use passcode

One of the biggest nightmares for an individual these days is losing their phone. While the hardware must have cost big bucks, what’s more vital is the loss of personal data that’s present – think emails containing sensitive information, photos, videos and more. While most of us secure our phones with fingerprints, it is not always safe as it is easy to lift prints. It is better to use strong passcodes. And if you have an evil twin, it is time to say goodbye to facial recognition as an unlocking medium as well.

Also, while smart unlock features such as unlocking phone when you reach home/office is cool, it is dangerous when your phone is in the wrong hands.

 

Activate Find My Device feature so that even if physically lost, phone can be locked or wiped

Another way to proof your data in the event you have lost your device is to track it online and lock it. You can even wipe it fully so that the hackers cannot glean anything from it. In Android, Find My Device helps to locate the device as well as lock it or wipe it. iPhone users can use Find my iPhone feature to locate their devices and even switch on Lost Mode.

stealing your personal data

Don’t reveal sensitive data while on Public WiFi

Never use Public WiFi to perform financial or business transactions as hackers can position themselves between you and the connection point and intercept sensitive personal and corporate data. Always use secure connections while performing such activities. According to a Kaspersky Lab report, one in five persons has been a target of cybercrime while abroad and a third (31 per cent) of them are senior business managers.

stealing your personal data

 

Review app permissions and EULA before installing

It is important to review what all permissions an app is requesting before completing installation. As said before some apps seek permissions for internet and location just to send targeted ads and make money. And before you know it, your phone is filled with unwanted ads.

 

While mobile apps have been a boon to smartphone users around the world, the security risks associated with them cannot be denied. It is in your own personal interest that you monitor your apps and eliminate those that you think might compromise your data’s safety. Also, lesser the number of apps and lesser the number of distractions, the more organized your phone and well-spent is your time.

apps stealing your personal data

Are apps stealing your personal data? Part Two

In the previous post, we looked at how some mobile apps can be malicious and attempt to take advantage by stealing your personal data for monetary gains. In this part, we will explore the measures that mobile app developers can take while building apps to make them more secure and prevent critical personal data loss.

Note to developers – Building secure mobile apps

Ensure libraries are free of vulnerabilities

Developers must be cautious while using third-party libraries as they could contain malicious code or could possess security flaws. Ensure that the code is tested thoroughly before being used in the app development.

Application sandboxing against malware

While building and testing apps, it is a good practice to follow sandboxing. This helps to isolate application data and code execution from other apps. A sandboxing approach helps execute untested or untrusted programs or code, possibly from unverified or untrusted third parties or websites, without risking harm to the host machine or operating system.

stealing your personal data

Don’t ask too many permissions to sensitive information

A simple app such as a flashlight does not require permission to access internet and location. These days users are concerned about data privacy issues and hence do not prefer apps that need permissions which they find unnecessary. Therefore, tuning down on number of permissions might help increase user adoption. In fact, one of the flashlight apps has put up a permission comparison screenshot to showcase less permissions as a USP:

stealing your personal data

Validate input fields to prevent SQL injection attacks

SQL injection is an attack technique that takes advantage of applications that don’t correctly validate user-supplied requests before passing them to the associated backend database. Using normal request channels such as form data, scripts and URLs, hackers can pass malicious SQL queries and commands to a database if they are not thoroughly checked first. By validating input fields and sanitizing data inputs regularly and monitoring input logs, threats like SQL injections can be thwarted.

GDPR regulations and what it means for mobile apps

From May 25 2018 onwards, GDPR will be applicable to all websites and mobile apps which serve users who are citizens of EU. Developers must ensure that they adhere to the EU guidelines and ensure greater data protection for app users. Some of the guidelines are to collect only vital information, encrypt that data and allow users to delete/modify said data at any point of time.

We have looked at some steps the developers can undertake to embed security in mobile apps right from design and development stages. In the next post we will explore how you as a user can protect yourselves from malicious mobile apps and prevent them from stealing your personal data.

apps stealing your personal data

Are apps stealing your personal data? Part One

Fire and fury. This was the feeling etched in the minds of the 2 billion strong userbase of Facebook once the Cambridge Analytica scandal came to limelight. Cambridge Analytica, a political consultancy firm based out of Dallas, US and London, UK, had assimilated data of millions of Facebook users with an app called thisisyourdigitallife, with no indication to users on how their data will be manipulated. It had then used this data to create psychological profiles of millions of people, sending them targeted ads to influence and sway their votes in the favor of Cambridge Analytica’s clients.

Has Cambridge Analytica been successful? The firm was involved and attributed in turning the tide towards Brexit by targeting voters with likeminded ads. Similarly, it was part of the Trump campaign, sending targeted ads and content to voters with specific psychological traits.

Closer home, Cambridge Analytica was found to have played in a role in the 2010 Bihar Legislative Assembly elections. Apart from this, both Congress and BJP are said to have worked with the now disgraced agency to use analytics and glean insights about Indian voters.

 

In today’s digital age, where data has become the new currency, netizens have risen in numbers against loss of private and sensitive information, and misuse of the trust they had on Facebook. In fact, in March 2018, the growing negative perception of the social media giant led to a $60 billion drop in market capitalization.

 

Mark Zuckerberg, Facebook’s CEO has since testified before the US Senate Judiciary and Commerce committees, apologized for Facebook’s lapse and has vowed to enforce stronger data protection policies.

Given this atmosphere of absolute disregard for user data privacy, are mobile apps stealing your personal data? Is your data safe? How does your data get leaked anyway? Let’s explore in this blog post.

 

How is data leaked and what happens with it?

As per ProofPoint, mobile app data theft risks can be categorized as:

apps stealing your personal data - three levels of risks

Let’s look at a few examples of how your data can be stolen by mobile apps without your knowledge:

Unwanted ads – Madware

Beware of free apps. When you are unable to ascertain how a mobile app makes money most probably you and your data are being monetized by being targeted with ads. Madware is a much more aggressive version of advertising. Madware disrupts user experience and potentially exposes sensitive information such as location, contact information and device identifiers to cybercriminals. It enters your phone when you download an app and makes changes to browser settings automatically, allowing ads to pop up over all sorts of apps.

Location and internet access for targeted adds

Sometimes apps can seek location and internet access even when they don’t require it for functional purposes. In such cases, if you provide permission without understanding about it, your location might get tracked and you will receive location-specific ads over the internet. There have been incidents where even with the GPS being off, device location was tracked using cellphone towers, accelerometer and other features without the user’s permission.

 

Monetary loss – keystroke logging

Your bank accounts may be compromised if confidential data such as passwords and access codes can be read from the phone by malicious mobile apps. Some apps demand permission to SMS and call records. Such apps may employ keystroke logging to gather information such as credit card numbers, bank account passwords and more.

 

Echo Chambers and Political Manipulations

Psychology has always been a tool for politicians to turn collective minds in their favour. Fake news is spread, hate speeches are made to instigate reactions that complement their party’s agenda. But with social media, some political strategists have gone a step further. They use illegal means to collect social media data of millions of users using apps, to analyze and form psychological traits that will sway voting choices.

It is apparent that hackers are employing various new ways to get hold of your private data for their personal gains. That politicians have jumped into the fray is distressing. Given the dangers of security lapses and data theft, what can app developers and we as users do to remain vigilant and cautious? Read our next part – Are mobile apps stealing your personal data? Part Two – to know more.

iPhone X – the future of smartphones unraveled

The wait has ended. iPhone X – the future of smartphones has arrived amidst much fanfare. Unveiled at an event at the newly opened Steve Jobs Theatre (Apple Campus – Cupertino, California), the iPhone X has been subjected to both bouquets and brickbats. In this post, we explore why.

First things first, the specifications.

iPhone X comes with a host of new features, the most important ones being Facial Recognition, Augmented Reality support, Super Retina Display (Apple’s moniker for OLED display, a first for an iPhone). The home button has bid us goodbye, as the phone now responds to swipe up.

Let’s look at the specs:

Features  Details
Capacity 64 GB, 256 GB
Display 5.8” all-screen OLED, HDR
Resistance Water, Dust
Chip A11 Bionic Chip, Neural Engine
Camera 12-megapixel wide-angle and telephoto cameras, Optical zoom; digital zoom up to 10x
Video 4K video recording, Optical zoom, 6x digital zoom
Id Face ID, enabled by TrueDepth camera
Siri Improved Siri who can be activated with voice
Battery Wireless charging, lasts up to 21 hours
OS iOS 11

 

Fantastic Four Features

While the specifications are excellent as in any iPhone what is the extra special feature that makes this iPhone a fitting one to mark Apple’s tenth anniversary?

Could it be a body made entirely of smooth glass and polished stainless steel? The Facial Recognition capability that promises to adapt to changing human features? The absence of the home button? Or the impetus for Augmented Reality that is expected to be a game changer for app and gaming experience?

All are strong contenders, but perhaps it is these four that will be making waves for a while:

Facial Recognition

 

 

 

 

 

 

 

 

The Facial Recognition technology, called Face ID, captures several images of facial features with The TrueDepth camera system (a combination of light projectors and sensors), using Infrared light. Akin to the fingerprint security system that scanned our fingerprints, compared with the control set and unlocked the phone, FaceID will be comparing images to provide our gateway pass. Imagine just glancing at the phone to unlock it – simple, isn’t it?

Augmented Reality

Pokémon Go got us started on the AR rage where people were capturing monsters in red and white balls at school, near the dumpster and even at a temple entrance. Apple, too, has gained considerable advancement in AR. We saw a few applications at the event, one by Major League Baseball, where the feature lets spectators attending a live game see player statistics when they hover their phones over a particular athlete.

The technology is still at an infant stage and slowly, AR will gain momentum in smartphones.

Wireless Charging

 

 

 

 

 

 

 

 

iPhone X supports wireless charging. In fact, Apple is going full-fledged in this sphere – launching a wireless charging mat that charges all kinds of Apple devices from watch to phone to pod, all at the same time!

Animoji

Emojis are a loved feature of the internet and smartphones. Almost everyone uses them while texting, updating Facebook status and posting tweets. So why not create custom emoji? No no, we are not talking about emoji characters that look like you, but those that mirror your own expressions and movements!

Why brickbats?

Botched by Notch

 

 

 

 

 

 

 

 

 

 

The feature that has been receiving a lot of flak from a range of designers, developers and general tech aficionados is the now infamous ‘top notch’.

This section hosts a lot of cameras and sensors and is present right at the top of an otherwise all-screen phone. This might be a problem as the UI is affected while browsing sites.

While designers are expressing their consternation around the world, Apple has suggested in its Human Interface Design to:

Don’t mask or call special attention to key display features. Don’t attempt to hide the device’s rounded corners, sensor housing, or indicator for accessing the Home screen by placing black bars at the top and bottom of the screen.

FaceID is not proven

While Touch ID is a proven security measure, not many are ecstatic about using FaceID for securing their phones. It is entirely possible that identical twins might be easily able to crack the code and use your phone for hilarious or nefarious (if you have an evil twin!) reasons. Not kidding!

Final Word

The iPhone X is indeed a path breaking phone with a bevy of interesting features. It is pricey at $999, but tech aficionados will surely not give it a miss.

Watch the official film here

Solved – Unable to retrieve audio/video file recorded and saved in Ionic 2 App

AgilizTech works on exciting web and mobile app projects for customers around the globe. We develop both native and hybrid apps for our customers.

Recently, while building a hybrid app on the Ionic 2 Framework, our developers encountered an issue in coding an audio/video file record and retrieval. The initial functionality seemed simple, but that’s where Cordova threw spanner in the works. We had researched extensively online and weren’t able to find any solution. So, when our developers toiled for a few hours, and successfully solved it, we decided to share the solution and let others benefit from it.

For this project, our team had used the Cordova plugin – cordova-plugin-media-capture. This plugin provides access to the device’s audio, image, and video capture capabilities.

It is super easy to use. So, to record a video, we used the code:


navigator.device.capture.captureVideo(
	(result) => {
		console.log(result);
		console.log(“Video captured Successfully”);
		// Your code goes here.
	} ,
	(error) => {
		console.log(error);
		console.log(“Video captured failed”);
	}
);

Everything looked pretty simple. The video was getting recorded using the device’s recording application. On Android, the code worked like a charm. However, the team ran into issues in the iOS device, as the saved file was not getting played.

While debugging the issue, we observed the Media Capture object in captureSuccess.
In Android, the file was getting stored in a persistent location, so the code worked fine when we tried to retrieve the saved file.

But in iOS device, the file got stored in a temporary location!
Result, we were unable to play the saved file in the application.

Solution?

Once we figured out the issue, the solution was simple. We just had to copy the file from this temporary location to a persistent location.

We chose a persistent location that covered both Android and iOS. The File plugin provided such an alias: cordova.file.dataDirectory

navigator.device.capture.captureVideo(
	(result) => {
	  console.log(“Video captured Successfully”);
	  var fileName = result[0].name;
	  var dir = result[0].localURL.split(“/”);
	  dir.pop();
	  var fromDirectory = dir.join(“/”);
	  var toDirectory = cordova.file.dataDirectory;
	  File.copyFile (fromDirectory , fileName , toDirectory , fileName).then( res =>{
			console.log(“File successfully copied”);
			// Your code goes here.
		});
     	  } ,
	(error) => {
		console.log(error);
		console.log(“Video captured failed”);
	}
);

Everything fell into place after that.

Summarising, to make the recording and retrieval possible, just save the file in a persistent location that’s common to both Android and iOS.

Have you faced a similar issue while building an app in Ionic 2? Do let us know in the comments!

AgilizTech is working on some pretty cool Hybrid Apps powered by Ionic 2. Would you like to know more?

Contact Us

Solved: Click Handler Reaction Delay in Ionic 2

I am happy to announce the solution for the click handler reaction delay in Ionic 2. As an Ionic developer, you would be familiar with the infamous 300 ms delay that occurs, when a user attempts to tap and register a click on the hybrid mobile app you painstakingly built with Ionic 2.

Cue in some dramatic visualization…
Click Handler Reaction Delay in Ionic 2

Moving on…

The delay in registering the tap is the time lag taken by the click handler in reacting. And this delay is specific to ion-col and ion-items.

In their blog and the official documentation, the Ionic team has discussed about the issue in detail. The reason for this delay is said to be the Ionic click blocker, that blocks any interaction until a transition is completely done. This is to recognize if the user wants a click event or double click event on touch devices.

How does this affect the user?

This makes the application slow, thus affecting user experience. The issue is more prominent on iOS devices.

Solved: Click Handler Reaction Delay in Ionic 2

The solution to this issue is quite simple. All you need to do is this:

Add the ‘tappable‘ directive to your element.

For example:

<ion-item tappable (click)=“myClickHandler()”>
    // Your code goes here
</ion-item>
Note: We recommend you add the ‘tappable‘ directive to the click handlers of elements which are not normally clickable.

Hope this post helped you overcome this rather frustrating issue in Ionic 2.

Happy Coding!!

 

AgilizTech is working on some pretty cool Hybrid Apps powered by Ionic 2.

Would you like to know more?

Contact Us

Features of Android Nougat

Test driving the latest from the Android stable – Android Nougat

To say that Android has been a smashing success is an understatement. Emerging as the winner among stiff competition, from the likes of Symbian Anna, Windows OS, and Blackberry, Android has been giving iOS a run for its money since it first launched in Sep 2008. So much so that, as of Nov 2016, Android has hit a market share record, with 9 in every 10 smartphones using it. Android’s dream run is supported by cheap smartphones and wide developers’ base that populate Google’s Play Store with multiple apps.  And 2017 is expected to further raise the market share, with Android Nougat being rolled out to select devices.

Android Nougat Highlights

Android Nougat comes packed with exciting new features. And we at AgilizTech, decided to take it for a little test-drive after its April debut on Samsung S7 device.

Split-screen mode

The split-screen mode is a great option for the multi-taskers, as it allows you to open two apps side-by-side. How far it helps to boost productivity is yet to be discovered, but it sure is better than continuously toggling two app windows.

Android Nougat - Split screen

App quick switch

This is another cool feature from Nougat, where you can quickly switch between more than two apps by double tapping the Recents key. This is even more helpful as certain apps do not support the Split-screen feature.

Android Nougat - Quick App Switch

Notification redesign

Now alerts and notifications from apps can be responded to straight from the home-screen. For example, you can now respond to WhatsApp messages without being redirected to the WhatsApp screen.

Android Nougat - Notification redesign

 

Multi-language support

By enabling multiple languages, you can toggle between languages while using keyboards. This means, you can type in English UK and Español while sending a message.

Android Nougat - Multi language support

Doze on the go

Doze was introduced with Marshmallow and has now evolved into an even better feature in Nougat, allowing users to squeeze till the last drop of battery power. Using the Battery Optimization feature in Settings, Doze can control the battery usage of each app and modify them to suit your battery saving strategy.

Android Nougat - Doze on the go

Data saver

Some apps consume tons of data by running in the background, thus burning a hole in your pocket. With Data Saver’s granular controls, you can permit/restrict individual apps from accessing data while running in the background.

Android Nougat - Data saver

Improved security

Aren’t we all suspicious of those pesky apps that require permissions to umpteen folders in which they have no business? Nougat has been armoured for such apps, with the scoped folder access feature, that permits apps to use only select folders. Facial recognition too has arrived in Android, with the Trusted Face screen unlock feature made available in select devices.

Android Nougat - App Permissions

Improved graphics

This one is for the gamers, as your in-game graphics get a solid boost, with Nougat supporting the Vulkan API. Be ready for high-performance 3D graphics right on your phone.

Android Nougat - Graphics

Nougat Reception

Nougat has been receiving increasingly positive reviews from industry observers. Engadget and PCAdvisor have lauded Nougat, calling it an efficient OS that’s pro-multi-tasking. Market adoption too seems to be decent – Nougat’s adoption is on a hike with 7.6% of devices that access Google Play running Nougat as of May 2017.

Android Nougat - Market Share

Source: App Brain

In the last 30 days, a 37% surge has been seen in Nougat adoption, but we might have to wait for a few more months for the roll-out to complete, before seeing massive traction in adoption rates.

What’s on the cards, Google?

With the Nougat roll-out initiated in April-May, Google has moved on to Android O (suspected to be Oreo) and is working towards its announcement in the impending Google I/O 2017 summit in the US. Also, rumours have surfaced on the Magenta-microkernel based real-time operating system,

Despite these developments, it is safe to say that Nougat is going to stick around for a while given its rich features. As more new phone models come out in 2017, enabling the VR and Daydream features of Nougat, it is poised to be the most-preferred Android OS version ever.

 

Transform your mobile app with AgilizTech!

Contact us

 

Close Bitnami banner
Bitnami