Categories
Uncategorized

WebRTC in iOS

You’ve probably heard of WebRTC if you wanted to create an online conference app or introduce calls to your application. There’s not much info on that technology, and even those little pieces that exist are developer-oriented. So we aren’t going to dive into the tech part but rather try to understand what WebRTC is.

WebRTC in brief

WebRTC (Web Real Time Communications) is a protocol that allows audio and video transmission in realtime. It works with both UDP and TCP and can switch between them. One of the main advantages of this protocol is that it can connect users via a p2p connection, thus it transmits directly while avoiding servers. However, to use p2p successfully, one must understand p2p’s and WebRTC’s peculiarities.

You can read more in-depth information about WebRTC here

Stun and Turn

Networks are usually designed with private IP addresses. These addresses are used within organizations for systems to be connected locally and they aren’t routed in the Internet. In order to allow a device with a private IP to contact devices and resources outside the local network, a private address must be translated to a publicly accessible address. NAT (Network Address Translation) takes care of the process. You can read more about NAT here. We just need to know that there’s a NAT table in the router and that we need a special record in the NAT which allows packets to our client. To create an entry in the NAT table, the client must send something to a remote client. The problem is that neither of the clients knows their external addresses. To deal with this, STUN and TURN servers were invented. You can connect two clients without TURN and STUN, but it’s only possible if the clients are within the same network.

STUN is directly connected to the Internet server. It receives a packet with an external address of the client that sent it and sends it back. The client learns its external address and the port that’s needed for the router to understand which client has sent the packet. That’s because several clients can simultaneously contact the external network from the internal one. That’s how the entry we need ends up in the NAT table.

TURN is an upgraded STUN server. It can work like STUN, but it also has more functions. For example, you will need TURN when NAT doesn’t allow packets sent by a remote client. It happens because there are different types of NAT, and some of them not only remember an external IP, but also a STUN server port. They don’t allow packets received from servers other than STUN. Not only that, it’s also impossible to establish a p2p connection inside 3G networks. In those cases you also need a TURN server which becomes a relay, making clients think that they’re connected via p2p.

Signal server

We know now why we need STUN and TURN servers, but it’s not the only thing about WebRTC. WebRTC can’t send data about connections, which means that we can’t connect clients using only WebRTC. We need to set up a way to transfer the data about connections (what is the data and why it’s needed, we’ll see below). And for that, we need a signal server. You can use any means for data transfer, you only need the opponents to exchange data among themselves. For instance, Fora Soft usually uses WebSockets (you can read about them here).

Video calls one-on-one

Although STUN, TURN, and signal servers have been discussed, it’s still unclear how to create a call. Let’s find out what steps we shall take to organize a video call.

Your iPhone can connect any device via WebRTC. It’s unnecessary for both clients to be related to iPhone, as you can also connect to Android devices or PCs.

We have two clients: a caller and one who’s being called. In order to make a call, a person has to: Receive their local media stream (a stream of video and audio data). Each stream can consist of several media channels. There can be a few media streams: from a camera and a desktop, for example. Media stream synchronizes media tracks, however, media streams can’t be synchronized between each other. Thus, sound and video from the camera will be synchronized with one another but not with the desktop video. Media channels inside the media track are synchronized, too. The code for the local media stream looks like this:

  • Create an offer, as in suggesting a call start.
  • Send their own SDP through the signal server. What is SDP? Devices have a multitude of parameters that need to be considered to establish a connection. For example, a set of codecs that work with the device. All these parameters are formed into an SDP object or a session descriptor that is later sent to an opponent via the signal server. It’s important to note that the local SDP is stored as text and can be edited before it’s sent to the signal server. It can be done to forcefully choose a codec. But it’s a rare occasion, and it doesn’t always work.
  • Send their Ice Candidate through a signal server. What’s Ice Candidate? SDP helps establish a logical connection, but the clients can’t find one another physically. Ice Candidate objects possess information about where the client is located in the network. Ice Candidate helps clients find each other and start exchanging media streams. It’s important to notice that that the local SDP is single, while there are many Ice Candidate objects. That happens because the client’s location within the network can be determined by an internal IP-address, TURN server addresses, as well as an external router address, and there can be several of them. Therefore, in order to determine the client’s location within the network, you need a few Ice Candidate objects.
  • Accept a remote media stream from the opponent and show it. With iOS, OpenGL or Metal can be used as tools for video stream rendering.

The opponent has to complete the same steps while you’re completing yours, except for the 2nd one. While you’re creating an offer, the opponent is proceeding with the answer, as in answers the call.

Actually, answer and offer are the same thing. The only difference is that while a person expecting a call sets up an answer means, while they generate their local SDP, they rely on the caller’s SDP object. To do that, they refer to the caller’s SDP object. Therefore, the clients know about both device parameters and can choose a more suitable codec.

To summarize: the clients first exchange SDPs (establish a logical connection), then Ice Candidates (establish a physical connection). Therefore, the clients connect successfully, they can see, hear, and talk with each other.

That’s not everything one needs to know when working with WebRTC in iOS. If we leave everything as it is at the moment, the app users will be able to talk. However, only if the application is open, will they be able to learn about an incoming call and answer it. The good thing is, this problem can be easily solved. iOS provides us with a VoIP push. It’s a kind of push notification in iOS, and it was created specifically for work with calls. This is how it’s registered:

This push notification helps show an incoming call screen which allows the user to accept or decline the call. It’s done via this function:

It doesn’t matter what the user is doing at the moment. They can be playing a game or having their phone screen blocked. VoIP push has the highest priority, which means that notifications will always be arriving, and the users will be able to easily call one another. VoIP push notifications have to be integrated along with call integration. It’s very difficult to use calls without VoIP because for a call to happen, the users will have to have their apps open and just sit and wait for the call. That can be classified as strange behavior. The users don’t want to act strange, so they’ll probably choose another application.

Conclusion

We’ve discussed some of the WebRTC peculiarities; found out what’s needed for two clients to connect; learned what steps the clients need to take for a call to happen; what to do besides WebRTC integration to allow iOS users to call one another. We hope that WebRTC isn’t a scary and unknown concept for you anymore, and you understand what you need to apply it to your product.

Categories
Uncategorized

How to estimate time and effort for a software development project as a developer

Estimating IT projects is a pain. Whoever gave promises they couldn’t keep, only to work overtime just to meet the deadline they have set up for themselves?

When I started my path and tried to estimate my time spent while being a developer, I always underestimated things. Every time there would appear a job I didn’t account for. Colleagues told me to multiply my estimates by 2, 3, the number Pi. Only it didn’t help to increase the estimation accuracy, just added other problems. For example, when I had to explain where the high numbers came from.

15 years have passed since then. Over this time, I’ve estimated over 250 projects, got a lot of experience, and now I’m willing to share my thoughts on the topic.

Hopefully, this article will improve the quality of the estimations you’re giving.

Why estimate?

No more than 29% of projects end up in success, according to the research by The Standish Group, conducted in 2015. The other 71% either failed or exceeded the triple limitation system: deadline, functionality, budget.

From these statistics, we can assume that project estimation is often not what it should be. Does it mean that this process is pointless? There’s even a movement on the Internet that invites you to not estimate anything and just write a code, so that whatever happens – happens (search by #noestimates).

Not having any estimations does sound appealing, but let me give you an example. Imagine that you come to a restaurant and order a steak and a bottle of wine but there are no prices on the menu. You ask a waiter: “how much?”, and he goes, “depends on how long it takes the chef to cook. Order, please. You’ll get your food, you’ll eat it and then we’ll tell you how much it cost”.

There can also be an Agile-like option: “The chef will cook your meal, and you’ll be paying as he proceeds. Do this, please, unless you’re out of money. When you have no more money, the chef will stop cooking. The steak won’t be ready, perhaps, or it will be just reaching the state when it’s edible. If it’s not edible, though.. Sorry, it’s your problem”.

This is approximately how customers in the IT-sphere feel when they’re offered to start a job without estimations.

In the example above we’d ideally like to get an exact price for the steak. At the very least, it’d be fine if we just got a price range. This way we can check whether we want to go to this restaurant, choose a cheaper one, go get a cheeseburger or stay home and cook a salad.

Going to the restaurant without any understanding as to what to expect is not the decision that a person in the right mind will take.

I hope I could convince you that estimation is an important part of a decision making process on any project. The estimation can be as close or far from reality as possible, but it’s needed nevertheless.

Reasons for underestimation

Ignoring probability theory

Imagine the following situation. A developer is approached by a manager, and the manager would like to know how long it will take the developer to finish a task. The developer has done something like that in the past and can give the “most probable” estimation. Let it be 10 days. There’s a probability that the completion of the task will last for 12 days, but the chance is lower than that of 10 days. There’s also a chance that the task would be completed in 8 days but this probability is lower as well.

It’s often assumed that estimation for a task or a project is distributed according to the normal distribution law (read more about it here). If you show estimation distributions as a graph, you’ll get this:

X shows estimation while Y shows probabilities that the estimation will turn out to be correct and a task will consume the precise amount of time. In the center, you can see the point of the highest probability. It goes with our 10-day estimation.

The area under the curve shows a probability of 100%. It means that if we go with the most probable estimation, we’ll finish the project by the deadline with the 50% chance (the area under the graph before the 10-hour estimation is half of a figure, therefore it’s 50%). So, if we go with this principle, we’ll be able to only miss 50% of the deadlines.

This is only if the distribution of probabilities does go hand-in-hand with the normal distribution. In this case, the possibility of finishing a project earlier than a possible estimation equals to finishing it later than a possible estimation. However, it’s also normal that something goes wrong with the project, and we finish it later. Of course, a miracle can happen, and we finish earlier but what is the chance of that? In other words, the amount of negative possibilities is always higher than that of positive ones.

If we go with this idea in mind, the distribution will look like this:

For this to be easier to read, let me represent this information as a cumulative graph. It will show a possibility of finishing the project earlier than a deadline or just in time:

Turns out, if we take the “most possible” estimation in 10 days, the possibility of the task being completed in that period or earlier is less than 50%

Ignoring the current level of uncertainty

As we work on a project/task, we keep learning new information. We get feedback from the manager, designer, tester, customer, and other team members. This knowledge keeps renewing. We don’t know much about the project from the beginning, but we learn more as we go along, and we can mention exactly how long it took us once we’ve finished the project.

What we know directly affects how precise our estimation is.

Luiz Laranjeira’s (Ph.D., Associate Professor at The University of Brasilia) research also shows that the accuracy of estimating a software project depends on how clear the requirements are (Luiz Laranjeira, 1990). The clearer the requirements are – the more accurate the estimation is. Usually, the estimation isn’t clear because the uncertainty is involved in the project/task. Therefore, the only way of reducing uncertainty is by reducing it in the project/task.

Considering this research and common sense, as we decrease the uncertainty on a task/project, we increase the estimation accuracy.

This graph is here to make it easier to understand. In reality, the most possible estimation may change as uncertainty decreases.

Dependency between precise estimation and the project stage

Luiz Laranjeira went on with his research and figured out how numerically dependent estimation spread in on a project stage (level of uncertainty).

Taking optimistic, pessimistic and the most possible estimations (optimistic estimation is the earliest period of finishing the project out of all, while pessimistic is vice versa, the latest) and show how their ratios change over time, from start to finish of the project, we’ll get the following picture:

This is called a cone of uncertainty. The horizontal axis stands for the time between the start and the finish of the project. The main project stages are mentioned there. The vertical axis shows a relative margin of error in the estimation.

So, at the start of the initial concept, the most possible estimation may vary from the optimistic one by 400%. When the UI is ready, the spread of estimation goes between 0.8 and 1,25 relative to the most possible estimation.

This data can be found in the table down below:

Life-cycle stageoptimistic estimationpessimistic estimation
Initial concept0.25х
Business requirements (agreed definition of the product)0.5х
Functional and non-functional requirements0.67х1.5х
User Interface0.8х1.25х
Thoroughly thought realization0.9х1.15х
Finished product

It’s very important to note that the cone doesn’t get narrower as time goes by. For it to narrow, one needs to manage the project and take action to lower uncertainty. If one doesn’t do that, they’ll get something like this:

The green area is called a cloud of uncertainty. The estimation is subject to major deviation up to the very end of the project.

To move on the cone to the most-right point where there’s no uncertainty, we need to create a finished product :). So, as long as the product is not ready, there will always be uncertainty, and the estimation can’t be 100% precise. However, you can affect the estimation accuracy by lowering uncertainty. With this, any action targeted at lowering uncertainty also lowers the estimation spread.

This model is used in many companies, NASA included. Some adapt it to consider volatility in requirements. You can read about that in detail in “Software Estimation: Demystifying the Black Art”.

What is a good estimation?

There are plenty of options to answer this question. However, in reality, if the estimation deviates by more than 20%, the manager doesn’t have a room for maneuver. If the estimation is somewhere around 20%, the project can be finished successfully by managing functionality, deadlines, team size, etc. It does sound logical, so let’s stop at this definition of good estimation, for example. This decision has to be taken on the organizational level. Some risk and a 40-50% deviation is OK for them; others see 10% as a lot.

So, if out estimation differs from the actual result by not more than 20%, we consider it good.

Practice. Estimating a project on various stages

Let’s imagine that a project manager has approached you and asked to estimate a function or a project.

To start with, you have to study available requirements and figure out the life-cycle stage of a project definition.

What you do next depends on the stage you’re on:

Stage 1. Initial concept

If a manager approaches you and asks how long it will take to create an app where doctors will consult patients, you are on Stage 1.

When does it make sense to make estimations on this stage?

On a pre-sale stage. When you need to realize whether it’s worth it to further discuss the project. All in all, it’s better to avoid estimations on this stage and try to lower the uncertainty as soon as possible. After that, we can move on to the next stage.

What do you need to estimate on this stage?

Actual labor time data on a similar finished project.

What tools are the most suitable for this stage?

  • An estimation by analogy

Estimation algorithm

Actually, estimating the project on this stage is an impossible task. You can only see how long a similar project took to launch.

For example, this is how you could put your estimation into words: “I don’t know how long this project will take as I lack data. However, project X which was similar to this one took Y time. To give at least an approximate estimation, it’s imperative to make requirements clearer”.

If there’s no data from similar projects, then lowering the uncertainty and moving to the next stage is the only way to estimate here.

How to move to the next stage?

For this to happen, the requirements must be clarified. You need to understand what the app is for and its functionality.

Ideally, one should have skills in gathering and analyzing requirements.

To improve that skill, it’s recommended to read “Software requirements” by Karl Wiegers and Joy Beatty.

To gather preliminary requirements, you might use this questionnaire:

  • What’s the purpose of the app? What problems will it solve?
  • What is the target audience? (for the task above that could be doctor, patient, administrator)
  • What problems will each type of users solve in the app?
  • What platforms is the app for?

After figuring these things out, you will have an image of the app in your head with all the necessary information. With this, we’re moving to Stage 2.

Stage 2. An agreed definition of the product

We have an understanding here, although not very detailed, about what the app will do and what won’t. 

When does it make sense to make estimations on this stage?

Again, on the pre-sale stage. Right when one needs to decide whether it’s worth it to complete the task or project, whether they have enough money, whether the deadlines are affordable. You need to check if the value that the project brings is worth the resources that need to be involved.

What do you need to estimate on this stage?

Quite a few finished projects and their estimations OR huge experience in the area of development to which the project is related. These two combined would be even better!

What tools are the most suitable for this stage?

  • An estimation by analogy
  • A top-to-bottom estimation

Estimation algorithm

If there was a project like this before, the approximate estimation would be the time spent on that project.

If there is no data on projects like that, you need to split the project into the main functional units, then estimate every block according to those that were done on other projects.

For example, with the app where the doctors would consult patients, we could have got something like that:

  • Registration
  • Appointment scheduling system
  • Notification system
  • Video consultation
  • Feedback system
  • Payment system

You could estimate the “registration” block by using something similar from another project and for the “feedback system” a block from a different project.

If there are blocks that were never done before or they lack data, you can either compare the necessary labor time against other blocks or reduce uncertainty and use the estimation method from the next stage.

For example, the “feedback system” module might seem twice as difficult as the “registration” module. Therefore, for the feedback, we could get an estimation twice as high as the registration.

The method of comparing one block against the other is not exactly precise, and it’s better used in the situation where the number of the blocks that were never done isn’t higher than 20% of the blocks that do have historic data. Otherwise, it’s just a guess.

After this, we summarize estimation of all blocks, and it will be the most possible one. The optimistic and pessimistic estimations can be calculated using the coefficients appropriate for the current stage – x0,5 and x2 (check the coefficient sheet).

Ideally, you should let your manager know what’s going on, and they will have to deal with it.

If the manager can’t deal with it and asks for one, single number, there are ways to do that.

How to calculate one estimation out of three? It will be answered down below in the corresponding chapter.

How to move to the next stage?

Prepare a full list of requirements. There are quite a few documentation ways, but we’ll look into a widely used one with a User Story.

We need to understand who will be using each block and what they’ll be doing with the blocks. 

For example, for the “feedback system” block we would end up with these bullet points  after gathering and analyzing requirements:

  • A patient can check all feedback about the chosen doctor
  • The patient can leave feedback for the doctor after a video consultation with him
  • The doctor can see feedback from the patients
  • The doctor can leave a comment on feedback
  • An administrator can see all feedback
  • The administrator can edit any feedback
  • The administrator can delete feedback

You will also need to collect and write down all requirements that are not functionality-based. To do that, use this check-list:

  • What platforms is it for?
  • What operating systems need to be supported?
  • What do you need to integrate with?
  • How fast is it supposed to work?
  • How many users at the same time can use the tool?

Clarifying this stage will move you to the next one.

Stage 3. The requirements are gathered and analyzed

This stage has a full list of what each user can do in the system. There is also a list of non-functional requirements.

When does it make sense to make estimations on this stage?

When you need to give an approximate estimation for the project before you begin working with the Time & Materials model. The estimation of tasks from this stage can be used to prioritize some of them on the project, to plan the release dates and the whole project budget. You can also use those to control the team’s efficiency on the project.

What do you need to estimate on this stage?

  • The list of functional requirements
  • The list of non-functional requirements

What tools are the most suitable for this stage?

  • An estimation by analogy
  • A top-to-bottom estimation

Estimation algorithm

You need to decompose each task (split it into components). The smaller the components are, the more precise will the estimation be.

To do it on the best of your abilities, you need to represent everything that needs to be done on paper.

For example, for our User Story that goes like “a patient can see all feedback about the chosen doctor”, we could get something like this:

We split the task here into three parts:

  • Create infrastructure in the database
  • Create the DAL level for data samples
  • Create a UI where the feedback will appear

If you could, you can write down the UI functionality and approve it with whoever asks for estimation. It will eliminate lots of questions, make the estimation more precise, and be a good quality of life change.

If you want to improve your interface design skills, it’s recommended to read two books: “The Humane Interface” by Jef Raskin and “About Face. The essentials of interaction design” by Alan Cooper.

Then you need to imagine what exactly will be done for each task and estimate how long it will take. Here you have to calculate time, not guess it. You have to know what you will do to finish each subtask.

If there are tasks that take more than 8 hours, split them into subtasks.

The estimation received after having done this can be considered optimistic as it most likely uses the shortest path from point A to point B, given that we haven’t forgotten anything.

Now it’s about time we thought about things that we’ve probably missed and correct the estimation accordingly. Usually, the checklist helps here. This is an example of such a list:

  • Testing
  • Design
  • Test data creation
  • Support for different screen resolutions

After completing this list, we have to add the tasks we might have missed to the task list:

Go through each task and subtask and think about what could go wrong, what is missed. Oftentimes, this analysis reveals things without which you can’t end up with a best-case scenario. Add them to your estimation:

After you calculate this, too, your estimation will be even closer to the optimistic one than to the most possible one. If we take a look at the cone, the estimation will be closer to its lowest line.

The exception here might be if you’ve done a similar task before and can speak with authority that you know how it’s done and how long it takes. In that case, your estimation would be called “the most possible” and it’d go along with the 1x line on the cone. Otherwise, your estimation is optimistic.

The other two estimations can be calculated with the coefficients according to this stage: x0,67 and x1.5 (check out the coefficient table).

If you calculate the estimation from the example above, we’ll get this:

  • Optimistic estimation: 14 hours
  • The most possible estimation: 20 hours
  • Pessimistic estimation: 31 hours

How to move to the next stage?

By designing the UI. Creating wireframes would be the best way to go.

There are multiple programs for that but I’d recommend Balsamiq and Axure RP.

Prototyping is another huge topic that is not for this article.

Having a wireframe means that we’re on the next stage.

Stage 4. The interface is designed

We have a wireframe here as well as the full list of what each user will do in the system. We also have a list of non-functional requirements.

When does it make sense to make estimations on this stage?

To create an exact estimation by the Fixed Price model. You can also do that for everything that was mentioned in the previous stage.

What do you need to estimate on this stage?

  • Prepared wireframes
  • A list of functional requirements
  • A list of non-functional requirements

What tools are the most suitable for this stage?

  • An estimation by analogy
  • A top-to-bottom estimation

Estimation algorithm

The same as in the previous stage. The difference is in accuracy. Having a planned interface, you won’t have to think as much and the possibility of missing something is lower.

How to move to the next stage?

Design the app architecture and thoroughly think about the realization. We won’t check that option as it is used quite rarely. With that being said, the estimation algorithm after thinking about architecture won’t differ from one on this stage. The difference is, once again, in accuracy increase.

Retrieving one estimation from the range of estimations

If you have the three types of estimation ready, we can use the knowledge by Tom DeMarco to retrieve one estimation. In his book “Waltzing with bears” he mentioned that absolute possibility can be obtained by integrating the area under the curve (in the graph we had before). The original calculation template can be downloaded from here or from here without registration. You need to insert three numbers in the template and receive a result as a list of estimations with their corresponding probabilities.

For example, for our estimations of 14, 20, and 31 hours we’ll have something like this:

You can choose any probability you deem decent for your organization, but I’d recommend 85%,

Don’t know how to estimate? Speak up!

If you don’t know what you’re asked or how to implement the functionality you need to estimate? Let your manager know, give him an approximate estimation, if that’s possible, and suggest actions that will make the estimation more precise.

For example, if you don’t know whether the technology works to finish the task, ask for some time to create a prototype that will either confirm your estimation or show what you’ve missed. If you are not sure that the task is doable, say that from the beginning. These things need to be confirmed before you’ve put their weight on your shoulders.

It’s very important to provide a manager with this information, otherwise, he can blindly trust you and have no idea that there’s a chance of missing the deadline by 500% of the time or simply not finish the product with the technology or requirements you have.

A good manager will always be by your side. You and he are in the same boat, and sometimes his career depends on whether you’ll finish on time even more than yours.

Doubts? Don’t promise

Many organizations and developers help their projects fail by taking on responsibilities too early on the cone of uncertainty. It’s risky as the possible result jumps between 100% and 1600%.

Efficient organizations and developers postpone decision making up until the moment when the cone is narrower.

Usually, this is normal for organizations that are on the more mature CMMI module level. Their actions to make the cone narrow down are clearly stated and are followed.

You can see the quality of estimations and its increase in the projects of the U.S. Air Force when they moved to the more mature CMMI level:

There’s something to think about here. Other companies’ statistics confirm this correlation.

Even here, accuracy of the estimations can’t be achieved only with estimation methods. It’s inextricably linked to the efficiency of project management. It doesn’t depend only on developers, but also on project managers and senior management.

Conclusion

  • It’s nearly impossible to give an absolutely correct estimation. You can, however, affect the range in which the estimation will fluctuate. To do that, try and lower the uncertainty level on the project
  • Making estimation be more accurate can be achieved through splitting tasks into components. As you decompose things, you’ll think what and how you will do things in details
  • Use checklists to lower the possibility of missing something as you estimate
  • Use the uncertainty cone to understand the range where your estimation will most probably fluctuate
  • Always be comparing the given estimate with the time that was actually spent on a task. It will help you improve your estimation skill, understand what you’ve missed, and use it as you move further.

Useful books

There is a lot of literature on the topic but I’ll recommend the two books that must be read.

  • Software Estimation: Demystifying the Black Art by Steve McConnell
  • Waltzing With Bears: Managing Risks On Software Projects by Tom DeMarco and Timothy Lister.
Categories
Uncategorized

9 little things to make your iOS application cooler

Apple is the leader on the phone market not just because they produce high-quality smartphones, but also because they, unlike other companies, do pay attention to details. I’ll just tell you how to make an Apple-like application. All we’ll need to do that is just a couple of lines with a code, nothing too complicated. You don’t have to use any external libraries, you can just do with whatever Apple has provided for you.

1. Taptic engine

Taptic engine is a new vibration by Apple, and this solution was initially integrated into iPhone S6. It’s a small engine that can produce different vibrations. The best thing about it is that Apple has allowed developers to work with it.

Use scenarios:

  1. When you press a button. Your app will be way more appealing if it doesn’t only respond to a user doing something by changing the content on the screen, but if it also responds physically.
  2. When you scroll the content. A lot of people own wristwatches. Do you enjoy the sound when you wind yours? So why not add it to your app? This mechanic allows you to help a user dive into content more, it becomes more interesting for him to scroll down the feed. Thus, we make the user stay in our app for a longer period of time.
  3. When an error appears. You always have to put some effort into making sure your program doesn’t have errors. However, there are situations where the user is the one responsible. For instance, if they entered the wrong password. Of course, we’ll show a pop-up notifying them of that, but we can also do that using our engine.

Taptic engine helps add the Apple magic we all know and love.

Realization:

2. Spotlight indexing

What’s your iOS device memory capacity? 128 GB, 256 GB, more? How many apps are on your smartphone? 50. 100? Can you imagine the amount of data stored on your phone? In order for a user to not get lost in that large information stream, Apple has added Spotlight.

Spotlight is a mechanism that allows you to find data on the device that’s operated by macOS, iOS, or iPadOS. Unfortunately, Spotlight only helps to locate the app, but iOS 9 introduced the functionality of indexing the data within those apps.

Unfortunately, not all apps are indexed so let’s be the first ones in order to be ahead of the competition!

Is your app a mail aggregator? Let’s search in letters! There are dozens of different ways to use Spotlight. What we have to do is accentuate the main task of the app.

Realization:

Add an index now.

Now, processing the app opening with a unique index.

3. Animation upon pressing

The animation that Apple provides is very simple.

I suggest that we improve it a bit. Why? It’s a lot more comfortable for a user when they change an item’s form by slightly touching it. It creates somewhat of a connection between an application and a user.

Realization:

Do not forget about point one from this article! A combo of animation and taptic engine is simply amazing.

4. Permission requests

No one likes to share their geolocation but we still have to, otherwise, the maps won’t work.

Now, imagine: your app works with a camera, microphone, geolocation, contacts. So when do we ask permission from a user?

Bad decision:

Ask permission for everything at the first launch

  • Quite fast
  • The negative attitude from a user to such an app as they don’t understand why they need all this.
  • The developer still has to check permissions before the actual module use.

Optimal decision:

Request permission before the actual use

  • User’s trust isn’t undermined;
  • The developer doesn’t do double work.

Advanced decision:

Onboarding that definitively describes where and what for will the phone be used.

  • User understands exactly why he has requested permission;
  • The program becomes more user friendly;
  • Developing takes a lot of time;
  • Developer does double work as they have to check permission before the actual module use anyway.

I think that the Optimal decision strategy is the best here.

5. Home Screen Quick Actions

There is a 3D Touch function in iPhone (Haptic Engine in the modern iterations). Roughly speaking, this technology allows to understand the power with which you press the screen. This can be integrated into an app. For example, upon pushing the element hard, an event occurs. This, however, didn’t get wide recognition. I believe it’s because the user has to understand on their own whether a button has hidden functionality. Therefore, this function isn’t on the top of the priority list.

However, it’s different when the Home screen is involved. All icons have the “hard push” function. If the developer hasn’t done anything, the Home screen will provide the following functions:

  • Change the Home screen;
  • Share application;
  • Delete application.

Starting with iOS 12, this functionality can be widened by adding actions that you want. As a rule of thumb, the main features’ functionality is integrated there. For example, this is what Instagram offered:

  • New post;
  • Check actions;
  • Direct.

Pressing any of those will take you to the corresponding event.

You may find Apple documentation down below. Although it might seem that there’s lots of code, realization won’t take too much time.

Apple documentation

6. Dark Mode

iOS fans were waiting for a new dark theme for years. Developers didn’t,

Starting with iOS 13, the phone has two modes: light and dark. Change it in the settings, and all applications will change their interface. Roughly speaking, if a button is blue when the flight mode is active, it will go red once you switch to the dark mode.

I switch modes quite a lot on my iPhone. When I see that the app changed color on its own, I’m happy. You can see that developers tried harder and introduced a function. It’s a small but nice addition.

Let’s see how this works taking our Russian Instagram as an example:

In my new project, I have decided to work with colors differently. Before, people used to create a separate file with app colors. I, however, have created a Color Set. Only the dark theme is supported by the app now, but if there’s an urgency to add a light theme, it’ll take no more than 30 min. You just have to know what color is used when swapping to the light theme.

Now the color is always red regardless of the theme. But if there’s yellow instead of red in the light theme, I will just need to change the color here. You don’t have to do anything inside the code.

This solution has increased the developing time by 30 min. But if we decide to go with the dark theme, we’ll save about 20 hours!

7. iOS Modal Sheets

There are two ways of accessing a new window in iOS – when it appears on the right and at the bottom.

First option:

Second option:

We’ll be talking about option 2. Prior to iOS 13, it was working by opening a new window immediately on top of the previous one. Starting from iOS 13, it works differently by default.

We see on the gif that a window opens on top of the previous one but it doesn’t cover the entire screen. This is called Modal Sheets. Developers went on to fix in in Summer’19, by adding an attribute vc.modalPresentationStyle = .fullScreen. This trick allowed them to get back to the way apps opened as it showed on gif 2.

Now a new window would open full screen. It was a quick fix in order to avoid bugs. Why so? Because fullScreen has to add a close window button on its own and pushing it is easy to process. If you use Modal Sheets, you can just drag the window down, and iOS will close the window and remove it from the device memory. It can cause bugs, however – uncontrollable behavior, for instance.

This way of closing windows can be controlled via delegate:

Logic has to be inserted here. For example, the same as the “close” button has.

Let’s use Modal Sheets, avoid fullScreen if you can. Modal Sheets makes an app fresher, modern and the UX is similar to Apple applications.

8. System font size

Did you know that you can change the font size in iOS? This function is awesome for you if you have trouble seeing small objects. The size will change in all system applications.

That’s not all! You can set your font size so that it depends on the one in the system. This improves your interaction with apps, especially if there’s a lot of text in there.

You’d ask whether it’s easier to get a bigger size from the start? No, it’s not. I, for example, don’t like huge letters. Let’s think about all users, thus getting even more of them!

This is the technology description from the official documentation.

9. Password AutoFill and Strong Password

Why will I never move to Android? There are more than 300 accounts in my password list, and I think you too have quite a few of them. That’s it, no more questions. It’s convenient.

Whoever doesn’t know what I’m talking about, I’ll explain. Your login and password are stored in a secure place. Why is it secure? Apple will answer.

You don’t need to write down your password on a piece of paper anymore (may my grandfather forgive me for this), nor you need to come up with passwords by yourself. Do you use the same password everywhere? Congratulations, you are at risk. This mechanism generates a strong password for you and automatically adds it to Keychain. The program will suggest a suitable password for authorization upon your next login.

In order for this to work, you need to add Associated Domains on the server and list it in Capabilities in the app.

Don’t forget to mention type at the filling field in an iOS app.

Conclusion

We’ve explained how we can make an application way more appealing using small features. Don’t forget about small things, so your application can be “huge”!

Categories
Uncategorized

How to apply an effect to a video in iOS

Have you ever thought about how videos are processed? What about applying effects? In this AVFoundation tutorial, I’ll try to explain video processing on iOS in simple terms. This topic is quite complicated yet interesting. You can find a short guide on how to apply the effects down below.

Core Image

Core Image is a framework by Apple for high-performance image processing and analysis. Classes CIImage, CIFilter, and CiContext are the main components of this framework.

With Core Image, you can link different filters together (CiFilter) in order to create custom effects. You can also create the effects that work on the GPU (graphic processor) which will move some load from the CPU (central processor), thus increasing the app speed.

AVFoundation

AVFoundation is a framework for work with media files on iOS, macOS, watchOS, and tvOS. By using AVFoundation, you can easily create, edit, and play QuickTime films and MPEG-4 (MP4) files. You can also play HLS streams (read more about HLS here) and create custom functions to work with video and audio files, such as players, editors, etc.

Adding an effect

Let’s say you need to add an explosion effect to your video. What do you do?

First, you’ll need to prepare three videos: the main one where you’ll apply the effect, the effect video with an alpha channel, and the effect video without an alpha channel.

An alpha channel is an additional channel that can be integrated into an image. It contains information about the image’s transparency and can provide different transparency levels, depending on the alpha type.

We need an alpha channel to not let the video with an effect overlap the main one. This is the example of a picture with the alpha channel and without it:

Transparency goes down as the color gets whiter. Therefore, black is fully transparent whereas white is not transparent at all.

After applying a video effect, we’ll only see the explosion itself (the white part of an image on the right), and the rest will be transparent. It will allow us to see the main video where we apply the effect.

Then, we need to read the three videos at the same time and combine the images, using CIFilter. 

First, we get a link to CVImageBuffer via CMSampleBuffer. We need it to control different types of image data. CVImageBuffer is derived from CVPixelBuffer which we’ll need later. We get CIImage from CVImageBuffer. It looks something like this in the code:

After receiving CIImage for each one of the three videos, we need to compile them using CIFilter. The code will look roughly like this:

Once again we’ve received CIImage but this time it consists of the three CIImages that we got before. Now, we proceed to render the new CIImage in CVPixelBufferRef using CIIContext. The code will look roughly like this:

Now, we have a finalized pixel buffer. We need to add it to the video sample buffer, and we’ll receive a video with the effect after that.

The effect is successfully added to the video here. With that being said, the work was completed using the GPU, which helped us take the load off the CPU, therefore increase the app speed.

Conclusion

Adding effects to videos in iOS is quite a complicated task, but it can be done if you know how to use basic frameworks for work with media in iOS. If you want to learn more about it, feel free to get in touch with us via the Contact us form!

Categories
Uncategorized

Emulation of slow connection when testing iOS and Android apps

When testing mobile apps, newbies QA frequently forget to check the app with an unstable Internet connection. But in many cases this is critical: connection speed directly influences user experience and workability of the main functions. It is especially true for applications where geolocation and mobile Internet are heavily in use. For example, video chats, messengers, and other multimedia products we specialize in.

In this article, we’ll show how to spoil the Internet on a test device with no hassle. 

iOS

Let’s start with a standard utility Network Link Conditioner for iOS apps testing. It lets the QA adjust the Internet connection as he needs.

To switch on this function on iPhone, you need a Mac OS device:

  1. Download and install Xcode for Mac
  2. Open Xcode on Mac
  3. Connect iPhone to Mac
  4. Allow Mac access iPhone
  5. Open Settings on iPhone
  6. Scroll down
  7. Tap “Developer”
  8. Tap “Network Link Conditioner”
  9. Pick network preset or create your own
  10. Switch on the toggle “Enable”

iOS lets us choose one of pre-installed presets of connection quality – or create our own preset.

For our own preset these settings are available:

Here we see that Apple took care of testing apps with different levels of connection quality and gave us almost all the needed settings.

Having got acquainted with Network Link Conditioner for iOS, we’ve been sure such a feature would be on Android too. God, how much we’ve been mistaking.

Android

It appeared to be impossible to emulate a slow or unstable connection on a real Android with the help of standard tools. Therefore, I faced 2 paths: download some apps from Google Play that emulate slow connection, or use a specifically precise adjustment of the Internet connection access point.

Apps didn’t work out for me ☹ All the apps that give this function require Root access, and this breaks the concept of testing in real-world conditions.

So, having left the Root access as the last resort, I decided to closer look at path #2 – adjustment of the access point.

In the past, when being a student, mobile internet traffic was ending up quickly (and we needed to read, watch something while on the lesson), and we used iPhone as an access point. The idea came to mind: to mix the student experience and recently gathered knowledge.

If we use Network Link Conditioner and access point made of macOS or iOS devices does not require any extra knowledge and is easy to adjust. Exactly what’s needed if we want to save time. 

So, to emulate bad connection on Android we need the Android device and… iPhone with Developer Tools switched on.

  1. Make iPhone the access point (Settings > Modem regime)
  2. Adjust connection with Network Link Conditioner
  3. Connect to the access point with the Android
  4. Ready. You’re awesome 🙂

Of course, the ways to break the Internet we considered in this article are not the only solution. We’ll tell about more complicated options, such as Android and iOS emulators, in the next article.

Thanks and see you soon!
Always yours, 
Dima and Fora Soft QA team ?

Categories
Uncategorized

Fora Soft – leading Mobile App Development Company 2020 at TopDevelopers.co

We have been featured in the February press release about Top Mobile App Developers by TopDevelopers.co, a review and ratings platform for B2B IT service providers.

We at Fora do not develop just any mobile app. Our narrow field has always been video and multimedia. Video and multimedia tech is the core of software products in these 6 areas: Real-time Communication, Online Education, Telemedicine, Video Surveillance, Internet TV and Augmented or Virtual Reality. We do not do anything except these 6.

That is why achievements like these make us especially proud. With this small focus we managed to compete with big generalists and get into the list of top mobile app development companies. Ctrl+F Fora on page 4.

We have successfully completed 190 full-scale products. Carried out planning and wireframing for another 200. Our customers are from all over the world now. But the 1st non-Russian client was Mitch from Video Interpretations LLC in 2010.

The company business was medical interpretations. Interpreters walked to hospitals by foot and translated patient’s complaints. In 2011 we completed the 1st version of their video chat app. Since then, interpreters served from home. How many did they employ in one Wisconsin city? Now they have 700+ interpreters. In these 10 years, we worked on 3 product versions and numerous smaller improvements. We’ve been there when they started serving not only hospitals but also traffic police.

How cool it is to realize that we still work with Mitch! And he is one of those who kindly left us a review on TopDevelopers. “They are the best”, “Forasoft is a great company”, “one-stop-shop for all your startup needs”, these are some of the comments customers said on ForaSoft’s profile on TopDevelopers.co. We have more such exciting projects on our portfolio, come to have a look.

TopDevelopers.co is a directory and review platform for B2B IT service providers. We registered there because we liked their process. They seem to carefully filter good companies and then help clients to find them. The team of analysts at TopDevelopers.co vets the companies through stringent parameters which ensure that only the most competitive firms, businesses, enterprises, and entrepreneurs are filtered through their process. This helps the service seekers in getting a ready to use pool of companies from which they can choose the appropriate firm according to their need.

They are not only ones though. Just as I’ve been writing this post, we’d appeared in these rankings from DesignRush:

How to develop successful products and get positive reviews like these? We believe we should help not only with the development. We should solve the customer’s problems. There are 3 top frequent questions from our potential clients not related directly to the app development but important which we help them with. And useful resources to help you answer them right away.

  • How to come up with a good idea for your mobile app in the first place? This article from Top App Developers may help.
  • I’m developing an app, why do I need a webpage? The landing page is searchable, many people search apps on Google. So it’s mandatory for promotion. Here are details why it is important and 10 examples of good pages.
  • A frequent issue about mobile apps we face is lack of promotion. 8 of 10 potential clients we speak with believe they’ll develop it, and people will come. It was not true in 90% of cases we worked on. This guide gives 5 ways to promote an app and 5 tools for that. And here are 10 cool marketing campaigns of 2020 – to get inspiration.

Thanks for reading! Contact us today with your app idea, let’s create a new big thing together!

Categories
Uncategorized

Clients Give Fora Soft 5/5 Stars!

Say congrats, we’ve recently registered on Clutch, and have already collected 5 reviews, along with a 5-star rating! One of the feedbacks came from INSTACLASS, a digital tutoring company. They said they hired us for ‘everything,’ and that’s the best praise for us. They wanted us to handle the project from A–Z, and that’s exactly what we did. We developed their website, iOS app, and Android app. We also developed custom Real-Time Communication between students and tutors using WebRTC. See the full case in our portfolio.

We do not develop any software except video and multimedia software. But within that narrow specialization, we’re a full-service software development company. So no matter what your digital needs are, we will take care of them. That’s right — we develop products for mobile and web, as well as smart TVs and VR headsets. You also won’t need to search for different agencies to fulfill your design, branding, testing, installation and integration, and maintenance needs — here at Fora Soft, we do it all.

We’ll even go so far as to say that we’re pioneers of video communication. After all, we created our first animated chat in 2005, the same year as YouTube was born. And we developed the first video chat for Russia’s largest social network, back before Facebook had even thought about video chatting.

We’re incredibly proud of the great products we’ve helped bring to life – thank you, dear clients, for your trust and these opportunities! And there’s nothing we enjoy more than hearing about how our work has driven success for you (and even helped to save human lives!). That’s why partnering with Clutch, a B2B reviews platform, made perfect sense to us. Clutch enables interested buyers to search for agencies and explore top solutions across various industries and locations.

We’re also happy to share that DesignRush, a platform that helps to find the best qualified agency for any project, has included us to the Top App Development Companies of 2020.

To see more of our past work, check out our profile on The Manifest, a business resource that helps buyers find the best firms, and Visual Objects, a creative portfolio site that connects businesses. We’ve gotten other glowing reviews from BrainCert, a cloud-based educational platform; Intelligent Video Solutions, a video technology company; and Fluencing, a language platform. We serve a wide range of clients, but with a narrow need – video and multimedia software. It’s a pity these listing websites do not have such a specific category, or we’d be high in that one ? If your need is video or multimedia software product – don’t wait, contact us now! We are happy to share know-hows gathered for almost 15 years, and with us you might get breaking ideas much faster than just googling.