Sunday, May 29, 2016

Why I'm charmed by FireBase

What is Firebase


Firebase is a cloud service provider for mobile and web developers.

It was originated as real-time database service in 2011 and still it's the crucial characteristic of it.

But with it, Firebase offers the huge amount of features. Like built in Analytics, App Indexing, Hosting, Authentication, brand new Dynamic Links, Notification handling, Crash Reporting, and AdMob.

Most of these are totally free. There also paid plan featuring testing and Google Cloud Platform integration.

These features are new and were presented at Google I/O 2016, for me it was one of the most exciting parts of the keynote. I didn't put it in My Top 8 Announcements From Google I/O 2016, though. Because I think it worth to write a separate post about.

What I like the most about it is that it gathers almost all backend that you need for your mobile or web app in one place and manages everything for you. You don't need to connect your app with Google Analytics, AdMob, a real-time database, etc. separately, now you can have all these in one place.

And new features like Dynamic Links and Remote Config are awesome. They bring user experience to the new level without any hard work from the developer.

Dynamic Links

The most annoying issue in mobile for me is that browsing experience is always inconsistent, unlike the web.

Deep Links were here to solve the problem, they were great in theory, but in fact, they didn't work as we wanted.

Dynamic Links also don't solve this problem completely (Instant Apps do) but they ease the pain from it and do it way better than classic Deep Links.

Basically, Deep Link is the URL that knows about your users' context and depending on that context it can provide various behavior.

It can get your user to your website/app store page or directly to your app depending on whether your application is installed on the users' phone. It will behave differently on Android, iOS, and desktop.

The most remarkable part is that it can survive app store installation process and you can use the context of your user to bring him the best service when he opens your app for the first time or bring him to particular content within your app (for example some recipe in cooking app) that was encoded in the link.

Dynamic Liks are the base for Firebase Invites.

Invites

These really can help you to grow your app. People are most likely will use your app if they receive an invite from a friend.

It's not a new concept. Invites were invented long time ago, but developers were on their own in implementing them.

In the beginning, there were referral codes and I can't imagine that someone will be doing this copy-paste-email-copy-paste mess for %5 discount.

After that, developers started using referral links to achieve the similar effect, but still, the mess.

Some apps have UI for invites that are very convenient, a user just need to make 2-3 taps to invite a friend and the invited friend should do 2-3 taps to start using the app with the help of Deep Links.

But do you have time to implement that? Your main care is your app, not bells and whistles. But invites are important bells and whistles, invites can make the difference between success and failure of your app.

Fortunately, Firebase team did all the dirty work for you and brought Firebase Invites to you, so you can focus on your app functionality instead of making your own invites.

As I said, they are using Dynamic Links so you can be sure that UX will be fine.

And when you have an audience you need to re-engage with it. Remote Config will help you to do so.

Remote Config

We live in information century and today this information transfers really fast, we need some tools that will help us to react to this and bring better user experience across all devices.

One way to handle it is updating your app, but to do so you need to pass through all these development cycles like redesigning, redeveloping, testing etc. it's too slow, you can lose your users while trying to bring the new update.

To avoid this FireBase presented Remote Config. Essentially, it's key-value table that is stored in the cloud. But despite its' simplicity, it's all you need to react incredibly fast to feedback from your users.  

We are not prefect, we can do typos in our apps' text, and this is hraming user expreience, but now we don't need to repuload our app in app store just because of typos or something like that, just chnage the value of string with typo in your Firebase Console and you're done. (typos are annoying, aren't they?)

People from Firebase shared a great use-case for mobile games.

Consider you have a group of people that are too good in your game. They are getting 3 stars at any level. It's not what games are about, right? They want the challenge (remember flappy bird?), something that will make them try harder.

Ok, so you can bring them the challenge, make this levels harder, but they are the only group, what will be with other users?

It's not a problem now! There is a feature called Audience Segmentation that allows you to apply different configurations for different groups of users. You just make level settings to make it harder for those users that making great success in your game and you're done, again.

Also, you can use it to test a new feature on a small group of your users before showing it to everyone.

But wait, where you will get this all information, about what your users need the most.

Here's where Analytics come in.

Analytics

Analytics is not a new feature. Firebase Analytics just gather all analytic tools in one place (and that's as I said one of the greatest things about Firebase).

What I like the most in Analytics is Audiences. 

You can group your users by how they behave in your app. Are they making purchases? Are they from Japan? Are they too good in your game? Knowing all this you can provide different service to different users. Make your app flexible. 

And you can make your own custom events that will describe the group of users.

For example, if you have an online store app like eBay, you can make Audience of users that have a car (using Awareness API, that I will discuss in later posts) using the custom event to send them notifications about sales on items related to vehicles and increase your revenue from it.

Summary

Firebase is a generalization of developing experience since the moment the Intenet was invented. It has a plethora of tools for developers that'll provide great UX. 

I didn't try it out yet, but can't wait to get my hands on it and be sure I'll share the experience of using it in this blog.

There are many other features if Firebase to develop your app, grow it, and earn from it. These are just most important in my opinion and if you want me to describe them too just let me know in the comment section below.  

You can find the docs and other information here.

This is all for today, see you next week!

Sunday, May 22, 2016

Top 8 Announcements From Google I/O 2016



For last 4 years, Google I/O is one of the most important yearly events for me. I always watch it with admiration of a child.

Google I/O 2012 was really great and the keynote was astonishing. Google Glass presentation alone was enough to blow my mind.

Google I/O 2016 started May 18 and lasted up to May 20 and I think it was much better than the last two. Google announced many new things and some of these I really can call innovative (such as Clear All button in recent apps screen, thank you Google).

So let's review some of the new announcements.

Virtual Reality Comes To Your Phone


On the keynote, Google presented brand new virtual reality platform called Daydream. It's built on top of Android N and allows you to go virtual with just your phone. 

The main idea is that virtual reality should be accessible for anyone, anywhere. And Google Cardboard showed us that it can be.

And now Google taking it seriously. They presented specs for phones that they call Daydream-ready and Google says that some of them will be available this fall from such manufacturers as Samsung, HTC, LG, and Huawei.

Also, there are reference designs for headsets, that will bring us a variety of headsets from those manufacturers.

Apps for Daydream are already shipping from companies like The NewYork Times, Netflix, HBO. But what is a virtual reality without games that will bring you into the action and cause adrenaline surge? Ubisoft and Electronic Arts are already developing for Daydream too!

Google itself made VR versions of their apps. Such as YouTube, StreetView, Play Movies, and Google Photos. Also, there is VR version of Google Play Store so, you don't even need to install apps before going virtual you can do it on the fly.




Assistant

In the beginning of the keynote, Sundar Pichai announced Google Assistant. It's more intelligent version of the software that handled requests to Google Now.

It has similar to Google Now functionality but it's aimed at conversation and context of requests. You can ask it a chain of questions or request and it'll behave depending on the context of your conversation with it. 

For example, during the keynote, Sundar Pichai asked Assistant about movies that were playing tonight, and after a short conversation, Sundar ended up with 4 tickets to Jungle Book. By the way, he mentioned that he have already seen it and it's great, so great that it worth to watch several times.

I think, that it's great how Google and other companies bring fundamental researches to the users. Assistant brings years of Googles research in the field of natural language to your phone, watch, car, desktop, and even home.

Google Home

Google Home is a layer between the devices for home and the user.

Generally, it's the computer that is always at your service and it integrates into a broad range of other services. You can change temperature or lighting in your home with something like Nest, play your favorite songs from Spotify, play a movie on your TV, or just make requests like you would do with Assistant on your phone.

When Google will provide API for Google Home number of its applications will only grow. And we will have "an ambient experience that extends across devices" as Sundar said.

Communication


Throughout the keynote, Google presented two apps for communicating with those who matters.

One of them is Allo

It strongly reminds me Telegram. Allo provides emojis, custom stickers, and message encryption. Also, there is the ability to draw on photos before sending them and to set the font size of your message. 

And has two options of signing up with your phone number, or with your Google account. Also, it's mobile-only that I personally think is the disadvantage.

The reason, why it reminds me Telegram is that there is built-in Google Assistant that works just as Telegram bots. You can write directly to @google and ask questions or make reservations, scheduling etc. or you can call to it in your conversation with someone else, so the other person would see its answers. In my opinion, it's generalization of Telegram chat bots.

Also, Assistant can suggest you quick answers to your friends' messages. It even can determine what pictured in the photo that your friend sent and generate an answer based on that. In Google, they call it "suggestion chips".


And the host Eric Kay is a really funny guy. It'd be great to have a conversation with him using one of the new Googles messaging apps. :) 

Video chats become more natural with Duo

Duo is a video chatting app that will compete with Apples' FaceTime. Splitting up messaging and video chatting is a great decision that Apple made a long time ago. It keeps both apps clear and simple and doesn't mess up the user experience. 

There is the feature called "Knock Knock" that shows you the preview of the person that calls you before you even answer. In my opinion, it makes this video chatting more natural because in real life you really see the person before starting a conversation.

 Here is the self-explanatory video

Android is constantly growing

The reason why I chose Android development over all other software development fields is because Android is growing really fast. You will never be bored if you are an Android developer, every year there's something new. You can build apps for mobile, tablets, desktop, cars, watches almost everything that touches us in our everyday life. 

New in Android N

What was presented in I/O is primarily features that were in the developer preview. Such things as new emojis, split-screen mode, and quick settings. Also, there were presented new features including new notifications and picture-in-picture multitasking mode for android TV.

For developers, there are Java 8 support and the bunch of new APIs.

N provides new graphic API called Vulkan which is low-level, low-overhead, cross-platform API for high-performance, 3D graphic and I think it's really great for Daydream.

N is in beta until later this summer, and you can try it today. 

Also, Google encourages you to come up with the name for the new version of Android. I suggested Nobannic which is reversed Cinnabon.

Android Wear 2.0

Google announced the biggest update of Android Wear since 2014. 

It makes your wearable devices more autonomous and less dependent on your smartphone that means, that it's not anymore required to bring your smartphone anywhere you go. Taking into account that many people using watches for sports activities it's a great update.  

Also, there are features like automatic exercise recognition, that will help you to track your sports goals without direct action to do so.

And now you can show information from any app on any watch face that makes them more customizable.

Ambient browsing experience

For me, it seems like some kind of magic. I don't really understand how it works yet but it's relly nice feature.

I talk about Instant Apps. This was announced during the keynote as well and it really enhances the way mobile users browse the web.

The main idea is that you don't need to install an application to open it on your phone. Now Android loads required parts of an application when you need it. 

Imagine, your friend sends you the URL to Star Wars movie page on IMDB and you have no IMDB app installed and instead of opening it in a browser it will open this page as if you have this app. 

Really nice feature.

Summary

It's very few of what was presented on Google I/O 2016. You can watch all recordings on I/O 2016 page.

I will post about I/O for several weeks because there were really many new things, especially for developers.

So, see you next week, peace.

P.S. Leave your comment in the section bellow and let me know what You've liked the most from I/O 2016.

Sunday, May 15, 2016

Why You Should Probably Stop Follow Your Passion

Kind of strange title for a blog which aims at motivating people to learn, isn't it?

But I really think that passion is not moving people forward much. Passion is unstable and inconsistent. It can be helpful on first steps but after that, it leaves you with yourself.

What Is Passion

To avoid any misunderstanding I want to define what I mean when I say "passion".

I personally, see passion as an imaginary friend that I think will do much of the work with me. When you just starting out, it's really great to have that one friend because you think that you can move heaven and earth. But with time passion leaves and you don't feel like doing anything you started with it.

Look at this as walking with someone arm-in-arm. You two maybe want to move with different speed, but often this speed defined by the slowest one. And it's sad to admit, but passion is slowing down every day, and one day it just stops.

But how to overcome this? How to keep you doing what you was so passionate about? I think there is an answer.

Stop Follow Your Passion

I think that by just blindly following your passion you will not get valuable results and will be disappointed in what you were passionate about.

I'm talking about it because I know it firsthand. I have plenty unfinished projects that I was passionate about. All of them now just are gathering dust and I think I'll never go back to them.

Yes, you should just stop it. But it doesn't mean that you should stop doing what you were doing. No, but you should stop relying on that imaginary friend. 

I think that habit of relying on someone else comes from our childhood when parents supply us with all the necessary things, such as food, clothes, a roof over your head etc. And despite that we are grown up, independent people that habit remains. 

And as every habit, it's possible to give it up. Let's consider how.

Giving Passion Up

Subconsciously we want work to do it itself (or the passion imaginary friend will do it). We concentrating on the result but always ignore the process. 

The process is the main part of success!

It's important to realise where you want to come, but you can't get anything done without doing it.

In this terms, Shia LaBeouf is absolutely right. Just DO IT!


Many people experiencing "lack of motivation" because this motivation is all they had. They went all in with this motivation and lost.

You should have something else besides motivation/passion. 

I think that the best thing you can have is routine that you keep up no matter what. With routine things become easier.

And the most suitable time to build your routine around something is when you most passionate about it. 

You (probably) brush your teeth every morning and every evening. Do you need to be motivated to brush your teeth? I think no. It's just your routine and you do it no matter what.

You should extrapolate this approach to other things you doing. Especially ones you want to succeed in. 

Define hours when you code, hours when you learn new things, hours when you eat and even hours when you sleep.

After that even if your motivation is gone you left with your schedule that will help you to reach your goal.

For Example


This is my personal schedule. Seems little bit scary. But it's flexible can change depending on what I want to achieve and my university schedule. (Kanbanflow is the software that helps me to track my tasks)

Now, consider this blog when I was just starting out (actually, I am just starting out), I defined that I will write a post every week on and publish it by 2 p.m. on Sundays. It's my 9th post (not counting Hello World post). In march 2017 I'll have 48 posts and the year after that I'll have 96 posts, 192 posts in 4 years etc. 

No matter how motivated to write I was on Sundays. With time, I will have a big blog with much content to read. And I will get all the benefits of blogging.

These benefits (especially for a software developer) and ways to get them you can find in free email course How To Create Blog That Boosts Your Career made by John Sonmez author of Simple Programmer blog. Many ideas I've got from his book Soft Skills: The software developer's life manual and encourage you to read it too.

Summary

Passion is a great kick starter, but it can't be used as a fuel. 

Great fuel is the discipline. 

Discipline is the thing that will push you forward from milestone to milestone. And moving from milestone to milestone you will acquire new passion for starting something new.

Discipline is the basement for growth. And in our constantly changing world growth is crucial even if you want to stay put.

So go ahead, build your schedule and make your success closer every day. No one will do it for you.

See you next week, peace!

Sunday, May 8, 2016

Principles Of The Material


Hi! today we will talk about Material Design.

It was presented at Google I/O conference in 2014 just as a concept and became popular very fast. Many app developers started to redesign their apps even without any help from SDK. And to be honest, they didn't even understand what Material Design is, primarily because even Google didn't really understand what it is. But at the moment, it's clear and understandable.

With time Material Design got support from SDK and now we can build colorful, responsive, natural layouts with the very little effort.

Material Design was invented with the endeavor to bring more of a real world to the digital space but keep it minimalistic. To achieve this goal three principles were stated.

Digital paper

Digital paper is the metaphor to reach the understanding of what is happening on the screen. 

Computers and digital devices were designed to reduce all the paperwork in our life but paper is still a convenient way of storing and transferring information (I still use sticky notes). It's easy to focus on what is shown on a paper piece and using this we can easily control user attention (the main goal of all design concepts). 

Considering this Google studied paper and ink and come up with this brainchild. 

Digital paper has great advantages it can be resized, reshaped, repainted etc. to attract users attention and keep things clear. In everything else digital paper behaves just like a real paper. It casts a shadow to provide depth on your screen and can be split into pieces if necessary. 

Polygraphy

When you use the paper you will probably want to use printing design. 

Printing design develops since 1440 when Johannes Gutenberg invented the first printing press so there was no need for Google to invent something new. They just took the best from modern magazines.

If you look at proper material design app you'll see that it's very similar to a magazine despite the purpose of this app.

Colors, Images, and Typography should be in balance to control users attention and reach the better understanding of your content.

Animation provides meaning

In the real world, nothing comes out of nowhere and nothing disappears in a blink of an eye (there are exceptions quantum physics). Every motion has its own meaning. If this were not so it would be impossible to live in such a world. 

Imagine that you're walking on the beach and a ball appears in front of your face, you even don't have a chance to dodge it and it hits you hard. Do you want to live like that? I think the answer is no, so let's don't make your users to do so.

I can't say better than the Material Design Guideline

Just as the shape of an object indicates how it might behave, watching an object move demonstrates whether it’s light, heavy, flexible, rigid, small or large. In the world of material design, motion describes spatial relationships, functionality, and intention with beauty and fluidity.

Also, there is a forth implicit principle.

Adaptive Design

In the world of the digital clouds, many apps are multiplatform. But for a user, it can be really painful to adapt every time he changes the platform. Google Inbox is a good example of a consistent app. You can read your mail from any device and don't feel any discomfort passing from one to another.

The beauty of Material Desing is that its guidelines can be applied to any form factor and for any purpose. 

Whether it be a TV, watches, car display, mobile phone, desktop etc. you can go by these three principles to build a nice looking app on any device.

Finally

Don't think about Material Design as about strict set of rules. It just summarizes the experience of many years interacting with users and readers.

It provides us with the platform from which we can start thinking about our own design rules and principles to make it even better. Its guidelines are regularly updating with new rules and tips and who knows maybe you will be next trendsetter of Material Design.  

All these principles and how to use them carefully described in Google Material Design Guidelines with examples ho to do and how not to.

Armed with that you can build well-designed apps that will keep users focus on what really matters.

Okay, that's all for today.

See you next week, peace!

Saturday, May 7, 2016

Tutorial: Flexible Space With Image Action Bar

Android Support Library

Android Support Library provides many useful features for android developers and doing it with backward-compatibility in mind. Watch this video where Ian Lake explain why it's so good (it's just me or his smile looks terrifying? Leave your thoughts in the comment section).


As you may guess we'll use design part of this library, actually a small part of the design part. To be able to use it in your project you should add a gradle dependency.

compile 'com.android.support:design:23.3.0'

Flexible Space With Image is a scrolling technique that was presented as a part of the material design and Android Support Design Library makes it really easy to implement one and also makes it backward-compatible so you don't need to write a code mess to support it on each API.




We can achieve this effect with very small amount of java code using XML primarily.


We’ll use CoordinatorLayout, AppBarLayout, and CollapsingToolbarLayout.

CoordinatorLayout actually is what you probably think it is. It's layout that can coordinate its child layouts between each other. With other layouts from Support Desing Library, it provides an implementation of nice scrolling techniques of material design.


AppBarLayout is basically vertical LinearLayout that is ahead of the game. Its child elements can change behavior while scrolling. It provides full functionality only if it used as direct CollapsingToolbarLayout child.

And CollapsingToolbarLayout. This speaks for itself. It's a toolbar and it can collapse :). Remember that it's designed to be a direct child of AppBarLayout.  

Also, you'll want to use NestedScrollVIew or another scrollable layout to see all impact.

Let's continue to build the messaging app from the last tutorial, and we will make profile activity.

The XML code will be something like this

<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="true"
    app:contentScrim="?attr/colorPrimary">

    <android.support.design.widget.AppBarLayout
        android:layout_width="match_parent"
        android:layout_height="300dp"
        android:fitsSystemWindows="true"
        android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">

        <android.support.design.widget.CollapsingToolbarLayout
            android:id="@+id/collapsing_toolbar"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:fitsSystemWindows="true"
            app:contentScrim="?attr/colorPrimary"
            app:expandedTitleMarginBottom="32dp"
            app:expandedTitleMarginEnd="64dp"
            app:expandedTitleMarginStart="48dp"
            app:layout_scrollFlags="scroll|enterAlways|enterAlwaysCollapsed">

            <ImageView
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:scaleType="centerCrop"
                android:src="@drawable/strange"
                android:fitsSystemWindows="true"/>

            <android.support.v7.widget.Toolbar
                android:id="@+id/toolbar"
                android:layout_width="match_parent"
                android:layout_height="?attr/actionBarSize"
                app:layout_collapseMode="pin" />

        </android.support.design.widget.CollapsingToolbarLayout>

    </android.support.design.widget.AppBarLayout>

    <android.support.v4.widget.NestedScrollView
        android:id="@+id/scrollableView"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:layout_behavior="@string/appbar_scrolling_view_behavior">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical"
            android:padding="16dp">

            <TextView
                android:id="@+id/number_textview"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginBottom="16dp"
                android:text="+1 234 5678 90" />

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="Description"
                android:textColor="@android:color/black"
                android:textSize="20sp" />

            <TextView
                android:id="@+id/description_textview"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="@string/strange" />
        </LinearLayout>
    </android.support.v4.widget.NestedScrollView>

</android.support.design.widget.CoordinatorLayout>

Let's talk about attributes.

I think that the most important one is layout_scrollFlags it determines how AppBarLayouts children will react to scrolling. There're 5 flags: scroll, enterAlways, enterAlwaysCollapsed, snap and exitUntilCollapsed.

layoutCollapseMode attribute will define how elements will behave while collapsing.

Here's how it looks.



By the way, you should use a theme without action bar for this code to work. Use theme like this.

<style name="AppTheme.NoActionBar">
        <item name="windowActionBar">false</item>
        <item name="windowActionBarOverlay">true</item>
        <item name="windowNoTitle">true</item>
</style>

And set theme attribute of your activity in AndroidManifest to AppTheme.NoActionBar

<activity
            android:name=".ProfileActivity"
            android:theme="@style/AppTheme.NoActionBar" />

There is a very few Java code that you need to write to make it perfect.

public class FlexibleActivity extends AppCompatActivity {

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

        //Initialize toolbar
        Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
        //Set custom title
        toolbar.setTitle("Doctor Strange");

        setSupportActionBar(toolbar);
        //Show "back" button
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);


    }
}

It'll set the custom title in the toolbar and show back button to return to parent activity (if your activity has one).

In the end of the day, this will look like that.



Okay, that's all for today, feel free to ask any questions in the comment section below.

Stay tuned to learn more tweaks with CoordinatorLayout.

See you in the next one, peace!

P.S. You can look at my code on my GitHub repository