close

Android Development

Android Development

How to make money on Fiverr as a creative professional

Fiverr is a site that allows creators and entrepreneurs to sell their services, in a similar manner to UpWork or Freelancer. However, Fiverr stands out by being more flexible and having a personality entirely its own. In this post, we’re going to look at how to make money on Fiverr and flex our creativity. You’ll see that it’s much more than a gimmicky way to make a quick buck, and that there is actually a lot of potential here for a resourceful seller.

There is actually a lot of potential here for a resourceful seller.

The concept: anything for a Fiverr

My friend once paid someone on Fiverr to sing happy birthday to his girlfriend while dressed as cupid

If you want to know how to make money on Fiverr, first you need to understand how the marketplace works and what makes it unique.

Fiverr gets its name from its initial central concept: that you could get anything for a fiver. Back in the day, this would include a vast range of services, many of which were extremely unique. My friend once paid someone on Fiverr to sing happy birthday to his girlfriend while dressed as cupid and jumping around a forest (delivered via video, not in person thank goodness!).

Also read: How to make money online from a digital product

You can likewise use Fiverr to get yourself a portrait, a caricature, a voice actor to read an advertisement, photo editing, poems, and much more.

I used Fiverr as a seller during this period and had some success with it. I sold bespoke personal training programs for people who wanted to get in shape, and was featured in a national newspaper!

Training Program Fiverr Adam Sinicki

My Fiverr Gig in the paper!

When speaking with the journalist (who was writing a piece about outsourcing her life), I learned that she had also interviewed other sellers on the platform. One woman was able to make a full-time salary from writing brand names on her body and providing the photos! This isn’t uncommon, it turns out.

Also read: How to use LinkedIn and land your dream job!

While I enjoyed this exposure, it quickly became obvious that selling customized training programs for just $5 was not a profitable enterprise. It simply took too long! This was especially true as Fiverr took a $1 fee, meaning that I only received $4 per gig.

One woman was able to make a full-time salary from writing brand names on her body.

The evolution of Fiverr – selling for more

This is what Fiverr was all about for a long time, but it did somewhat limit what the site was capable of offering. Eventually, it added the ability to upgrade orders with extras that creators could charge more for.

Fiverr logo

This drastically altered the scope of what could be sold on Fiverr. In my case then, I might be able to offer a generic training program for $5, a customized one for $50, or an online consultation and ongoing support for $250 per month. Suddenly, it becomes very viable to make money on Fiverr in a much bigger way!

Also read: 7 easy passive income ideas to make money while you sleep

Sellers and buyers responded well to this change, and so over time Fiverr underwent something of a rebrand and change of focus – introducing an entire new market called Fiverr Pro. Now the platform places greater emphasis on professionals with serious skills to share.

This drastically altered the scope of what could be sold in Fiverr.

How to make money on Fiverr Pro

To open a pro gig, a seller needs to be “Pro Verified.” This indicates that a seller really knows what they’re talking about. To become Pro Verfied, you simply need to submit an application detailing your expertise, qualifications, and back catalog of work. There is no fee and anyone can apply.

Also read: What is the gig economy? Why the future of work is online

New pro features also include seller requests. This lets sellers post requests for specific work they need completed. Pro sellers can also complete courses in exchange for a “badge” to demonstrate their professionalism.

Fiverr Pro offers gigs divided into specific categories. At the time of writing, these are:

  • Graphic and Design
  • Programming and Tech
  • Writing and Translation
  • Video and Animation
  • Digital Marketing
  • Music and Audio

But the company has plans to add more over time, and there is nothing to stop you from listing the more obscure gigs in the main marketplace too.

how to make money on Fiverr services

It’s common to find gigs that start at tens, hundreds, or even thousands of dollars. These include everything from professional digital art, to programming, to article writing, and much more. For the most part this works, and now those service providers sit comfortable alongside the cupid-impersonator-singers.

It’s common to find gigs that start at tens, hundreds, or even thousands of dollars.

Who is Fiverr for?

Perhaps then the next relevant question for programmers, copywriters, data security analysts, and video editors to ask is: should you explore how to make money on Fiverr, or should you stick with tried-and-true options like UpWork?

Work Online Make Money Wallet

The answer may surprise you.

If you are someone who sells a more creative or less easily-defined service or product, then Fiverr is a great option. If your specialty is jumping around dressed as cupid, then you’re not going to find many takers on UpWork!

Also read: How to find online writing jobs as a copywriter

Fiverr is a good option if you want to appeal to a slightly younger and more creative audience. Video editors will find this is a great place to find YouTubers to work with for example. Illustrators and photo editors can design thumbnails, or touch up Instagram photos. Musicians will likely be able to find a few indie game developers to work with. If you know how to make money on Fiverr, then you can have a lot of fun here working in creative ways.

You can have a lot of fun here working in creative ways.

Fiverr Pro vs UpWork

Upwork logo

There is also a lot to be said for Fiverr Pro. As you create specific services and packages to sell on Fiverr, that puts you in control of what you offer; rather than leaving you reliant on the whims of others. You aren’t selling “programming services,” but rather you’re offering to build an app with X many activities that takes no longer than N hours.

Also read: Top freelance sites for finding paid work online

Moreover, the more modern design of Fiverr allows you to use videos and images to help make your offer seem more appealing. This can actually be a big advantage when targeting the right kind of buyer. That’s how to make money on Fiverr Pro.

That puts you in control.

That said, larger corporations tend to use sites like UpWork, PeoplePerHour, and Freelancer. If you’re looking for long-term employment, or if you want to be considered for large corporate projects, then Fiverr is not the best strategy.

Also read: How to work as a software developer online: Everything you need to know

It’s also important to consider the commission that Fiverr takes. Remember I said before that Fiverr used to take $1 for every $5 gig? That 20% rate still exists, which is on top of PayPal’s commission. That’s the same starting rate as UpWork, but that platform reduces the commission the more money you make. Sites like PeoplePerHour and Freelancer charge even less!

How to make money on Fiverr Pro

There are ways that you can circumvent this limitation. But this is not a long-term solution.

This may be why big businesses still avoid Fiverr.

This may be why big businesses still avoid Fiverr. But on the flip side, that also results in a somewhat less saturated market if you provide professional services. If you know how to make money on Fiverr, you can be extremely competitive here.

How to make money on Fiverr – tips and advice

So, how do you make money on Fiverr? Here are some of the best tips that will help you to start making money and turn this into a successful side hustle!

Choosing your gig

The key is to understand how to provide your service as a package. Find a way to deliver the maximum value, in the minimum amount of time, while targeting someone specific with a particular service or product.

Thinking this way means that rather than listing yourself as a photo editor and illustrator, you are instead listing yourself as a thumbnail designer. This appeals to the entrepreneurial creator who finds themselves browsing for ways to make their channel more professional, and also allows you to appear in relevant searches.

Also read: Easy side hustles you can use to start making money today

A service can even combine multiple skills. You could offer an entire brand design, including logos, video openers, and more. Think about ways to make your skills stand out by combining them in useful, different ways. Choosing something you enjoy is another important tip if you want to be as successful as possible. Consider searching through our back catalog of posts to find ideas for professions you can try out. It’s a safe place to experiment!

Find a way to deliver the maximum value, in the minimum amount of time.

Think carefully about your title. This is what will grab attention and what will help to simply explain the service you’re offering. Try taking a look at some of the other gigs on the site that are working well, and ask what you can emulate about those. Note the structure that starts with “I will….”

Fiverr Gig

When describing the gig in the description, make sure to be as clear as possible about what you’re offering and what’s included. This can help to avoid confusion later on, meaning less hassle and happier customers.

The details

Breaking down your service into tiers is also a good idea. Where possible, having a more affordable offering (ideally a fiver!) will also help you to draw in your audience, while also playing nice with the culture of the site – increasing your chances of being featured. At the very least though, you should aim to have an “introductory” price to help attract unsure buyers. If they’re impressed, then they might consider placing a bigger order next time! Take a look at competitor offers for ideas about pricing.

Also read: How to become an Associate Android Developer, and is it worth it?

You will be able to choose a turnaround time (TAT). People generally want their jobs completed as quickly as possible, but you need to think carefully about the number of orders you can handle, especially if you get a sudden flood of people coming in! Creators and gigs can be reviewed by their buyers, which will result in comments on your page as well as a star rating. This will play a role in your visibility, and can have a big impact on your likelihood of being hired for future gigs.

Remember: under promise and over-deliver! If your TAT is 4-5 days and you deliver your work in 3 days, that’s a sure-fire way to get a positive review. Want to know how to make money on Fiverr? Just keep delivering a quality service!

iPad Mini 5 Workflow Writing Working Online

Note: Fiverr does show how many orders are “queued” and it is possible to set a limit to prevent being inundated. This is a very useful feature!

Standing out

When describing your gig, you need to pull out every stop to make it look and sound amazing.

Pull out every stop to make it look and sound amazing.

That starts by making yourself sound amazing. List your previous experience, your qualifications, and your past projects. Show positive testimonials, and do what you can to bulk up your CV. We’ve talked on this site about a wide variety of different certifications and qualifications you can get to improve your employability. This would be the perfect opportunity to put those to use!

Also read: Microsoft Certification: A guide for tech professionals

But the real key if you want to know how to make money on Fiverr? That would be your video. This is particularly important for B2C sales, though it can make a big difference in B2B offers too. Your video gives you an opportunity to show yourself and help build trust and familiarity with your potential buyers. It lets you showcase your portfolio of previous work (don’t have one? Make one!), and it lets you leave a lasting impression with high calibre music and editing.

eBook Digital Product

If you don’t know how to create a video, then I highly recommend that you hire someone to do it for you. And guess where you can find someone to do that!

Also read: Adobe Certification is a great career move for creative professionals

Productizing a service

If you want to know how to make money on Fiverr easily, then consider “productizing a service.” This means taking a service (such as video opener creation) and automating it as far as possible. For example, instead of letting your clients choose the orders they want, you instead create a specific effect – let’s say text with fire behind it – and save it as a project in After Effects. You are selling this opener, but with the buyer’s logo. As such, all you need to do to deliver the order is to change the text and then export a new video file!

Also read: Best online business courses to supercharge your career

You can even sell ready-made products this way, such as eBooks or online courses! The audience for this kind of work is limited, but as it’s a near-passive revenue stream, there’s not really a downside to trying.

Closing comments

Make Money Online Wallet

There are plenty more things to consider when selling your service on Fiverr; from how you’ll deal with difficult clients, to how you can market yourself and get noticed. We’ll cover all this in future posts, but for now you should have enough information to get started. Now you know how to make money on Fiverr, it’s time to start experimenting!

read more
Android Development

How to add 3D graphics and other Unity features to your native Android apps

The latest Unity beta build 2019.3.a2 brings the ability to integrate its runtime components into native apps developed with Android Studio. This opens up a host of possibilities for developers. Here’s why it matters to you, and what you need to know to get started.

Unity

Why you should care

Unity is an extremely powerful and flexible tool for game developers that makes it easy to build apps and games on Android and across platforms. It is, in fact, the most popular game engine on the Google Play Store, and has been used to create many of its best-known and most-loved titles.

Also read: Unity certification for developers: Is it worth it?

As a game engine, Unity makes it extremely easy to render 3D graphics to the screen, implement realistic physics and lighting, or integrate AR and VR content. Doing the same is infinitely more arduous and complex when using Android Studio alone.

Programming C Coding Developer

But while this is true, Unity is also limited in some capacities. While it’s possible to make non-game applications with a bit of out-the-box thinking, this is definitely not its intended purpose and it shows.

Unity makes it extremely easy to render 3D graphics to the screen, implement realistic physics and lighting, or integrate AR and VR content.

If you want your app to use web views, text boxes, or other features, then you’re better off using Android Studio. This is particularly true if your goal is to conform to the Material Design guidelines. Likewise, many native features are completely inaccessible through Unity alone.

Also read: Unity 2019.1 brings exciting new features for Android developers

It’s a case of “horses for courses” then, but what if you want the best of both worlds? By using Unity as a library, you’ll be able to use a regular Android app layout with all the features of a regular Android Studio project, but with integrated 3D graphics, AR elements and more.

Developers might use this to build regular apps with 3D animated backgrounds and elements. Unity suggests that brands might likewise use this feature to integrate AR marketing features. Let us know in the comments how you see this being used!

Unity development

The other good news is that it should theoretically be possible for developers to take their existing apps and simply add the 3D content.

How Unity as a library works

To use this feature, you’ll need to create your Unity content as a regular Unity project. You’ll also need an Android Studio project that you want to integrate this into, and you’ll need the latest versions of both Android Studio (3.3.2 at the time of writing) and the latest Unity beta (2019.3.a2).

Unity Android Integration

From Unity

You will use the Unity editor to build an APK and will place this in a folder called androidBuild. Both this and your native project should be contained in the same folder.

You’ll then add the Unity Library module to your native app by making a few edits, and you’ll need to display the Unity content via your native project’s code.

You can find detailed instructions, along with a sample project here. It’s a relatively straightforward process and with a little reverse engineering, you should be able to follow the same steps in your own projects.

Closing thoughts

Undoubtedly, this is going to be a useful option for some developers. And it’s great to see a feature like this from Unity.

There are some limitations imposed on the feature though. Unity only supports full-screen rendering for example, meaning the notification tray won’t be visible at runtime and you can’t load games into views within a larger app. Likewise, you won’t be able to use more than one instance of the Unity runtime at once. Certain third-party plugins may need some also adapting.

Unity is also keen to point out that as it is no longer controlling the lifecycle of its runtime, it can’t guarantee perfect operation at all times.

There are some limitations imposed on the feature though.

While the basic process seems easy-enough to follow, several users have already reported bugs and issues that they’ve run into. We should keep in mind that this feature is still in beta. But with Google updating the Android platform at a rate of knots, I wouldn’t be surprised to find compatibility issues popping up down the line. This has been a problem with some other partners, such as Oculus.

We’ll have to wait and see. But even if this isn’t always the smoothest process, the ability to use Unity as a library in Android Studio is certainly a very welcome addition and one that I’m sure many developers will embrace with open arms. What do you think?

read more
Android Development

How to become a machine learning engineer

When you stop to think about it, the future can be a little daunting. It’s filled with AI, automation, 3D printing, virtual reality, IoT, and other concepts that until now seemed like science fiction. But if you understand these ideas, it can also be a place filled with opportunities. For example, by understanding the basics of AI and big data, you could carve yourself out a career as a machine learning engineer. Not only could that land you a very healthy machine learning engineer salary, but it could also help you to shape that very future.

In this post, we’ll take a look at what a machine learning engineer does, why it’s a great job role, and how you can get started.

Why machine learning?

Machine Learning Engineer Data Science

Machine learning (ML) allows companies to make use of huge data sets for applications that would previously never have been possible. ML algorithms can learn the habits and buying behaviors of customers, perform incredibly complex mathematics, and enable entirely new products.

Almost every industry is going to be greatly impacted by AI and machine learning in the near future, and in ways that you probably wouldn’t expect. Take video games for example, where machine learning has made real-time ray tracing possible, resulting in photorealistic lighting. Every industry stands to be utterly transformed by the marriage of data and logic.

Also read: Is your job safe? Jobs that AI will destroy in the next 10-20 years

It’s for this reason that data scientist has been called the “sexiest job of the 21st century” by Harvard Business Review.

What is a machine learning engineering salary like? According to Prospects.ac.uk, the average machine learning engineer salary in the UK is £52,000, which can rise as high as £170,000 if you work for a company like Google or Facebook. That’s around $62,568 or $204,551.65 respectively.

A machine learning salary can rise as high as $204,551

What is machine learning?

First, it’s important to understand precisely what machine learning is, and what it is not.

AI Automation of Jobs

Machine learning is closely related to AI, but these are still distinct concepts. Whereas artificial intelligence can describe any type of program or machine designed to exhibit intelligent behavior, machine learning specifically means using algorithms to look for patterns in data. This can potentially be used to train certain types of AI.

AI that controls enemies in computer games does not typically use machine learning. Rather, it uses a kind of flow-chart for decision making, in order to respond to your actions with pre-set strategies. This is what we call an Artificial Narrow Intelligence (ANI) because it can only do one thing.

Also read: ML Ki: extracting text from images using google’s machine learning sdk

This is in contrast to Artificial General Intelligence (AGI), which is an AI designed to be able to handle multiple different types of task and even perhaps pass the Turing test.

Computer vision on the other hand – the ability of a program to identify objects in a scene – is accomplished via machine learning. By looking at hundreds of thousands of pictures, you can “teach” an AI to recognize objects like cars or plants. If your phone’s camera has scene detection, then this will use machine learning. Likewise, ML is also used to teach virtual assistants voice recognition.

Machine learning coding development

Machine learning can be used to identify health issues from x-rays and assist doctors in their diagnoses, or to more accurately predict weather. There is far more potential yet to be tapped.

What does a machine learning engineer do?

The job of a machine learning engineer is to teach AIs and software using data.

The job of a machine learning engineer is to teach AIs and software using data. They might:

  • Write programs and develop algorithms to extract meaningful information from large data sets
  • Run experiments and test different approaches
  • Optimize programs to improve performance, speed, and scalability
  • Handle data engineering to ensure clean data sets
  • Suggest useful applications for machine learning

A machine learning engineer might therefore work for a company that already produces a product — whether that’s voice recognition, computer vision, or something more specialist. Alternatively, they might work for an agency that provides machine learning solutions to businesses that can benefit from the technology. Or perhaps they might work in the R&D department for a tech company like Google to create new applications.

Also read: ML Kit Image Labeling: Determine an image’s content with machine learning

There is some overlap between the roles of a machine learning engineer and a data scientist. Likewise, you might be required to call upon skills such as data mining, predictive analytics, mathematics etc. However, the role of the ML engineer is more specific, applying that knowledge in a very particular manner.

TensorFlow Machine Learning

And of course, the machine learning engineer salary tends to be greater to reflect this.

To get an idea of the kind of thing you’ll need to understand as a machine learning engineer, I recommend this post on the top 10 algorithms used in ML. If that’s fascinating to you, then you will probably enjoy ML. If not, you might be better suited to another role.

How to become a machine learning engineer

Interested in becoming a machine learning engineer? Think you have what it takes? Here’s what you need to know to get started, and to land a great machine learning engineer salary.

Also read: How to work as a software developer online: Everything you need to know

In terms of qualifications and certifications, there is no set path to becoming an ML engineer. A lot of the jobs paying the best machine learning salaries ask for an undergraduate degree. This will often be a computer science degree, which will provide a broad understanding of computers, technology, and programming. A degree in mathematics can likewise be a great starting point.

Machine Learning Engineer

Ideally, you would then build on this with a background in software engineering and data science. The most useful programming languages in this field are Python, C, and C++.

From there, you can transition to more specialist roles in machine learning, or tailor your resume with the machine learning courses below. Experience with ML APIs such as TensorFlow and Keras will also be extremely useful.

Also read: How to use LinkedIn and land your dream job!

Due to the huge amount of processing power and storage necessary to handle the massive data sets associated with machine learning, you will largely be working with cloud-based systems. To that end, it is also important to demonstrate familiarity with distributed computing.

As machine learning engineering is such a cutting edge career, there is no one path to follow. You might even find that you can get a long way as a self-taught programmer if you’re able to build up a strong enough resume.

Courses and certifications

Here are some courses and certifications you can use to get ahead as a machine learning engineer:

Bachelor of Computer Science – This is a full online bachelor’s degree course from the University of London that will provide the perfect foundation for those that are able to dedicate the time. You’ll study for 3-6 years, and be required to put in 14-28 hours per week.

Data Science: Machine Learning – If you already have some background in programming and/or mathematics, then adding specific machine learning knowledge may be all you need. This is a free 8 week course from Harvard University. You can add a verified certificate for a small fee, and it will also count toward a Data Science Professional Certificate should you wish to pursue it further. You can find that full course here.

Foundations of Data Science: Computational Thinking with Python – Another free course, this time from Berkeley University of California. It is 5 weeks long, requiring a commitment of around 4-6 hours each week. You can pay a little extra to add a verified certificate, or you can count it toward a full professional certificate in Foundations of Data Science.

Machine Learning Specialization – This machine learning specialization from University of Washington is comprised of four separate courses and is free to enroll. You’ll receive a course certificate that you can add to your LinkedIn or CV.

Programming in C# – This exam from Microsoft counts as credit toward an MCSA, but will also help you to bulk up your CV with evidence of relevant coding skills all on its own!

Also read: Microsoft Certification: A guide for tech professionals

Learn Python Programming Masterclass – This course from Udemy won’t provide a professional certificate but is an affordable and helpful introduction to this in-demand programming language.

Machine Learning TensorFlow

So there you have it! That’s what you need to know to become a machine learning engineer. Is this a career you’d be interested in pursuing? Are you already an ML engineer? Share your tips and experience in the comments down below!

read more
Android Development

What is ethical hacking? Learn how to hack and earn money

When you think of hackers, you tend to think of people in hoodies trying to steel sensitive data from big companies — ethical hacking sounds like an oxymoron.

The truth is many people who get into hacking do so for perfectly honest reasons. There are plenty of good reasons to learn hacking. These can be categorized into neutral “grey hat” reasons, and productive “white hat” reasons.

What is grey hat hacking?

Firstly, there is the love of tinkering: seeing how things work, and empowering oneself. The same impulse that drives a kid to take a watch apart and to reverse engineer it might motivate you to see if you can equally effectively bypass the security of X program or Y.

It’s reassuring to know you can defend yourself online

Hopefully you’ll never need to hack into an email account, but knowing you could if needed (your sister has been kidnapped!) is appealing nonetheless. It’s a little like martial arts. Most of us hope never to need to fight for real, but it’s reassuring to know you can defend yourself.

Ethical Hacking

Hacking really can be a useful means of self-defense. By reading an introduction to ethical hacking, you can learn about the threats to your privacy and security out there on the web. In doing so, you can protect yourself against potential attacks before they occur and make smarter decisions. With the dawn of the Internet of Things, more and more of our lives are going to be “online.” Learning the basics of data security may soon become a matter of self-preservation.

Introducing the ethical hacker

Ethical hacking is also highly monetizable. If you want to bypass security systems for a living, there are many highly profitable career paths to that end. You can work as an information security analyst, a pentester, a general IT professional, or you can sell your skills online through courses and e-books. While many jobs are being eroded by automation and digitization, the demand for security specialists will only increase.

Ethical hacking is highly monetizable

Someone who works in any of these fields is usually what we mean by the term “ethical hacker.” Let’s explore further.

How does hacking happen?

Working at Computer Future Jobs

At a fundamental level, ethical hackers test the security of systems. Any time you utilize a system in a manner not intended, you’re doing a “hack.” Normally, this means assessing the “inputs” of a system.

Inputs can be anything from the forms on a website, to open ports on a network. These are necessary to interact with certain services, but they represent targets for hackers.

Sometimes that might mean thinking outside of the box. Leave a USB stick lying around and often someone who finds it will plug it in. This can grant the owner of that USB stick huge control over the affected system. There are plenty of inputs you might not usually consider as a threat, but a savvy hacker can find a way to exploit them.

More inputs means a larger “attack surface,” or more opportunity for attackers. This is one reason why constantly adding new features (known as feature bloat) isn’t always such a good idea for developers. A security analyst often tries and reduce that attack surface by removing any unnecessary inputs.

How hackers hack: Top strategies

To be an effective ethical hacker, you need to know what you’re up against. As an ethical hacker or “pentester,” it will be your job to attempt these kinds of attacks against clients so that you can then provide the opportunity for them to close the weaknesses.

it will be your job to attempt these kinds of attacks against clients

These are just some of the ways a hacker might try to break into a network:

Phishing attack

A phishing attack is a form of “social engineering,” where a hacker targets the user (the “wetware”) rather than the network directly. They do this by attempting to get the user to hand over their details willingly, maybe by posing as an IT repair person, or sending an email that appears to be from a brand they deal with and trust (this is called spoofing). They may even create a fake website with forms that collect details.

Regardless, the attacker then simply needs to use those details to sign into an account and they’ll have access to the network.

Spear phishing is phishing that targets a specific individual within an organization. Whaling means attacking the biggest kahunas — high-ranking executives and managers. Phishing often doesn’t require any computer skills in most cases. Sometimes all a hacker needs is an email address.

SQL injection

This one is probably a little closer to what you imagine when picturing hackers. Structured Query Language (SQL) is a fancy way to describe a series of commands you can use to manipulate data stored in a database. When you submit a form on a website to create a new user password, this will normally then create an entry in a table including that data.

Sometimes the form will also unintentionally accept commands, which can let a hacker retrieve or manipulate entries illicitly.

It would take a huge amount of time for a hacker or a pentester to look for these opportunities manually on a large website or web app, which is where tools like Hajiv come in. This will automatically look for vulnerabilities to exploit, which is extremely useful for security specialists, but also for those with ill-intent.

Typing Writing Coding Keyboard

Zero-day exploit

A zero-day exploit works by looking for weaknesses in a software’s coding or security protocols before the developer has the opportunity to patch them out. This might involve targeting a company’s own software, or it might involve targeting software that it uses. In one famous attack, hackers managed to access the security cameras at a company’s office with zero day exploits. From there, they were able to record anything that interested them.

A hacker might create malware designed to exploit this security flaw, which they would then covertly install on the target’s machine. This is a type of hacking that benefits from knowing how to code.

Brute force attack

A brute force attack is a method of cracking a password and username combination. This works by going through every possible combination one at a time until it hits the winning pair – just as a burglar might go through combinations on a safe. This method usually involves the use of software that can handle the process on their behalf.

DOS Attack

A denial of service (DOS) attack is mean to take a particular server down for a period of time, meaning it is no longer able to provide its usual services. Hence the name!

Pentesting White Hat Hacker

DOS attacks are carried out by pinging or otherwise sending traffic to a server so many times it becomes overwhelmed with traffic. This might require hundreds of thousands of requests or even millions.

The biggest DOS attacks are “distributed” across multiple computers (known collectively as a botnet), which have been taken over by hackers using malware. This make them DDOS attacks.

Your job as an ethical hacker

Android development tools

This is just a small selection of the different methods and strategies that hackers often employ in order to access networks. Part of the appeal of ethical hacking for many is thinking creatively and looking for potential weaknesses in security others would miss.

As an ethical hacker, your job will be to scan, identify, and then attack vulnerabilities to test a company’s security. Once you find such holes, you will then provide a report which should include remedial action.

For example, if you were to conduct a successful phishing attack, you might recommend training for staff they would be better able to identify fraudulent messages. If you got a zero day malware onto computers on the network, you might advise the company to install better firewalls and anti-virus software. You might suggest the company updates its software, or stop using certain tools altogether. If you find vulnerabilities in the company’s own software, then you could point these out to the dev team.

How to get started as an ethical hacker

If that sounds interesting to you, there are plenty of courses online that teach ethical hacking. Here is one called The Ethical Hacker Bootcamp Bundle.

You should also check out our post on becoming an information security analyst which will show you the best certifications, the best places to find work, and more.

More posts about Future Jobs

Spreadsheet Data Science

Microsoft Certification: A guide for tech professionals

Adam Sinicki Programming Android Development Java

How to become an Associate Android Developer, and is it worth it?

Adam Sinicki Keyboard Focus Closeup Typing

The best online certificate programs for enhancing your career

Adam Sinicki Programming on Laptop Android Studio

Unity certification for developers: Is it worth it?

Adam Sinicki Working at Computer Future Jobs

Best online business courses to supercharge your career

Adam Sinicki Gadgets Laptop Headphones Work Online

Adobe Certification is a great career move for creative professionals

Adam Sinicki AI Automation of Jobs

Is your job safe? Jobs that AI will destroy in the next 10-20 years

Adam Sinicki Data analyst

How to become a data analyst and prepare for the algorithm-driven future

Adam Sinicki Best LinkedIn Profiles

How to use LinkedIn and land your dream job!

Adam Sinicki

7 easy passive income ideas to make money while you sleep

Adam Sinicki

read more
Android Development

I want to develop Android Apps — What languages should I learn?

So, you’ve decided you’d like to learn how to develop Android apps? Great! Unfortunately, intentions can only carry you so far. Learning to code can be complicated. Sometimes it’s not even clear where to start. You’ll probably have a slew of questions to answer before you even get started?

  • What programming language should you learn?
  • Where can you learn about your chosen language?
  • Once you’ve grasped the basics, where do you even start typing the code?

In this post, we’re going to attempt to answer that first question. Deciding which programming language to start with will depend entirely on what you hope to accomplish. And once you know the language, you can find the IDE and the tools to match.

Read Next: The best Android app makers for creating apps and building them with zero code

Seeing as you’re reading a site called Android Authority, it’s probably safe to assume you’re interested in how to create Android apps predominantly. And in that case, you have a few options.

Take your pick

If you want to develop Android apps, step one is picking a language. The differences between the various Android programming languages can be a little complex and nuanced. Choosing which one to start with requires an understanding of their individual strengths and weaknesses.

But I also don’t want to bore you to death. You’ll find a short break down of each language option here, followed by more detailed information below. Pick the one that looks interesting to you and then jump to it.

The languages you might consider learning for Android development include:

  • Java – Java is the official language of Android development and is supported by Android Studio. It has a steep learning curve however.
  • Kotlin – Kotlin was recently introduced as a secondary “official” Java language. It is similar to Java in many ways but is a little easier to get your head around.
  • C/C++ — Android Studio also supports C++ with the use of the Java NDK. This allows for native coding applications, which can be handy for things like games. C++ is more complicated though.
  • C# — C# is a slightly more beginner-friendly alternative to C or C++ that obfuscates more code. It’s supported by some very handy tools like Unity and Xamarin which are great for game development and for cross-platform development.
  • BASIC – A bonus option is to learn BASIC and try the B4A IDE from Anywhere Software. This is an easy but powerful tool, though definitely much more niche!
  • Corona/LUA – Another cross-platform tool build on LUA. It massively simplifies the app-building process and allows you to call native libraries.
  • PhoneGap (HTML, CSS, JavaScript) – If you already know how to build interactive web pages, then you can use this knowledge with PhoneGap to build a more basic cross-platform app.

Java

When it comes time to develop Android apps, the first and most popular option is Java. Java is the official language of Android development, meaning it is the one that has the most support from Google and the one that most apps on the Play Store are built with.

The number one way to develop Android apps, is to go ahead and download Android Studio. This is a piece of software called an IDE, or Integrated Development Environment. It will come packaged with the Android SDK (a set of tools to facilitate Android development specifically) and basically this will give you everything you need in one place to get up and running.

The official tutorials and documentation from Google will reference this method and you’ll find the largest number of libraries (free code to enhance your own apps) and tutorials that focus on this method.

Java itself was released by Sun Microsystems back in 1995 and is used for a wide range of programming applications. Java code is run by a “virtual machine,” which runs on Android devices and interprets the code.

Read Next: Anatomy of an app: An introduction to activity lifecycles

Unfortunately, Java is also a little complicated and it’s not a great “first language.” This is what will provide the biggest barrier for many people who want to get started with Android development, in fact. Android is an object oriented programming language with confusing topics like constructors, null pointer exceptions, checked exceptions and more. It’s not terribly readable and you’ll use a lot of “boiler plate” code doing simple things. Add in the Java SDK and things get more complicated still – a first time coder can struggle to know what’s Java and what’s Android! Development using this route also requires a basic understanding of concepts like Gradle, like the Android Manifest and the markup language XML.

Editor's Pick

Java tutorial for beginners

If you have ever wanted to write your own Android app, for fun or for profit, you are probably going to need to do some programming. There are lots of different ways to write Android …

That’s not to say that Java is a bad language – far from it. Not only would it be wrong to call any language “bad,” but it’s also true that most of the inconveniences of Java are actually there for our own good and encourage clean code. A lot of people love Java for this reason, and it’s also one of the most versatile and widely used. According to the PYPL (PopularitY of Programming Languages) table, Java is the most sought after programming language among employers.

Making life a lot simpler is Android Studio, which has been going from strength to strength over the last few years. Features like a visual designer and suggestions make the process a fair bit smoother, while advanced, powerful features are being added all the time to give developers access to things like cloud storage with easy implementation. It’s worth getting aboard, even if this rapid progress does make it hard to keep up sometimes.

So, what’s the verdict? For those that want the full Android development experience, diving into Java is the best place to start. For those who are put off by complex code, it’s possible to work largely with the designer and to follow tutorials for anything more complicated. If you’re a beginner and you’re looking to make a game however, or you just want to start learning for the sake of learning and you’d like to get some rewarding projects off the ground, then I recommend you start with something easier and come back to this once you’ve got a bit more grounding.

Check out Gary’s introduction to Java here.

Note:

That said, it is also possible to use Java with Unity. I’ll discuss Unity under the section on C#, but just note that you could opt for the slightly more complicated Java language when going this route and then use that to more easily transition to developing with Android Studio.

Kotlin

Kotlin recently burst onto the scene as the “other” official language for Android development. Some speculation suggests that this is likely to raise the language’s profile and that it could possibly become the next Swift.

Like Java, Kotlin runs on the Java Virtual Machine. It’s also completely interoperable with Java and doesn’t cause any slow down or increase in file sizes. The difference is that Kotlin requires less “boiler plate” code, meaning that it is a more streamlined and easy-to-read system. It also does away with errors like null point exceptions and even excuses you from ending every line with semi colons. In short, it’s great if you’re just learning to develop Android apps for the first time.

how to develop android apps

So Kotlin is definitely an easier starting point for beginners, and the fact that you can still use Android Studio is a big plus. It’s still not quite as simple to pick up as say C# with Unity though, and the community support is in its relative infancy. In fact, you currently need to download a beta version of Android Studio in order to get the out-the-box support.

Still, Kotlin should definitely be on your radar and could offer an easier entry point to “proper” Android Development. Which is likely why Google introduced it in the first place.

Learn why you should try Kotlin here.

C/C++

It’s fair to say that most people reading this should not choose this route to develop Android apps. Android Studio offers support for C/C++ code using the Android NDK (Native Development Kit). This means you’ll be writing code that doesn’t run on the Java Virtual Machine but rather runs natively on the device and gives you more control over things like memory. For intensive applications like 3D games, this can let you squeeze extra performance out of an Android device. It also means you’ll be able to use libraries written in C or C++.

However, it also tends to be much harder to set up, it introduces more bugs and it is less flexible. And if you did want to create a computer game, you’d probably be better off using a ready-made game engine

C#

C# is basically an easier, pure object-oriented version of C and C++ developed by Microsoft. It aimed to bring the power of C++ and the ease of Visual Basic and reads a little like a simplified version of Java. Like Java, C# is garbage collected, meaning you don’t need to worry about things like memory leaks and freeing up memory yourself. At the same time though, C# is more modern than Java with a cleaner syntax – though this may just be my own bias coming through. The best language to develop Android apps often just comes down to taste.

If you want a particularly easy and welcoming introduction to Android app development though, then I recommend the combination of C# and Unity. Unity is a “game engine” (meaning it provides things like physics calculations and 3D graphics rendering) and an IDE like Android Studio. This is a free tool that makes it incredibly easy to create your own games – with just a few lines of code you can have a basic platform game set up in less than an hour. No exaggeration. And it’s perfectly powerful too, being the tool used by most game studios on the Google Play Store. And it’s multiplatform too. On top of all that, developing in this way provides a very practical way to learn Object Oriented coding (because the objects in this case actually are objects most of the time).

The limitation? Unity is useful for creating games but sub-par for creating standard Android Apps, especially if you want to conform to Google’s Material Design language. If you want to become a professional Android Developer, then this non-standard route will limit your employment opportunities – unless your aim is to become a game developer, in which case this is a perfectly relevant and professional background.

Not keen on Unity? Then you could consider Unreal instead (better graphics, less suited to mobile) or simplified game-makers like GameMaker Studio.

C# can also be used with Xamarin through Visual Studio. This is more akin to traditional Android development with the advantage of being cross platform (one codebase for Android and iOS). For a complete beginner, this route is again a slightly obtuse entry point to Android development – but for a small company wanting to create an app for iOS and Android, it makes sense, and there’s plenty of support and information out there to help you out.

BASIC

Remember how I said that C# was an attempt to offer the power of C with the ease of Visual BASIC? Well that’s because BASIC (Beginners All-Purpose Symbolic Instruction Code) is incredibly pleasant to use and an absolutely ideal jumping on point for learning to code.

develop android apps

Unfortunately, it isn’t officially support by Android Studio and nor can you use it in Unity or Xamarin. The good news is that there is a lesser-known option for developing Android apps in BASIC called B4A from Anywhere Software. This is an acronym for ‘BASIC 4 Android’ and as you might expect, it lets you code Android apps with BASIC. It’s certainly not the first choice for most programmers who want to develop Android apps, but it’s always nice to have more options.

B4A is designed as a RAD, or Rapid Application Development environment. There are lots of other smart design decisions to make life easier, and there’s a very supportive community if you have any questions.

This is a great way to learn to code, and you can build some pretty powerful apps using this method alone. It’s not ideal for making higher-end games though and once again suffers from being an “unofficial” option – so it’s harder to create something that exactly meets the Material Design specifications and you’ll find it harder working as a professional developer with only BASIC. The other big drawback is that this is the only option on the list that isn’t free.

Corona

Corona offers another considerably simpler option for developing Android apps while still giving you a fair amount of power and control. You’ll be coding in LUA which is already much simpler than Java and on top of that, the Corona SDK (Software Development Kit) will make things even easier. It supports all native libraries, allows you publish to multiple platforms. It is largely used for creating games but can be used in a variety of other ways too. You’ll need to use a text editor like Notepad++ to enter your code and you can run said code on an emulator without even needing to compile first. When you’re ready to create an APK and deploy, you’ll be able to do this using an online tool.

This does require basic coding skills, but it offers a nice and gentle introduction to the world of programming. At the same time though, it is definitely limited to some extent and is a few steps removed from getting into “app builder” territory. This is more useful for someone who wants to create something relatively simple and isn’t as concerned about developing their coding skills or becoming a pro. If you want to use features such as in-app purchasing, then you’ll need to pay a fee. The same goes for using native Android APIs.

PhoneGap

Finally, the last major “simplified” option you can to turn to develop Android apps is PhoneGap, unless you want to turn instead to an app builder program. PhoneGap is powered by Apache Cordova and essentially allows you to create apps using the same code you’d normally use to create a website: HTML, CSS and JavaScript. This is then shown through a “WebView” but packaged like an app. PhoneGap then acts like a bridge, allowing developers to access some basic native features of the phone or tablet – such as the accelerometer or the camera.

This isn’t really “true” Android development though, and the only real programming will be JavaScript. For many basic tasks, it will do the job, but if you want to be able to claim true “Android app developerhood” (that’s a thing), then you should brave one of the other choices on this list.

Conclusion

So take your pick! I wish there was a way to develop Android apps (easily) with Python, but otherwise you do have a wide selection of different options there for developing Android apps: from Java and Kotlin, to C, C#, and BASIC! You can even use HTML and CSS to make something simple using PhoneGap.

how to develop android apps

The right choice will depend on your sensibilities and your objectives, but whatever you decide, you’ll find that learning to code is a fantastically rewarding experience and one that opens up a ton of doors for you. And learning to code with Android is the perfect place to start. Hopefully now you at least now a bit more about how to develop Android apps, but if you have any questions, shout them in the comments and our team — and our readers — will do our best to answer them. Good luck!

Read Next: An introduction to Java syntax for Android development | Consuming APIs: Getting started with Retrofit on Android

Save 60% on our Introduction to Android Development Course

Android Authority has created a course to help you learn how to develop Android Apps! No Coding Experience Required. Start Your Journey on Becoming an Android Developer today. Visit DGiT Academy today. Enter discount code: SIXTYOFF at checkout to receive 60% off.

read more
Android Development

Dark theme, Thermal API and Bubbles: Getting your app ready for Android 10

The latest, greatest, as-yet-unnamed version of Android introduces features and APIs that you can use to design new experiences for your users — plus a few behavioral changes that you’ll need to watch out for.

Even if you’re not updating your app to target Android Q just yet, some of these changes will impact every application that’s installed on Android Q, even if your app doesn’t explicitly target this version of Android.

Some of these changes will impact every application that’s installed on Android Q.

Regardless of whether you’re eager to experiment with the latest features, or you just want to ensure your app won’t break the moment it’s installed on Android Q, now’s the perfect time to start preparing for Android Q’s imminent release.

Also read: Android Q: Everything developers need to know

In this article, I’ll cover all the steps you need to take to get your app ready for Android Q — from brand-new features to minor security tweaks that have the potential to break your entire application.

Avoid CPU and GPU throttling: Monitoring the device’s temperature

Overheating can seriously damage your smartphone or tablet. As a protective measure, Android will throttle your device’s CPU and GPU when it detects that temperatures are approaching dangerous levels.

While this behavior helps to protect the device’s hardware, it can also have a noticeable impact on application performance, particularly if your app uses high-resolution graphics, heavy computations, or performs ongoing network activity.

While this slowdown is imposed by the system, your typical smartphone or tablet user will blame your application for any drop in performance. In the worst case scenario, the user may decide that your application is buggy or broken, potentially even uninstalling your app and leaving you a negative Google Play review in the process.

In the worst case scenario, the user may decide that your application is buggy or broken.

Android Q introduces a new Thermal API that can help you avoid this CPU and GPU throttling. You can use this API’s addThermalStatusListener() method to create a listener for thermal status changes, then adjust your app’s behavior whenever the device’s temperature starts to rise. This can help reduce the chances of the system resorting to CPU or GPU throttling. For example, you might reduce the strain your application is placing on the overheating system by lowering your resolution or frame rate, or by disabling resource-intensive features such as network connectivity.

Note that Android Q’s Thermal API requires a new device HAL layer, which at the time of writing was only available on Pixel devices.

More posts about Android Q

Android Q Beta 4 Google Assistant Search Bar Dark Mode

Android 10 release: Possible date of final Android Q build leaked, and it’s soon

C. Scott Brown new android logo wordmark 2019

No more sweets: Google ditches desserts for Android Q in favor of Android 10

John Callaham Android logo 2019 blue background

Inside Google’s massive Android rebrand

David Imel

What codename will Google use for Android Q? (Update: No codename)

John Callaham Android Q

Google finally replaces the Android 10 Easter egg with something fun

Williams Pelegrin

How to install Android Q Beta 6 on your phone — a step by step guide

Andrew Grush android q beta 6 google pixel 3 xl assistance icon on pixel stand

Everything new in the sixth Android Q developer preview

Jimmy Westenberg

Android Q beta 6, the last Android Q beta update, is rolling out today

Hadlee Simons A hand holding a OnePlus 7 Pro so that you can see the back, which is the Nebula Blue color.

OnePlus 7 and OnePlus 7 Pro get fourth Android Q beta: Here’s what it includes

Williams Pelegrin Artwork from the OnePlus Game Space app.

Try out the new OnePlus app Game Space, no Android Q needed

C. Scott Brown

Reduce eyestrain and boost visibility with Dark theme

Android Q users can activate Dark Theme from their device's Settings

On Android Q, users can activate a system-wide Dark theme that’s designed to reduce eyestrain, improve visibility in low-light conditions, and reduce power usage on devices with OLED screens.

Dark theme is a low-light UI that uses dark surfaces for the background, and light foreground colors for elements such as text and iconography.

Users can activate this system-wide Dark theme at any time via a new Quick Settings tile, or by launching their device’s Settings application and navigating to Display > Theme. On Pixel devices, switching to Battery Saver mode will also enable Dark theme automatically.

android q dark theme

Dark Theme is applied across the entire device, so to provide a consistent user experience you’ll need to ensure that your application fully supports Dark theme.

To add Dark Theme support, make sure you’re using the latest version of the Material Android library, then update your app to inherit from Theme.MaterialComponents.DayNight, for example:

<style name="AppTheme" parent="Theme.AppCompat.DayNight">

Alternatively, you can provide separate Dark and Light themes. To create a Light theme, open your res/values/themes.xml file and inherit from Theme.MaterialComponents.Light:

<style name="Theme.MyApp" parent="Theme.MaterialComponents.Light">  //To do//  </style>

You’ll then need to create a res/values-night/themes.xml file and inherit from Theme.MaterialComponents:

<style name="Theme.MyApp" parent="Theme.MaterialComponents">  //To do//  </style>

To provide a good user experience, you may need to modify your app’s behavior when Dark theme is enabled, for example replacing or removing graphics that emit a significant amount of light.

You can check whether Dark theme is enabled, using the following snippet:

int currentNightMode = configuration.uiMode & Configuration.UI_MODE_NIGHT_MASK; switch (currentNightMode) {  //Dark Theme is not currently active//      case Configuration.UI_MODE_NIGHT_NO:          break;  //Dark Theme is active//      case Configuration.UI_MODE_NIGHT_YES:         break; }

Your application can then modify its behavior, depending on which Theme is currently active.

Settings Panel API: Displaying device settings inside your app

If your app targets Android Q, you’ll no longer be able to directly alter the device’s Wi-Fi settings. Instead, you’ll need to prompt the user to make the desired changes using the Settings Panel API.

You can use this new API to display content from the device’s Settings application, as an inline panel that slides over your app’s content. From the user’s perspective, these in-app controls allow them to quickly and easily alter their device’s settings without having to launch a separate app. For an application developer, the Settings Panel API lets you change the Wi-Fi status, and other crucial device settings, without encouraging the user to navigate away from your app.

updating to android q settings panel api

To use the Settings Panel API, you’ll need to fire an intent with one of the following actions, depending on the content you want to display:

  • ACTION_INTERNET_CONNECTIVITY: This displays settings related to enabling and disabling internet connectivity, including airplane mode, Wi-Fi, and mobile data.
  • ACTION_WIFI: This displays Wi-Fi settings only. This action is useful if your application specifically requires a Wi-Fi connection. For example, if you need to perform large uploads or downloads and don’t want to burn through the user’s mobile data allowance, use the ACTION_WIFI action.
  • ACTION_NFC: This displays all the settings related to near-field communication (NFC).
  • ACTION_VOLUME: This displays the device’s volume settings.

Here, we’re using the Settings Panel API to display the internet connectivity panel:

Intent panelIntent = new Intent(Settings.Panel.ACTION_INTERNET_CONNECTIVITY); startActivityForResult(panelIntent);

Adding chat head notifications to your app

Bubble notifications appear to float above your regular app content

In Android Q, Google is making chat head-style notifications an official part of the Android platform with the introduction of the Bubble API.

Designed as an alternative to SYSTEM_ALERT_WINDOW, bubble notifications appear to “float” above other application content, in a style that’s reminiscent of the floating notifications used by Facebook Messenger for Android.

Bubble notifications can be expanded to reveal additional information, or custom actions that make it possible for users to interact with your app, from outside the application context.

When your app tries to create its first bubble, Android will ask the user whether they want to allow all bubbles from your application, or block all bubbles. If the user chooses to block all of your app’s bubbles, then they’ll be displayed as standard notifications instead. Your bubbles will also be displayed as standard notifications whenever the device is locked, or always-on-display is active. To provide a good user experience, you need to ensure that all of your bubbles display and function correctly as regular notifications.

To create a bubble, you’ll need an Activity that defines the expanded bubble’s behavior and a layout that defines its user interface. For a step-by-step guide on how to create your first bubble notification, check out Exploring Android Q: Adding bubble notifications to your app.

Increasing accessibility with system-wide gestural navigation

android q beta 3 gesture navigation multitasking on google pixel 2 xl

Users with dexterity issues may find it easier to interact with their device using gestures. In Android Q, users have the option to enable gestural navigation across their entire device, which will impact every application installed on that device.

Even if you don’t update your app to target Android Q, your application will be affected by the device’s navigation settings, so you need to ensure that your app is compatible with Android Q’s gestural navigation.

In gestural navigation mode, your app should use the entire screen, so the first step is telling the Android system that your application supports edge-to-edge view. To layout your application fullscreen, you can use the SYSTEM_UI_FLAG_LAYOUT_STABLE and SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION flags, for example:

view.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION         | View.SYSTEM_UI_FLAG_LAYOUT_STABLE);

You’ll also need to implement support for a transparent system bar by adding the following to your theme:

<style name="AppTheme" parent="...">     <item name="android:navigationBarColor">@android:color/transparent</item>     <item name="android:statusBarColor">@android:color/transparent</item> </style>

When it’s time to test your app, you’ll need to check that Android Q’s system gestures don’t trigger any of your app’s controls, such as buttons or menus. In particular, Android Q uses an inward swipe for the Back action, and an upwards swipe for Home and Quick Switch, which can interfere with any UI elements located in these areas.

If during testing you discover that swiping from the bottom of the screen, or swiping inwards is triggering your app’s controls, then you can indicate which regions are setup to receive touch input. To block out certain areas, pass a List<Rect> to Android Q’s View.setSystemGestureExclusionRects() API, for example:

List<Rect> exclusionRects;  public void onLayout(         boolean changedCanvas, int left, int top, int right, int bottom) {     setSystemGestureExclusionRects(exclusionRects); }  public void onDraw(Canvas canvas) {     setSystemGestureExclusionRects(exclusionRects); }

If your app uses any custom gestures, then you should also check that they don’t conflict with the system’s navigation gestures.

Capturing audio from third party applications

Android Q introduces a AudioPlaybackCapture API which makes it possible for your app to capture audio from other applications — perfect if you’re creating a screen recording app!

To capture audio playback, you need to request the RECORD_AUDIO permission, and then:

  • Build an AudioPlaybackCaptureConfiguration instance, using AudioPlaybackCaptureConfiguration.Builder.build().
  • Configure and create the AudioRecord instance, by calling setAudioPlaybackCaptureConfig and then passing the configuration to the AudioRecord object.

For example:

    MediaProjection mediaProjection;      AudioPlaybackCaptureConfiguration config =          new AudioPlaybackCaptureConfiguration.Builder(mediaProjection)          .addMatchingUsage(AudioAttributes.USAGE_MEDIA)          .build();      AudioRecord record = new AudioRecord.Builder()          .setAudioPlaybackCaptureConfig(config)          .build();

This new API means, by default, third-party apps will be able to record all of your application’s audio. For some apps, this can be a privacy concern or may even put your app at risk of copyright infringement. If required, you can prevent third parties from capturing your app’s audio, by adding android:allowAudioPlaybackCapture=”false” to your Manifest.

Even with this flag in place, system apps will still be able to capture your app’s audio playback, as accessibility features such as captioning depend on audio capture.

To provide an accessible experience, it’s recommended that you always allow system components to capture your app’s audio, but you can block system apps using the ALLOW_CAPTURE_BY_NONE constant, if required.

Improved biometric authentication

Android Q is making a number of tweaks to Android’s BiometricPrompt authentication.

1. Check for biometric capability

Before invoking BiometricPrompt, you can now check whether the device supports biometric authentication, using the new canAuthenticate() method.

2. Streamlined biometric authentication dialogs

Android Q makes a subtle change to BiometricPrompt’s authentication dialogs.

Android allows users to authenticate their identify using a number of implicit “hands-free” biometric modalities, such as face or iris authentication. However, even if the user successfully verifies their identify using an implicit modality, they’ll still have to tap the dialog’s Confirm button in order to complete the authentication process.

For many implicit biometric modalities, this Confirm action is unnecessary, so in Android Q you can request that the system removes the Confirm button from your biometric authentication dialog.

In Android Q, it's possible to hide the "Confirm" button in the biometric authentication dialog

This small change can have a positive impact on the user experience, as verifying your identity by looking at your device, is easier than looking at your device, waiting for it to recognize your face, and then tapping the Confirm button.

In Android Q, you can request that the system removes the Confirm button by passing false to the setConfirmationRequired() method. Note that the system may choose to ignore your request in certain scenarios, for example if the user has disabled implicit authentication in their device’s Settings.

3. Alternative authentication methods

At times, a user may be unable to authenticate using biometric input. In these scenarios, you can allow them to authenticate their identify using their device’s PIN, pattern, or password using the new setDeviceCredentialAllowed() method.

Once this fallback is enabled, the user will initially be prompted to authenticate using biometrics, but will then have the option to authenticate using a PIN, pattern, or password.

Run embedded DEX code directly from your APK

In Android Q, it’s possible to run embedded DEX code directly from your APK file, which can help prevent attackers from tampering with your app’s locally compiled code.

You can enable this new security feature by adding the following to your Manifest’s <application> element:

android:useEmbeddedDex="true”

You can then build an APK that contains uncompressed DEX code, by adding the following to your Gradle build file:

aaptOptions {    noCompress 'dex' }

New permissions for Activity recognition

Android Q introduces a new com.google.android.gms.permission.ACTIVITY_RECOGNITION runtime permission for applications that need to record the user’s step count or categorize their physical activity, such as running or cycling.

Android’s Activity Recognition API will no longer provide results unless your application has this new ACTIVITY_RECOGNITION permission. Note that if your app uses data from built-in sensors such as the gyroscope or accelerometer, then you don’t need to request the ACTIVITY_RECOGNITION permission.

Restrictions on Activity starts

To help minimize interruptions, Android Q places new restrictions on when your application can start an Activity. You’ll find a complete list of all the conditions that allow for Activity starts, over at the official Android docs.

System alert overlays removed from Android Go

If your app winds up on a device that’s running Android Q and Android Go, it’ll be unable to access the SYSTEM_ALERT_WINDOW permission. This change has been implemented to avoid the noticeable performance drops that can occur when Android Go devices attempt to draw the SYSTEM_ALERT_WINDOW overlay window.

Say goodbye to Android Beam

Android Q marks the end of Android Beam, as this data-sharing feature is now officially deprecated.

Keeping your users secure: Key privacy changes

Android Q introduces a number of privacy changes that give users greater control over their data and their device’s sensitive features.

Unfortunately, these changes can affect your app’s behavior and may even completely break your app. When testing your application against Android Q, you should pay particular attention to the following privacy changes:

1. Scoped storage: Android’s new external storage model

Android Q places new restrictions on how applications access external storage.

By default, if your app targets Android Q then it’ll have a “filtered view” into the device’s external storage (previously referred to as a “sandboxed view”), which only provides access to an app-specific directory.

With scoped storage, your application can access this app-specific directory and all of its contents, without having to declare any storage permissions. However, your app can only access files created by other applications if it’s been granted the READ_EXTERNAL_STORAGE permission and the file(s) are located in either Photos (MediaStore.Images), Videos (MediaStore.Video) or Music (MediaStore.Audio). If your app requires access to a file that doesn’t meet this criteria, then you’ll need to use the Storage Access Framework.

At the time of writing, it was possible to opt out of scoped storage by adding android:requestLegacyExternalStorage=”true” to your project’s Manifest, but according to the official Android docs scoped storage will eventually be required by all applications, so it’s recommended that you update your app as soon as possible.

2. Decide when an app can access your location

Android Q gives users more control over when an application can access their location.

When your app requires location information, Android Q will display a dialog asking whether the user wants to share this information:

  • When your app is running in the foreground only.
  • All of the time (i.e when your app is in the foreground and the background).

If the user grants your app all-of-the-time access, then Android Q will create regular notifications to remind the user that your app can access their location at any time.

To implement these changes, Android Q introduces a new ACCESS_BACKGROUND_LOCATION permission.

If your app requires access to location information while it’s in the background, you’ll need to request this new permission, alongside the existing ACCESS_COARSE_LOCATION or ACCESS_FINE_LOCATION permission. For example:

<manifest>   <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />   <uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" /> </manifest>

3. New restrictions on non-resettable system identifiers

If you require access to non-resettable system identifiers, such as IMEI and serial number, you’ll now need to request the READ_PRIVILEGED_PHONE_STATE permission.

Wherever possible, it’s recommended that you use alternative methods of tracking the user. For example, if you wanted to record user analytics, you could create an Android Advertising ID rather than requesting access to non-resettable device identifiers.

Make sure you’re ready for Android Q: Testing your app

The best way to ensure that your application provides a good user experience on Android Q, is to test it on a device that’s running Android Q.

While we’re waiting for the official release, there are three ways to test your app against the Android Q developer previews: enroll your device in the Android Beta program, manually flash an Android Q system image onto your device, or use an Android Virtual Device (AVD).

1. Install the Android Q beta on a physical device

If you own a compatible device (full list can be found here), you can get over-the-air Android Q updates by enrolling in the Android Beta program. At the time of writing, all Google Pixel phones are supported by the Android Beta program. That includes the Google Pixel, Pixel XL, Pixel 2, Pixel 2 XL, Pixel 3, Pixel 3 XL, Pixel 3a, and Pixel 3a XL.

If you don’t own a Pixel, the Android Q beta is also available on select devices from a handful of manufacturers, including Asus, Huawei, LG, Xiaomi, and more. For the full list of supported devices, check out the list right here.

Once you’re enrolled, Google estimates that you’ll receive between three and six updates over the course of the program.

Before enrolling in the Beta program, there are several drawbacks you need to be aware of. Pre-release versions of Android may contain bugs and errors that could prevent your device from functioning normally, and there’s no official support available if you do encounter difficulties. Users who are running pre-release versions of Android also won’t receive separate monthly security updates, which could leave your device vulnerable to attacks and exploits.

Finally, although you can opt out of the program and revert to a stable version of Android at any time, all of the locally saved data on your device will be wiped when you revert to the stable release. Note that if you remain enrolled until the end of the beta program, then you’ll graduate and receive the final, public version of Android Q without losing any of your data.

If you want to start receiving over-the-air Android Q updates, head over to the Android Beta website for more information.

2. Manually flash an Android Q system image

If you don’t like the idea of receiving Android Q updates over-the-air, you can download and manually flash an Android Q system image to your Pixel device.

Google has published the system images for all compatible Pixel devices, along with instructions on how to flash a system image. This manual approach can be useful if you need to test against a specific release of Android Q, or if you want to start testing immediately rather than enrolling in the Beta program and potentially waiting up to 24 hours to receive your first update.

3. Use the Android emulator

If you don’t want the risks associated with installing beta software on a physical smartphone or tablet, or if you don’t own a compatible device, you can use an AVD instead.

To download the latest Android Q preview image, follow these steps:

  • Launch Android Studio.
  • Select Tools > SDK Manager from the Android Studio toolbar.
  • Make sure the SDK Platforms tab is selected.
  • Select Show Package Details.
  • Select Google Play Intel x86 Atom System Image.

You can test your app against Android Q, using an AVD

  • Click OK.
  • Create an AVD using this system image.

How do I test my app against Android Q?

Once you have a physical device or AVD that’s running Android Q, you should put your app through the same testing processes and procedures you use when preparing any release. During testing, you should also pay particular attention to Android Q’s privacy changes, as these have the potential to break your app.

Once you’ve verified that your application is providing a good user experience on Android Q, you should publish your Android Q-compatible app to Google Play as soon as possible. By releasing your app early, you can gather feedback before the majority of your user base move to Android Q.

Alternatively, you can use Google Play testing tracks to push your APK to a select group of testers, then perform a staged rollout to production when you’re happy with their feedback.

We hope this article helped you get your app ready for Android Q! Which Android Q feature are you most excited about?

read more
Android Development

Building your Android UI: Everything you need to know about Views

Every mobile app has some form of user interface (UI), and in Android user interfaces are created using Views.

If you’re just getting started with Android development, then it makes sense to familiarize yourself with Views as soon as possible, as they’re central to many “Hello World” apps and Android tutorials.

Even if you’ve been developing Android apps for a while, it’s easy to get into a rut! If you’re using the same Views over and over, then now’s the perfect time for a refresher on all the different Views that are included in the Android platform.

In this article, we’ll be taking a closer look at this essential building block of Android development, before exploring some of the most commonly-used Views that you can use in your Android apps.

What is a View, exactly?

View objects, sometimes referred to as “widgets” are the building blocks of all Android UIs.

Each View occupies a rectangular area of the screen and typically draws something that the user can see, such as text or an image. In addition to displaying content, some Views also provide interactive functionality, such as Buttons, EditTexts and Spinners. Whenever an event occurs Android dispatches this event to the appropriate View, which then handles the event and notifies any listeners.

The easiest way to add a View to your Java or Kotlin project, is to define that View within an XML layout resource file. Android provides a simple XML syntax that corresponds to the different View subclasses, for example in the following snippet we’re using XML to instantiate a TextView:

   <TextView        android:layout_width="wrap_content"        android:layout_height="wrap_content"        android:text="Hello World!"        app:layout_constraintBottom_toBottomOf="parent"        app:layout_constraintLeft_toLeftOf="parent"        app:layout_constraintRight_toRightOf="parent"        app:layout_constraintTop_toTopOf="parent" />

The Android framework is responsible for measuring, laying out and drawing your Views, so you don’t have to explicitly call any methods to perform these actions.

To build a layout, simply keep adding View elements to your XML file, similar to how you create webpages in HTML – just try to keep nesting to a minimum, as it can negatively impact your application’s performance. User interfaces with “shallow” View hierarchies tend to be drawn faster, so if you’re going to deliver a high-performing app then you’ll need to avoid nesting wherever possible.

If you know all of a View’s properties at build time, then you can define this View entirely in XML. By keeping your UI code separate from your application code, you can provide alternate layouts that are optimized for different screen sizes, orientations and languages. This separation also makes your application code easier to read, test and modify, as it isn’t muddled up with UI code.

Since it’s the recommended approach, we’ll be defining Views in XML throughout this tutorial, although you can create Views programmatically where required.

If you need to edit a View’s properties at runtime, then’ll typically have to define some, or all of that View’s properties programmatically in Java or Kotlin. For example, in the following snippet we’re defining a TextView in Java:

//Create a TextView programmatically//          TextView tv = new TextView(getApplicationContext());  //Define the View’s layout parameters//          LayoutParams lp = new LinearLayout.LayoutParams(  //Set the View’s width//                    LayoutParams.WRAP_CONTENT,  //Set the View’s height//                    LayoutParams.WRAP_CONTENT);  //Apply the layout parameters to the TextView//          tv.setLayoutParams(lp);  //Set the text//          tv.setText("Hello World!");  //Add the TextView to the parent ViewGroup//          rl.addView(tv);     } }

Note that you may be able to declare your app’s default layout in XML, and then modify some of its properties at runtime.

Working with Views: Common XML attributes

When creating a View, you’ll need to define various View properties, using XML attributes. Some of these attributes will be unique to that particular View, but there are a number of XML attributes that you’ll encounter over and over again, regardless of the kind of View you’re working with.

Identifying your Views

Every View must have an integer ID that uniquely identifies that particular View. You define integer IDs in your layout files, for example:

android:id="@+id/hello_world"

The + symbol signifies that this is a new name that must be created and added to your project’s R.java file.

When you need to work with a View, you can reference it using its View ID. Typically, you’ll reference a View by creating an instance of that View object in your Activity’s onCreate() method, for example:

TextView myTextView = (TextView) findViewById(R.id.hello_world);

The ID integer technically doesn’t need to be unique throughout the entire tree, just within the part of the tree you’re searching. However, to avoid conflicts and confusion it’s recommended that you use completely unique View IDs, wherever possible.

Layout parameters: Width and height

XML attributes that start with “layout_” define a View’s layout parameters. Android supports a variety of layout parameters, but as a minimum you must define a width and height using the layout_width and layout_height attributes.

Android devices have screens of varying dimensions and pixel densities, so 10 pixels doesn’t translate to the same physical size across every device. If you define a View’s width and height using exact measurements, then this can result in user interfaces that only display and function correctly on devices with specific screens, so you should never use any exact measurements when creating your Views.

Instead, you can define a View’s width and height, using any of the following relative measurements:

  • wrap_content. This View should be just big enough to display its content, plus any padding.
  • match_parent. This View should be as big as its parent ViewGroup will allow.
  • dp. If you need more control over a View’s sizing, then you can provide a density-independent pixel measurement, for example android:layout_width=”50dp.” Note that one dp is roughly equal to one pixel on a “baseline” medium-density screen.
  • sp. If you want to size text using a density-independent pixel measurement, then you should use scalable pixels (sp), for example: android:textSize=”20sp.” Scalable pixels ensure that your app’s text respects the device’s selected text size, so your text will appear bigger on devices that are set to display Large text, and smaller on devices that are set to display Small text.

Give your content some breathing space!

You can use padding to insert some space between the edges of a View and the View’s content, which can be useful for giving your content some “breathing space” and preventing your UI from looking overly busy or cluttered.

The following screenshot shows an ImageView with 10dp of padding:

You can create breathing space by adding padding to your Views

Android provides the following padding attributes:

  • android:padding. Adds extra space to all four edges. If you define a android:padding value, then it’ll take precedence over any edge-specific values, such as paddingLeft and paddingTop, but it won’t override paddingStart or paddingEnd.
  • android:paddingBottom. Adds extra space to the bottom edge.
  • android:paddingEnd. Adds extra space to the end edge.
  • android:paddingHorizontal. Adds extra space to the left and right edges. If you define a android:paddingHorizontal value then it’ll take precedence over paddingLeft and paddingRight, but not paddingStart or paddingEnd.
  • android:paddingLeft. Adds extra space to the left edge.
  • android:paddingRight. Adds extra space to the right edge.
  • android:paddingStart. Adds extra space to the start edge.
  • android:paddingTop. Adds extra space to the top edge.
  • android:paddingVertical. Adds extra space to the top and bottom edges. If you define a android:paddingVertical value, then it’ll take precedence over paddingTop and paddingBottom.

Margins: Adding space around your Views

While padding is applied between the edges of the View and the View’s contents, margins are applied outside of the View’s bounds. You can use margins to create space between your Views, or to create space between a View and the screen’s borders.

If your app contains multiple interactive UI elements, then margins can help ensure the user always activates the correct control, particularly for users who have manual dexterity issues.

Android provides the following margin attributes:

  • android:layout_margin. Adds extra space to the left, top, right and bottom sides of a View, for example android:layout_marginRight=”10dp.” If you define a layout_margin value, then it’ll take precedence over any edge-specific values.
  • android:layout_marginBottom. Adds extra space to the bottom side of the View.
  • android:layout_marginEnd. Adds extra space to the end side of the View.
  • android:layout_marginHorizontal. Adds extra space to the left and right sides of the View. Declaring a layout_marginHorizontal value is equivalent to declaring a layout_marginLeft and a layout_marginRight value. A layout_marginHorizontal value will take precedence over any edge-specific values.
  • android:layout_marginLeft. Adds extra space to the left side of the View.
  • android:layout_marginRight. Adds extra space to the right side of the View.
  • android:layout_marginStart. Adds extra space to the start side of the View.
  • android:layout_marginTop. Adds extra space to the top side of the View.
  • android:layout_marginVertical. Adds extra space to the top and bottom sides of the View. Declaring a layout_marginVertical value is equivalent to declaring a layout_marginTop and a layout_marginBottom value. A layout_marginVertical value will take precedence over any edge-specific values.

What Android Views can I use?

Now we’ve covered some common layout attributes, let’s take a closer look at some of the Views that are provided as part of the Android SDK.

Displaying text, with TextViews

You use TextViews to display text to your users, including interactive text such as hyperlinks, email addresses and phone numbers.

To create a TextView, simply add a <TextView> element to your layout resource file, and then specify your text using the android:text attribute and a string:

 <TextView         android:id="@+id/hello_world"         android:layout_height="wrap_content"         android:layout_width="wrap_content"         android:text="@string/helloWorld" />

If required, you can set or modify the View’s text at runtime, from your project’s Java code:

public class MainActivity extends Activity {      protected void onCreate(Bundle savedInstanceState) {          super.onCreate(savedInstanceState);          setContentView(R.layout.activity_main);          final TextView helloWorldTextView = (TextView) findViewById(R.id.hello_world);          helloWorldTextView.setText(R.string.new_text);      }  }

You can also style your text, using elements such as android:textColor, android:fontFamily, and android:textStyle, which has possible values of bold, italic, and bolditalic.

EditTexts: Creating editable, interactive text

EditText is an extension of the TextView class, which allows users to enter text into the View or modify the View’s existing text. Some common examples of EditTexts include login forms where the user can enter their email address and password, and forms where you can enter your payment details.

A login form created using two EditTexts and a ButtonSometimes, an EditText will only accept a certain type of text input, such as a phone number, password, or email address. You can often improve the user experience by declaring the expected input type, which will affect the default keyboard that’s displayed to the user. For example, if your EditText accepts a phone number, then you can use android:inputType=”phone” to display the numerical keyboard and make it easier for the user to enter that telephone number.

<EditText     android:id="@+id/phoneNumber"     android:layout_width="fill_parent"     android:layout_height="wrap_content"     android:inputType="phone" />

Android supports a list of inputTypes, including some that specify additional behavior, for example android:inputType=”textPassword” automatically masks the user’s input, which reduces the chances of someone spying on their password.

You’ll find a complete list of supported android:inputType values, over at the official Android docs.

Depending on the expected input type, you may be able to further streamline the user experience by combining inputType values with attributes that define additional behaviour, such as whether to provide spelling suggestions, or automatically capitalize new sentences. For example, if you wanted your EditText to capitalize the first word of a sentence and auto-correct spelling mistakes, then you’d use the following:

android:inputType=         "textCapSentences|textAutoCorrect

By default, Android’s virtual keyboard provides a user action button, such as a Next or Done button. However, these default actions aren’t always appropriate for the currently-selected EditText, for example if your EditText is a search field, then a Search action makes much more sense than Next or Done.

You can specify an alternative action for your EditText, using the android:imeOptions attribute and one of the many supported values, such as an actionSearch which performs a Search operation using the EditText’s contents.

Finally, sometimes you may want to be notified when the user changes the contents of your EditText. For example if your password EditText requires a password that’s at least ten characters long and features a mixture of letters, symbols and numbers, then you can improve the user experience by automatically checking the user’s input as they’re typing and then notifying them of any issues with their password, before they hit the Register button. You can register to receive these callbacks, by adding a TextWatcher to your EditText.

Displaying PNGs, JPGs and GIFs

You can use the ImageView class to display images. These images can be drawables that you instantiate from an image resource that’s saved in your project, or they can be images that your app downloads over the device’s Internet connection.

To instantiate a drawable from an image resource, you need to add a PNG, JPG or GIF to your project’s res/drawable directory and then reference that file from your XML layout. You’ll need to use the image’s file name as its resource ID, so if you had a file named scenery.jpg then you’d display that image using the following:

<ImageView          android:id="@+id/myImage"          android:layout_width="wrap_content"          android:layout_height="wrap_content"          android:src="@drawable/scenery" />

The following screenshot shows this scenery drawable, rendered in Android Studio:

You can display a drawable by adding an ImageView to your layout

Alternatively, in Android 5.0 (API level 21) and higher you can use vector drawables, which define an image as a set of points, lines, and curves. Vector drawables can be scaled without loss of display quality, so you can use a single file for all of Android’s different screen densities.

Creating a custom vector drawable is beyond the scope of this tutorial, but you can get a taste for working with vectors, by taking a look at Vector Asset Studio, which is included as part of Android Studio.

You can use Vector Asset Studio to quickly and easily add any of the stock Material design icons to your project, in vector drawable format:

  • In Android Studio, Control-click your project’s drawable folder.
  • Select New > Vector Asset.
  • In Asset type, select Clip Art.
  • Select the Clip Art button, which displays the Android logo by default.
  • Choose any of the Material design icons; I’m using “done.”

Create a vector asset drawable, using the Vector Asset Studio

  • Give this asset a descriptive name, and then click Next.
  • Read the onscreen information, and if you’re happy to proceed then click Finish.
  • Open your project’s drawable folder and you should see a new XML file that defines your chosen Material icon as a vector drawable. Here’s the contents of my vector drawable resource:
<vector xmlns:android="http://schemas.android.com/apk/res/android"        android:width="24dp"        android:height="24dp"        android:viewportWidth="24.0"        android:viewportHeight="24.0">    <path        android:fillColor="#FF000000"        android:pathData="M9,16.2L4.8,12l-1.4,1.4L9,19 21,7l-1.4,-1.4L9,16.2z"/> </vector>

You then just need to reference this vector drawable in your ImageView, in exactly the same way you’d reference a standard drawable resource, for example android:src=”@drawable/done_vector.”

Buttons and ImageButtons

Buttons and ImageButtons are Views that listen for clicks and then call a method in your code every time the user interacts with that button.

You can communicate the action that’ll occur when the user interacts with your button, using a text label, an icon, or a text label and an icon.

In the following snippet, we’re creating a Button that features a text label:

<Button    android:layout_width="wrap_content"    android:layout_height="wrap_content"    android:text="@string/button_label"/>

To create an ImageButton, you’ll need to add an image file to your project and then reference it in exactly the same way you referenced your drawables in the previous section. For example:

<ImageButton     android:layout_width="wrap_content"     android:layout_height="wrap_content"     android:src="@drawable/button_icon"/>

If you want to create a button that features an image and a text label, then you’ll need to add a text label as normal, and then reference your drawable using one of the following attributes:

  • android:drawableLeft. Position the drawable to the left of the text.
  • android:drawableRight. Position the drawable to the right of the text.
  • android:drawableStart. Position the drawable to the start of the text.
  • android:drawableEnd. Position the drawable to the end of the text.
  • android:drawableTop. Position the drawable above the text.
  • android:drawableBottom. Position the drawable below the text.

Here, we’re creating a button_icon drawable and placing it at the start of the Button’s button_label text:

<Button    android:layout_width="wrap_content"    android:layout_height="wrap_content"    android:text="@string/button_label"    android:drawableStart="@drawable/button_icon"/>

In addition to adding labels and images, you can customize your Buttons and ImageButtons by adding a background image or a color resource, using the android:background attribute. For example, you can turn a button blue, by adding the following to your Button or ImageButton declaration:

android:background="#0000FF"

Whenever the user interacts with a button, that Button or ImageButton will receive an onClick event. You’ll need to define a handler for this event, using the android:onClick attribute.

The value of the onClick attribute must correspond to a public method, which will be called in response to the onClick event, for example:

<Button    android:layout_width="wrap_content"    android:layout_height="wrap_content"    android:text="@string/button_label"    android:onClick="displayToast" />

Next, you’ll need to implement this method in the Activity that’s hosting your Button or ImageButton. This method must be public, return void, and define a View as its only parameter, for example:

 public void displayToast(View view) {        Toast.makeText(MainActivity.this,                "Your Message", Toast.LENGTH_LONG).show();     }  }

Alternatively, you can declare an event handler programmatically. In Java, this means creating an View.OnClickListener object and then assigning it to the Button or ImageButton, using setOnClickListener(View.OnClickListener).

Give your users options, with CheckBoxes

CheckBoxes allow the user to choose one or more options from a vertical list.

CheckBoxes allow you to create vertically-scrolling lists of options.

You create a CheckBox by adding a <Checkbox> item to your XML layout:

    <CheckBox android:id="@+id/yes"         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:text="@string/yes"         android:onClick="onCheckboxClicked"/>

Since CheckBoxes typically allow the user to select multiple items, you’ll need to add an android:onClick attribute to each individual <CheckBox> element, and then reference the method that’ll be called in response to CheckBox click events.

When you implement the corresponding method in your hosting Activity, you’ll need to verify which CheckBox was selected, and then perform an appropriate action depending on the user’s selection. For example, if we created Yes and No CheckBoxes, then we’d add the following to our hosting Activity:

public void onCheckboxClicked(View view) {     boolean checked = ((CheckBox) view).isChecked();  //Verify which checkbox is selected//      switch(view.getId()) {          case R.id.yes:  //If the “yes” checkbox is selected, then...//              if (checked)  //Do something//              else             Break;  //If the “no” checkbox is selected, then….//          case R.id.no:              if (checked)  //Do something//

Views and ViewGroups: Creating RadioButtons

RadioButtons allow the user to choose from a set of mutually-exclusive options, such as the Agree/Disagree buttons commonly found on Terms and Conditions forms.

RadioButtons allow users to choose one or more options from a vertical list

You create each RadioButton by adding a <RadioButton> element to your layout. Since RadioButtons are mutually exclusive you’ll need to arrange all of your <RadioButton> elements inside a <RadioGroup> ViewGroup, which ensures that only one RadioButton can be selected at a time.

<?xml version="1.0" encoding="utf-8"?> <RadioGroup xmlns:android="http://schemas.android.com/apk/res/android"     android:layout_width="match_parent"     android:layout_height="wrap_content"     android:orientation="vertical">     <RadioButton android:id="@+id/radio_confirm"         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:text="@string/confirm"         android:onClick="onRadioButtonClicked"/>     <RadioButton android:id="@+id/radio_deny"         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:text="@string/deny"         android:onClick="onRadioButtonClicked"/> </RadioGroup>

You define a click handler by adding the android:onClick attribute to every RadioButton in your RadioGroup, and then implementing the corresponding method in your hosting Activity. Similar to our CheckBox example, this method needs to verify which RadioButton is currently selected, and then take appropriate action based on the user’s selection.

public void onRadioButtonClicked(View view) {     boolean checked = ((RadioButton) view).isChecked();  //Verify which RadioButton is selected//      switch(view.getId()) {  //If the “confirm” radio button is selected, then...//          case R.id.radio_confirm:              if (checked)  //Do something//              Break;  //If the “deny” button is selected, then...//           case R.id.radio_deny:               if (checked)  //Do something//

Spinner

When tapped, a Spinner displays a set of values as a dropdown menu.

An Android Spinner displays a set of values as a dropdown menu.

The user can tap any item in the Spinner, and your application will perform an action based on their selection. By default, a Spinner always displays the currently-selected value.

A functioning Spinner consists of several components:

  • A <Spinner> element that you add to your layout resource file.
  • A data source that supplies your Spinner with some information; I’ll be using a simple String Array.
  • An ArrayAdapter that converts your data into View items, ready to be displayed in your Spinner.

Let’s start by adding a <Spinner> to our XML layout:

<?xml version="1.0" encoding="utf-8"?> <LinearLayout    xmlns:android="http://schemas.android.com/apk/res/android"    xmlns:tools="http://schemas.android.com/tools"    android:layout_width="match_parent"    android:layout_height="match_parent"    tools:context=".MainActivity">     <Spinner        android:id="@+id/location_spinner"        android:layout_width="fill_parent"        android:layout_height="wrap_content" />  </LinearLayout>

If the data is predetermined, then you can provide it as a String Array that’s defined in your Strings.xml file:

<resources>    <string name="app_name">SimpleSpinner</string>        <string-array name="location_array">            <item>Argentina</item>            <item>Armenia</item>            <item>Australia</item>            <item>Belgium</item>            <item>Brazil</item>            <item>Canada</item>            <item>China</item>            <item>Denmark</item>            </string-array>            </resources>

You can then deliver this Array to your Spinner using an instance of ArrayAdapter, which you implement in an Activity or Fragment.

To define an ArrayAdapter, we need to complete the following steps:

  • Create an ArrayAdapter from the String Array, using the createFromResource() method.
  • Specify a layout resource that defines how the user’s chosen item should appear in the Spinner. Android provides a simple_spinner_item layout that you should use unless you specifically require a custom layout.
  • Use setDropDownViewResource(int) to specify which layout the Adapter should use for the Spinner dropdown menu. Once again, Android provides a ready-made layout (simple_spinner_dropdown_item) that should be suitable for most projects.
  • Apply the Adapter to your Spinner, by calling setAdapter().

Here’s my completed code:

Spinner spinner = (Spinner) findViewById(R.id.location_spinner);  //Create an ArrayAdapter//  ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this,  //Populate the spinner using the String Array and the simple_spinner_item layout//          R.array.location_array, android.R.layout.simple_spinner_item);  //Specify the layout that should be used for the dropdown menu//  adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);  //Apply the Adapter to the Spinner//  spinner.setAdapter(adapter);

The Spinner will receive an onItemSelected event every time the user selects an item from the dropdown. To process this event, you’ll need to use the AdapterView.OnItemSelectedListener interface to define an onItemSelected() callback method.

In the following code, I’m displaying a toast every time onItemSelected() is invoked, and incorporating the name of the newly-selected item into my toast. I’m also defining a onNothingSelected() callback method, as this is also required by the AdapterView.OnItemSelectedListener interface.

Here’s the completed Activity:

import androidx.appcompat.app.AppCompatActivity;  import android.os.Bundle; import android.view.View; import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.Spinner; import android.widget.Toast;  public class MainActivity extends AppCompatActivity implements AdapterView.OnItemSelectedListener {     @Override    protected void onCreate(Bundle savedInstanceState) {        super.onCreate(savedInstanceState);        setContentView(R.layout.activity_main);         Spinner spinner = (Spinner) findViewById(R.id.location_spinner);        spinner.setOnItemSelectedListener(this);         ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this,                 R.array.location_array, android.R.layout.simple_spinner_item);                    adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);        spinner.setAdapter(adapter);     }     public void onItemSelected(AdapterView<?> parent, View view,                    int pos, long id) {         Toast.makeText(parent.getContext(),                "You've selected n" + parent.getItemAtPosition(pos).toString(),                Toast.LENGTH_LONG).show();    }     @Override    public void onNothingSelected(AdapterView<?> adapterView) {  //To do//     } }

You can download this complete project from GitHub.

ListViews: Displaying your data as scrollable lists

A ListView displays a collection of items as a vertically-scrolling, single column list. When the user selects an item from a ListView, your app will typically perform an action, such as displaying additional information about the selected item.

Android's ListView displays a collection of items as a vertically-scrolling, single column list.

To create a ListView, you’ll need to add a <ListView> element to your XML layout resource file, and then create an Adapter, which will handle the process of displaying each item in your ListView.

Let’s start by adding a <ListView> to our layout:

<?xml version="1.0" encoding="utf-8"?>     <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"     android:orientation="vertical"     android:layout_width="fill_parent"     android:layout_height="fill_parent">      <ListView android:layout_width="fill_parent"         android:layout_height="fill_parent"         android:id="@+id/myListView">     </ListView>  </LinearLayout>

A ListView requests Views on-demand from its assigned Adapter. In our MainActivity, we need to create an Adapter and then associate it with our ListView, using setAdapter(android.widget.ListAdapter).

import android.app.Activity; import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.os.Bundle; import android.widget.ListView; import android.view.View; import android.widget.Toast;  public class MainActivity extends Activity {      String[] countryArray = {"Argentina" , "Armenia", "Australia", "Belgium" ,"Brazil" ,"Canada" , "China" ,             "Denmark" , "Estonia" , "Finland" , "France" , "Greece" , "Hungary" , "Iceland" , "India" ,             "Indonesia" , "Italy" , "Japan" , "Kenya" , "Latvia"};      @Override     protected void onCreate(Bundle savedInstanceState) {         super.onCreate(savedInstanceState);         setContentView(R.layout.activity_main);          final ListView listView = (ListView)findViewById(R.id.myListView);   ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,android.R.layout.simple_list_item_1, countryArray);    listView.setAdapter(adapter);          listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {             @Override             public void onItemClick(AdapterView<?> parent, View view, int position, long id) {                 Toast.makeText(parent.getContext(),                         "You've selected n" + parent.getItemAtPosition(position).toString(),                          Toast.LENGTH_LONG).show();              }         }         )                 ;     }}

You can download this completed ListView project from GitHub.

Designing unique experiences: Creating custom Views

While there’s no shortage of built-in Views, sometimes you may have very specific requirements that aren’t met by any of Android’s built-in Views. In this scenario you can create your own, custom Android Views.

Most of the time, you’ll create a custom View by identifying a built-in View that almost meets all of your requirements, and then extend this View with your own modifications. However, it’s also possible to create a View from scratch, by extending the base View class.

Creating a custom View is an advanced topic that requires you to complete multiple steps, including providing overrides for the methods that Android usually calls automatically, such as onDraw() and onTouchEvent(), but custom Views can be an effective way to deliver unique experiences to your users.

Wrapping up

In this article, we explored all of the most commonly-used Android Views, plus some of the key attributes you’ll use when creating these Views.

Are there any Views you’d like us to explore in more detail? Let us know in the comments below!

read more
Android Development

Create a scrollable widget for your Android app

Since the early days of the OS, widgets for Android have allowed users to engage with their favourite apps, from the comfort of their homescreen. So how do you create an Android widget?

For the developer, widgets give your application a valuable presence on the user’s homescreen. Instead of being tucked out of sight in the app drawer, users will be reminded about your app every single time they glance at their homescreen – while also getting a preview of your app’s most interesting and useful content.

Widgets give your application a valuable presence on the user’s homescreen

In this article, I’ll show you how to provide a better user experience while encouraging users to engage with your app, by creating an Android widget! By the end of this article, you’ll have created a scrollable collection widget that displays a complete data set on the user’s homescreen.

To ensure you’re delivering the kind of widget that users want to place on their homescreen, we’ll also be creating a configuration Activity, which will allow users to customize the widget’s content, appearance and features. Finally, I’ll show how you can encourage people to use your widget, by creating a Widget Preview image that showcases the best that your widget has to offer.

Also read: Developing for foldable devices: What you need to know

What are widgets for Android?

An application widget is a lightweight, miniature application that lives on the user’s homescreen.

Android app widgets can contain a variety of content

Widgets for Android can provide a range of content, but generally fall into one of the following categories:

  • Information widget. This is a non-scrollable widget that displays some information, such as today’s weather forecast or the date and time.
  • Collection widgets. This is a scrollable widget that displays a set of related data, formatted as a ListView, GridView, StackView, or an AdapterViewFlipper. Collection widgets are usually backed by a data source, such as a database or an Array.
  • Control widgets. These widgets act as a remote control that enables users to interact with your application, without having to bring it to the foreground. Apps that play media, such as podcasts or music, often have control widgets that allow the user to trigger Play, Pause, and Skip actions directly from their homescreen.
  • Hybrid widgets. Sometimes you may be able to deliver a better user experience by combining elements from multiple categories. For example, if you’re developing a control widget for a music application then you can provide Play, Pause and Skip controls, but you may also decide to display some information, such as the song’s title and artist. If you do decide to mix and match, then don’t get carried away! Widgets tend to deliver the best user experience when they provide easy access to a small amount of timely, relevant information or a few commonly-used features. To help keep your hybrid widgets lightweight, it’s recommended that you identify your widget’s primary category, develop it according to that category, and then add a few elements from the widget’s secondary category.

Does my project really need an application widget?

There’s several reasons why you should consider adding an application widget to your Android project.

Widgets for Android can improve the user experience

As a general rule, the fewer navigational steps required to complete a task, the better the user experience.

By providing an application widget, you can remove multiple navigational steps from your app’s most commonly-used flows. In the best case scenario, your users will be able to get the information they need just by glancing at their homescreen, or perform the desired task simply by tapping a button in your control widget.

More powerful than application shortcuts

App widgets often respond to onClick events by launching the top level in the associated application, similar to an application shortcut. However, widgets can also provide direct access to specific Activities within an application, for example tapping a widget’s New Message Received notification might launch the associated app with the new message already open.

Widgets for Android Homescreen

By embedding multiple links in your widget’s layout, you can provide one-tap access to all of your app’s most important Activities, removing even more navigational steps from your most commonly-used flows.

By embedding multiple links in your widget’s layout, you can provide one-tap access to all of your app’s most important Activities.

Note that widgets respond to onClick events only, which prevents users from accidentally interacting with your widget while they’re swiping around the homescreen. The only exception is when the user is attempting to delete your widget by dragging it towards their homescreen’s Remove action, as in this scenario your widget will respond to a vertical swipe gesture.

This interaction is managed by the Android system, so you don’t need to worry about manually implementing vertical swipe support in your widget.

Create an Android widget to drive long-term engagement

Convincing people to download your app is only the first step to creating a successful Android application. Chances are, if you grab your own Android smartphone or tablet and swipe through the app drawer, then you’ll discover multiple apps that you haven’t used in days, weeks or potentially even months!

Read also: Getting started with the Facebook for Android SDK

Once your app is successfully installed on the user’s device, you’ll need to work hard to keep them engaged and enjoying your app. Giving your app a presence on the homescreen can be a powerful tool to help drive long-term engagement, simply because it’s a constant reminder that your application exists!

A well-designed widget can also serve as an ongoing advert for your app. Every time the user glances at their homescreen, your widget has the opportunity to actively encourage them to re-engage with your app, by presenting them with all of your app’s most interesting and useful content.

Creating a collection app widget

In this tutorial, we’ll be building a collection widget that displays an array as a scrollable ListView.

In this tutorial, we'll be building a scrollable collection widget.

To help you track the app widget lifecycle, this widget will also trigger various toasts as it moves through the different lifecycle states. Towards the end of this tutorial, we’ll be enhancing our widget with a custom preview image that’ll be displayed in Android’s Widget Picker, and a configuration Activity, which will allow users to customize the widget before placing it on their homescreen.

Create a new Android project with the settings of your choice, and let’s get started!

Building your widget’s layout

To start, let’s define the widget’s user interface (UI).

Application widgets are displayed in a process outside your application, so you can only use layouts and Views that are supported by RemoteViews.

When building your layout, you’re restricted to the following:

  • AnalogClock
  • Button
  • Chronometer
  • FrameLayout
  • GridLayout
  • ImageButton
  • ImageView
  • LinearLayout
  • ProgressBar
  • RelativeLayout
  • TextView
  • ViewStub
  • AdapterViewFlipper
  • GridView
  • ListView
  • StackView
  • ViewFlipper

Note that subclasses of the above classes and Views are not supported.

Create a new layout resource file named list_widget.xml. Since we’ll be displaying our data using a ListView, this layout mainly serves as a container for a <ListView> element:

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"    android:layout_width="match_parent"    android:layout_height="match_parent"    android:layout_margin="@dimen/widget_margin">     <LinearLayout        android:layout_width="match_parent"        android:layout_height="match_parent"        android:background="#bbDEDFDE"        android:orientation="vertical">         <ListView            android:id="@+id/widget_list"            android:layout_width="match_parent"            android:layout_height="match_parent">        </ListView>    </LinearLayout>  </FrameLayout>

Populating the collection widget

Next, we need to create a data provider for our ListView. Create a new Java class named DataProvider.java and add the following:

import android.content.Context; import android.content.Intent; import android.widget.RemoteViews; import android.widget.RemoteViewsService;  import java.util.ArrayList; import java.util.List;  import static android.R.id.text1; import static android.R.layout.simple_list_item_1;  public class DataProvider implements RemoteViewsService.RemoteViewsFactory {     List<String> myListView = new ArrayList<>();    Context mContext = null;     public DataProvider(Context context, Intent intent) {        mContext = context;    }     @Override    public void onCreate() {        initData();    }     @Override    public void onDataSetChanged() {        initData();    }     @Override    public void onDestroy() {     }     @Override    public int getCount() {        return myListView.size();    }     @Override    public RemoteViews getViewAt(int position) {        RemoteViews view = new RemoteViews(mContext.getPackageName(),        simple_list_item_1);                view.setTextViewText(text1, myListView.get(position));                return view;    }     @Override    public RemoteViews getLoadingView() {        return null;    }     @Override    public int getViewTypeCount() {        return 1;    }     @Override    public long getItemId(int position) {       return position;    }     @Override    public boolean hasStableIds() {        return true;    }     private void initData() {        myListView.clear();        for (int i = 1; i <= 15; i++) {            myListView.add("ListView item " + i);        }     }   }

AppWidgetProvider: Configuring your widget

To create an Android widget, you need to create several files.

Our first widget-specific file is an AppWidgetProvider, which is a BroadcastReceiver where you’ll define the various widget lifecycle methods, such as the method that’s called when your widget is first created and the method that’s called when that widget is eventually deleted.

Create a new Java class (File > New > Java Class) named CollectionWidget.

To start, all widget provider files must extend from the AppWidgetProvider class. We then need to load the list_widget.xml layout resource file into a RemoteViews object, and inform the AppWidgetManager about the updated RemoteViews object:

public class CollectionWidget extends AppWidgetProvider {     static void updateAppWidget(Context context, AppWidgetManager appWidgetManager,                      int appWidgetId) {  //Instantiate the RemoteViews object//         RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.list_widget);            setRemoteAdapter(context, views);  //Request that the AppWidgetManager updates the application widget//         appWidgetManager.updateAppWidget(appWidgetId, views);     }

Create the adapter

Since we’re displaying our data in a ListView, we need to define a setRemoteAdapter() method in our AppWidgetProvider. The setRemoteAdapter() is equivalent to calling AbsListView.setRemoteViewsAdapter() but is designed to be used in application widgets.

In this method, we need to define the id of the AdapterView (R.id.widget_list) and the intent of the service that’ll eventually provide the data to our RemoteViewsAdapter – we’ll be creating this WidgetService class shortly.

private static void setRemoteAdapter(Context context, @NonNull final RemoteViews views) {    views.setRemoteAdapter(R.id.widget_list,         new Intent(context, WidgetService.class)); }  }

Defining the widget lifecycle methods

In our AppWidgetProvider, we also need to define the following widget lifecycle methods:

Retrieving new content with onUpdate

The onUpdate() widget lifecycle method is responsible for updating your widget’s Views with new information.

This method is called each time:

  • The user performs an action that manually triggers the onUpdate() method.
  • The application’s specified update interval has elapsed.
  • The user places a new instance of this widget on their homescreen.
  • An ACTION_APPWIDGET_RESTORED broadcast intent is sent to the AppWidgetProvider. This broadcast intent is triggered if the widget is ever restored from backup.

This is also where you’ll register any event handlers that your widget should use.

When updating an Android widget, it’s important to remember that users can create multiple instances of the same widget. For example, maybe your widget is customizable and the user decides to create several “versions” that display different information, or provide access to unique functionality.

When you call onUpdate(), you need to specify whether you’re updating every instance of this widget, or a specific instance only. If you want to update every instance, then you can use appWidgetIds, which is an array of IDs that identifies every instance across the device.

In the following snippet, I’m updating every instance:

@Override public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) {    for (int appWidgetId : appWidgetIds) {  //Update all instances of this widget//         updateAppWidget(context, appWidgetManager, appWidgetId);    }    super.onUpdate(context, appWidgetManager, appWidgetIds); }

Note that to help keep the code straightforward, this onUpdate() method isn’t currently making any changes to the widget.

onEnabled: Performing the initial setup

The onEnabled() lifecycle method is called in response to ACTION_APPWIDGET_ENABLED, which is sent when an instance of your widget is added to the homescreen for the first time. If the user creates two instances of your widget, then onEnabled() will be called for the first instance, but not for the second.

The onEnabled() lifecycle method is where you should perform any setup that’s required for all instances of your widget, such as creating the database that’ll feed your widget information.

I’m going to display a toast, so you can see exactly when this lifecycle method is called:

@Override public void onEnabled(Context context) {    Toast.makeText(context,"onEnabled called", Toast.LENGTH_LONG).show(); }

Note that if the user deletes all instances of your widget and then creates a new instance, then this is classed as the first instance, and the onEnabled() lifecycle method will be called once again.

Cleaning up, with onDisabled

The onDisabled() method is called in response to ACTION_APPWIDGET_DISABLED, which is triggered when the user deletes the last instance of your widget.

This widget lifecycle method is where you should cleanup any resources you created in the onEnabled() method, for example deleting the database you created in onEnabled().

To help keep our code straightforward, I’ll simply be displaying a toast every time this method is triggered:

@Override public void onDisabled(Context context) {    Toast.makeText(context,"onDisabled called", Toast.LENGTH_LONG).show(); }

The completed AppWidgetProvider

Your CollectionWidget file should now look something like this:

import android.appwidget.AppWidgetManager; import android.appwidget.AppWidgetProvider; import android.content.Context; import androidx.annotation.NonNull; import android.content.Intent; import android.widget.RemoteViews; import android.widget.Toast;  //Extend from the AppWidgetProvider class//  public class CollectionWidget extends AppWidgetProvider {     static void updateAppWidget(Context context, AppWidgetManager appWidgetManager,                      int appWidgetId) {  //Load the layout resource file into a RemoteViews object//         RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.list_widget);            setRemoteAdapter(context, views);  //Inform AppWidgetManager about the RemoteViews object//         appWidgetManager.updateAppWidget(appWidgetId, views);  }     @Override    public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) {        for (int appWidgetId : appWidgetIds) {            updateAppWidget(context, appWidgetManager, appWidgetId);        }        super.onUpdate(context, appWidgetManager, appWidgetIds);    }     @Override    public void onEnabled(Context context) {        Toast.makeText(context,"onEnabled called", Toast.LENGTH_LONG).show();    }       @Override    public void onDisabled(Context context) {        Toast.makeText(context,"onDisabled called", Toast.LENGTH_LONG).show();    }     private static void setRemoteAdapter(Context context, @NonNull final RemoteViews views) {        views.setRemoteAdapter(R.id.widget_list,                new Intent(context, WidgetService.class));    }     }

The AppWidgetProviderInfo file

Your application widget also requires an AppWidgetProviderInfo file, which defines several important properties, including your widget’s minimum dimensions and how frequently it should be updated.

The AppWidgetProviderInfo file is stored in your project’s res/xml folder.

If your project doesn't already contain an XML file, then you'll need to create one.

If your project doesn’t already contain this folder, then you’ll need to create it:

  • Control-click your project’s res folder.
  • Select New > Android Resource Directory.
  • In the subsequent window, open the Resource type dropdown, and select xml.
  • The Directory name should update to xml automatically, but if it doesn’t then you’ll need to change it manually.
  • Click OK.

Next, create a collection_widget_info file, which we’ll be using as our AppWidgetProviderInfo:

  • Control-click your project’s xml folder.
  • Select New > XML resource file.
  • Name this file collection_widget_info.
  • Click OK.

In our AppWidgetProviderInfo file, we need to define the following properties:

1. android:previewImage

This is the drawable that represents your application widget in the device’s Widget Picker.

Users can choose a widget from Android's Widget Picker.

If you don’t provide a previewImage, then Android will use your application’s icon instead. To encourage users to select your widget from the Widget Picker, you should provide a drawable that shows how your widget will look once it’s properly configured on the user’s homescreen.

The easiest way to create a preview image, is to use the Widget Preview application that’s included in the Android emulator. This app lets you configure your widget and then generate an image, which you can then use in your Android project.

We’ll be creating this image once we’ve finished building our widget, so for now I’ll be using the automatically-generated mipmap/ic_launcher resource as a temporary preview image.

2. android:widgetCategory

Application widgets must be placed inside an App Widget Host, which is usually the stock Android homescreen, but can also be a third party launcher such as Evie Launcher or Nova Launcher.

Between API levels 17 and 20, it was possible to place application widgets on the homescreen or the lockscreen, but lockscreen support was deprecated in API level 21.

You can specify whether your app widget can be placed on the homescreen, the lockscreen (which Android refers to as the “keyguard”) or both, using the android:widgetCategory attribute. Since it’s not possible to place widgets on the lockscreen in the most recent versions of Android, we’ll be targeting the homescreen only.

To preserve the user’s privacy, your widget shouldn’t display any sensitive or private information when it’s placed on the lockscreen.

If you give users the option to place your widget on the lockscreen, then anyone who glances at the user’s device could potentially see your widget, and all of its content. To help preserve the user’s privacy, your widget shouldn’t display any sensitive or private information when it’s placed on the lockscreen. If your widget does contain personal data, then you may want to consider providing separate homescreen and lockscreen layouts.

3. android:initialLayout

This is the layout resource file that your widget should use when it’s placed on the homescreen, which for our project is list_widget.xml.

4. android:resizeMode=”horizontal|vertical”

The android:resizeMode attribute lets you specify whether your widget can be resized horizontally, vertically, or along both axes.

To ensure your widget displays and functions correctly across a variety of screens, it’s recommended that you allow your widget to be resized horizontally and vertically, unless you have a specific reason not to.

5. android:minHeight and android:minWidth

If your widget is resizable, then you need to ensure the user doesn’t shrink your widget to the point where it becomes unusable. You can use the minHeight and minWidth attributes to define the smallest your app will shrink when it’s being resized by the user.

These values also represent your widget’s initial size, so if your widget isn’t resizable then minHeight and minWidth will define the widget’s permanent sizing.

6. android:updatePeriodMillis

The AppWidgetProviderInfo is also where you’ll specify how often your widget should request new information.

The smallest supported update interval is once every 1800000 milliseconds (30 minutes). Even if you declare a shorter update interval, your widget will still only update once every half an hour.

While you may want to display the latest information as quickly as possible, the system will wake a sleeping device in order to retrieve new information. Frequent updates can burn through a device’s battery, particularly during periods where the device is left idle for a significant period of time, such as overnight. Providing the best possible user experience means striking a balance between limiting battery consumption, and providing new information within a reasonable time frame.

You should also take into account the kind of content your widget will display.

You should also take into account the kind of content your widgets for Android will display. For example, a weather widget may only need to retrieve an updated forecast once per day, whereas an app that displays breaking news will need to update more frequently.

To find this perfect balance, you may need to test your widget across a range of update frequencies and measure the impact on battery life, and the timeliness of your widget’s content. If you have a willing group of testers, then you could even setup A/B testing, to see whether some update frequencies are received more positively than others.

Aalso read: AndroidManifest.xml everything you need to know

Finally, once you’ve identified the perfect update interval, you may want to use a shorter interval when developing and testing your app. For example, you could use the shortest possible update frequency (android:updatePeriodMillis=”1800000″) when you’re testing that your app’s onUpdate() method is triggering correctly, and then change this value before releasing your app to the general public.

The completed AppWidgetProviderInfo

The finished collection_widget_info.xml file should look something like this:

<?xml version="1.0" encoding="utf-8"?> <appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android"    android:previewImage="@mipmap/ic_launcher"    android:widgetCategory="home_screen"    android:initialKeyguardLayout="@layout/list_widget"    android:initialLayout="@layout/list_widget"    android:minHeight="100dp"    android:minWidth="100dp"    android:updatePeriodMillis="1800000"    android:resizeMode="horizontal|vertical">  </appwidget-provider>

Don’t clutter the user’s homescreen!

To ensure the homescreen never looks cluttered, we’re going to add some padding and margins to our widget. If your project doesn’t already contain a dimens.xml file, then you’ll need to create one:

  • Control-click your project’s values folder.
  • Select New > Values resource file.
  • Give this file the name dimens.
  • Click OK.

Open your dimens.xml file and define the following margin and padding values:

<resources>    <dimen name="widget_margin">10dp</dimen>    <dimen name="widget_header_padding">8dp</dimen> </resources>

Sending data to the widget

Next, we need to create a widget service, which will be responsible for sending our collection data to the widget.

Create a new Java class (New > Java Class) named WidgetService, and add the following:

import android.content.Intent; import android.widget.RemoteViewsService;  public class WidgetService extends RemoteViewsService {    @Override    public RemoteViewsFactory onGetViewFactory(Intent intent) {        return new DataProvider(this, intent);    } }

Registering your widget in the Manifest

We now need to make some changes to our project’s Manifest.

To start, open the Manifest and register your widget as a BroadcastReceiver. We also need to add an intent filter for the android.appwidget.action.APPWIDGET_UPDATE action:

     <receiver android:name=".CollectionWidget">            <intent-filter>                <action android:name="android.appwidget.action.APPWIDGET_UPDATE" />            </intent-filter>

Next, you need to specify the app widget provider:

           <meta-data                android:name="android.appwidget.provider"                android:resource="@xml/collection_widget_info" />        </receiver>

Finally, we need to declare the service that will send data to our widget, which in this instance is the WidgetService class. This service requires the android.permission.BIND_REMOTEVIEWS permission:

       <service android:name=".WidgetService"            android:permission="android.permission.BIND_REMOTEVIEWS" />

Put your widget to the test

If you’ve been following along with this tutorial, then you’ll now have a complete collection widget that displays a set of data on the user’s homescreen.

Create Widgets for Android

If this was a real-life Android project, then you’d typically expand on the lifecycle methods, particularly the onUpdate() method, but this is all we need to create a widget that you can install and test on your Android device:

  • Install this project on a compatible Android smartphone, tablet or AVD (Android Virtual Device).
  • Long-press any empty section of the homescreen, and select Widgets when prompted; this launches the Widget Picker.
  • Swipe through the Widget Picker until you find the application widget you just created.
  • Long-press this widget to add it to your homescreen.
  • Since this is the first instance of this particular widget, the onEnabled() method should run, and you’ll see an “onEnabled called” toast.
  • Resize your widget. If you set a minimum supported size, then check that you cannot shrink the widget past this value.
  • Test that the ListView scrolls, as expected.
  • Next, you should check the onDisabled() method, by deleting your widget. Long-press the widget, and then select Remove from Home screen. Since this is the last instance of this particular widget, the onDisabled() method should run, and you’ll see an “onDisabled called” toast.

This is all you need to deliver a functioning Android application widget, but there’s a few additions that can often improve the user experience. In the following sections, we’ll encourage users to choose this widget from the Widget Picker, by creating a preview image that showcases the widget at its best. I’ll also show you how to create a fully-customizable widget, by adding a configuration Activity to your project.

Creating an Android widget preview image

If you grab your Android device and swipe through the Widget Picker, you’ll see that every widget is represented by an image, which usually demonstrates how this widget will look once it’s configured on the user’s homescreen.

To encourage users to select your widget, you should provide a preview image that highlights all of the useful information and features that your widget has to offer.

You can quickly and easily create a preview image, using the Widget Preview application that’s included in the Android emulator.

Note that Widget Preview isn’t included in the latest Android system images, so you’ll need to create an AVD using Nougat (API Level 25) or earlier:

  • Install your application on an AVD that’s running API 25 or lower.
  • Open the AVD’s app drawer and launch the Widget Preview app.
  • The Widget Preview will display a list of every application that’s currently installed on this AVD; select your application from the list.

Create a preview image, using the Widget Preview application.

  • Your widget will now be displayed on a blank background. Spend some time resizing and tweaking your widget until it’s showing the very best that your widget has to offer.
  • Once you’re happy with your widget’s appearance and content, select Take Snapshot.

Configure your widget and take a screenshot, by clicking the Camera button.

  • To retrieve your snapshot, switch back to Android Studio and select View > Tool Windows > Device File Explorer from the toolbar. This launches Android Studio’s Device File Explorer.
  • In the Device File Explorer, navigate to sdcard/Download. You should find your preview image saved in the following format: [application_name]_ori_[orientation].png

Extract your screenshot from the AVD's "sdcard/download" folder.

  • Drag this image out of Android Studio and drop it somewhere easily accessible, such as your Desktop.
  • Give this image file a descriptive name.
  • Drag and drop the file into your project’s drawable folder.
  • Open your AppWidgetProviderInfo, which for this project is collection_widget_info.xml.
  • Find the android:previewImage=”@mipmap/ic_launcher” line and update it to reference your preview image.

Your widget will now use this new image resource as its preview image:

  • Install the updated project on your physical Android device or AVD.
  • Long-press any empty section of the homescreen.
  • Tap Widgets, which launches the Widget Picker.
  • Scroll to your widget; it should now be using the updated preview image.

Customizable widgets: Adding a configuration Activity

A configuration Activity launches automatically when the user places each instance of your widget on their homescreen.

There’s several reasons why you might want to add a configuration Activity to your project.

widgets tend to provide the best user experience when they provide access to the information or features that are most important to the individual user.

Firstly, some widgets require initial setup, for example a widget that displays traffic alerts might need to know the user’s home address, where they work, and the times when they typically commute. Without some way to enter this information, your widget might be completely useless!

In addition, widgets tend to provide the best user experience when they provide access to the information or features that are most important to the individual user. By adding a configuration Activity to your project, you can give users the freedom to pick and choose exactly what’s included in your widget.

Even relatively straightforward customizations, such as changing a widget’s background or font, can have a positive impact on the user experience – after all, no-one’s going to appreciate a widget that visually clashes with the rest of their homescreen!

No-one’s going to appreciate a widget that visually clashes with the rest of their homescreen!

Alternatively, sometimes you may have a long list of content that you want to include in your widget, and you’re struggling to narrow down your options. A configuration Activity can be a way to put all of your ideas to good use, without creating a cluttered, confusing widget. Just bear in mind that setting up a widget shouldn’t feel like a chore, so if you do provide a configuration Activity then it’s recommended that you limit yourself to three configuration options.

Let’s add a configuration Activity to our project!

Firstly, our configuration Activity needs a layout, so create a new layout resource file named config_activity.xml.

I’m going to add the following buttons to this layout:

  • A configuration button. In a real-life project, this button would modify the widget in some way, for example adding or removing content, or changing how frequently the widget updates. To help keep our code straightforward, clicking this button will simply display a Configuration Options toast.
  • A setup button. Once the user is happy with how their widget is configured, pressing this button will place the newly-configured widget on their homescreen.

Here’s my completed config_activity.xml file:

<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"     android:orientation="vertical" android:layout_width="match_parent"     android:layout_height="match_parent">      <Button         android:id="@+id/configButton"         android:layout_width="fill_parent"         android:layout_height="wrap_content"         android:layout_alignParentLeft="true"         android:layout_marginTop="180dp"         android:text="Perform some configuration"         android:textColor="#808080" />      <Button         android:id="@+id/setupWidget"         android:layout_width="fill_parent"         android:layout_height="wrap_content"         android:layout_alignParentLeft="true"         android:layout_marginTop="180dp"         android:text="Create the widget"         android:textColor="#808080" />  </LinearLayout>

Create the Configuration Activity

Now, we need to create our configuration Activity.

To start, create a new Java class named ConfigActivity. In this Activity, we’re going to retrieve the App Widget ID from the intent that launched the configuration Activity. If this intent doesn’t have a widget ID, then we’ll need to call the finish() method:

        Intent intent = getIntent();         Bundle extras = intent.getExtras();         if (extras != null) {             appWidgetId = extras.getInt(                     AppWidgetManager.EXTRA_APPWIDGET_ID,                     AppWidgetManager.INVALID_APPWIDGET_ID);        if (appWidgetId == AppWidgetManager.INVALID_APPWIDGET_ID) {                 finish();             }

Next, we need to create a return intent, pass the original appWidgetId and set the results from the configuration Activity:

            Intent resultValue = new Intent();             resultValue.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId);             setResult(RESULT_OK, resultValue);             finish();         }     } }

If you provide a configuration Activity, then the ACTION_APPWIDGET_UPDATE broadcast won’t be sent automatically when the configuration Activity is launched, which means the onUpdate() method won’t be called when the user creates an instance of your widget.

To ensure your widget is created with up-to-date information and content, your configuration Activity must trigger the first onUpdate() request.

Here’s the completed ConfigActivity:

import android.app.Activity; import android.appwidget.AppWidgetManager; import android.os.Bundle; import android.widget.Button; import android.content.Intent; import android.view.View; import android.view.View.OnClickListener; import android.widget.Toast;  public class ConfigActivity extends Activity {       @Override      protected void onCreate(Bundle savedInstanceState) {          super.onCreate(savedInstanceState);          setContentView(R.layout.config_activity);          setResult(RESULT_CANCELED);          Button setupWidget = (Button) findViewById(R.id.setupWidget);          setupWidget.setOnClickListener(new OnClickListener() {               @Override              public void onClick(View v) {                  handleSetupWidget();              }         });         Button configButton = (Button) findViewById(R.id.configButton);         configButton.setOnClickListener(new OnClickListener() {              @Override             public void onClick(View v) {                 handleConfigWidget();             }         });      }      private void handleSetupWidget() {         showAppWidget();      }      private void handleConfigWidget() {         Toast.makeText(ConfigActivity.this,                 "Configuration options", Toast.LENGTH_LONG).show();      }      int appWidgetId;     private void showAppWidget() {         appWidgetId = AppWidgetManager.INVALID_APPWIDGET_ID;          Intent intent = getIntent();         Bundle extras = intent.getExtras();         if (extras != null) {             appWidgetId = extras.getInt(                    AppWidgetManager.EXTRA_APPWIDGET_ID,                    AppWidgetManager.INVALID_APPWIDGET_ID);              if (appWidgetId == AppWidgetManager.INVALID_APPWIDGET_ID) {                 finish();             }  //TO DO: Perform the configuration//              Intent resultValue = new Intent();             resultValue.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId);             setResult(RESULT_OK, resultValue);             finish();         }     } }

Once you’ve created a configuration Activity, you need to declare this Activity in the Manifest and specify that it accepts the APPWIDGET_CONFIGURE action:

       <activity android:name=".ConfigActivity">            <intent-filter>                <action android:name="android.appwidget.action.APPWIDGET_CONFIGURE"/>            </intent-filter>         </activity>

Finally, since a configuration Activity is referenced outside of the package scope, we need to declare this Activity in our AppWidgetProviderInfo, which in this instance is the collection_widget_info.xml file:

   android:configure="com.jessicathornsby.collectionwidget.ConfigActivity">

Testing your project

Now it’s time to put your finished project to the test:

  • Install your updated project on a physical Android device or AVD.
  • Delete all previous instances of your widget, to ensure you’re working with the very latest version.
  • Long-press any empty area of the homescreen and select Widgets when prompted.
  • Find your widget in the Widget Picker and long-press to select it.
  • Drop the widget onto your homescreen. The Configuration Activity should launch automatically.
  • Give the Perform Some Configuration button a click, and a Configuration Options toast should appear, confirming that this interaction has been registered successfully.
  • Imagine that you’ve tweaked the widget’s settings and are now ready to place it on your homescreen; give the Create The Widget button a tap, and this widget should be created successfully.

You can download the completed collection widget project from GitHub.

Wrapping up

How to Make an Android Widget

In this article, we created a scrollable collection widget that displays a data set on the user’s homescreen.

If you want to continue working with this project, then you could try adding your own code to the onUpdate() method, to create a widget that updates with new information at the interval defined in your AppWidgetProviderInfo file (collection_widget_info).

If you do create an Android widget, then be sure to share your creations in the comments below!

More posts about Android Development

Spreadsheet Data Science

Microsoft Certification: A guide for tech professionals

Adam Sinicki Programming Android Development Java

How to become an Associate Android Developer, and is it worth it?

Adam Sinicki Programming on Laptop Android Studio

Unity certification for developers: Is it worth it?

Adam Sinicki Building your Android UI Everything you need to know about Views

Building your Android UI: Everything you need to know about Views

Jessica Thornsby Laptop Coding Work Online

I made $50,000 from Android apps and you can too

Adam Sinicki Android Q Beta 5 Peeking

Android developer news and features round-up (July 2019)

Adam Sinicki Android Q Beta 4 Notification Swipe Direction

Android developer news and features round-up: June 2019

Adam Sinicki

Getting started with the Facebook for Android SDK

Jessica Thornsby Woman Typing or Coding on Laptop Outside

How to work as a software developer online: Everything you need to know

Adam Sinicki Mastering Android Programming

Uncover the secrets of Android app development for just $20

AA Picks

Save 60% on our Introduction to Android Development Course

Android Authority has created a course to help you learn how to develop Android Apps! No Coding Experience Required. Start Your Journey on Becoming an Android Developer today. Visit DGiT Academy today. Enter discount code: SIXTYOFF at checkout to receive 60% off.

read more
Android Development

Unity certification for developers: Is it worth it?

Unity Certification can potentially help you to land your dream job as a games developer. These are certifications awarded directly from Unity that are well-recognized within the industry. But are they good value? Are they the best certifications for budding games developers? And how do you get started?

Read also: How to work as a software developer online

What is Unity Certification?

Unity Game Example

Unity is a multi-platform game engine and IDE that makes it much simpler to build high quality games. It’s also a popular industry standard, meaning that there are lots of jobs for Unity developers. Whereas Unreal Engine tends to be slightly more popular for developing AAA titles for PC and consoles, Unity is particularly well suited to creating mobile games and 2D indie titles. Unity is the number one game development tool used across the Google Play Store.

Unity Developer was ranked #7 on LinkedIn’s list of Top 20 Emerging Jobs in 2017

Part of the appeal of Unity is that it is free to download and use, and actually extremely easy to get to grips with. While a little C# programming is required, you can actually build a simple game with relatively little coding knowledge.

But being a Unity developer and being employed/hired to work on big, well-paid projects are two different things. With it being so easy these days to market yourself as a developer online through platforms like LinkedIn, it can be hard to stand out from the crowd. That’s why you need to take it upon yourself to build up your CV by adding skills and qualifications – to demonstrate the expertise you claim to possess. Unity Certification might just be a good choice to this end.

Read also: How to use LinkedIn and land your dream job!

Unity Certification is intended to demonstrate to potential employers/clients that you meet a certain level of skill and expertise as a Unity developer. However, rather than gaining a single certification as a “Unity developer,” you’ll instead take individual tests for a range of specific skills within that broad category.

Here are the main certifications currently available:

  • Unity Certified Programmer
  • Unity Certified 3D Artist
  • Unity Certified Expert Gameplay Programmer
  • Unity Certified Expert Technical Artist: Rigging & Animation
  • Unity Certified Expert Technical Artist: Shading & Effects

Expert certificates are aimed at experienced professionals, whereas the Certified Programmer and Certified 3D Artist are intended for mid-level professionals.

Read also: Best online business courses to supercharge your career

It is also possible to become a Unity Certified Associate which is a more general certification positioned as an entry-level option. Another certificate titled Unity Certified User: Programmer is also available for schools, colleges, and universities.

Each of these certifications are the result of collaboration between Unity and “subject matter experts.”

Examination costs and requirements

Unity Developer Certification

To become a certified Unity developer, you will need to sit an exam at one of the 5,200 Pearson Vue Testing Centers located globally. The exams consist of 40-100 questions, last 90-165 minutes, and require a passing grade of 70%. It is recommended that you arrive 15 minutes early.

You can find a full FAQ here.

The Unity Certification exams and course materials (called Courseware) must be purchased separately and neither is cheap. To take an exam you’ll need to purchase a Unity Certification Voucher which can cost anywhere from $150 to $349 depending on the level of certificate and your location (these prices are also subject to change).

If you fail the test, you will need to retake it, which you will need to pay for separately. If you want to take a practice test (available for Unity Certified Programmer and Unity Certified Expert Gameplay Programmer) then these will cost you over $100.

Read also: How to find work as an Android developer

Another consideration is that Unity Certification is only valid for 2 years, after which you will need to retake the test. On one level, this is understandable given the ever changing nature of Unity. On the other hand, it means that it will cost you roughly $50-$200 per year to remain a certified Unity Developer. That is a steep cost to pay, and that is before you even consider the cost of transport.

Unity Certification course materials

Unity certification

Further compounding the matter is the fact that the courseware is even more expensive. At the time of writing, a U.S. resident will pay $480 dollars for the Unity Certified Expert Gameplay Programmer course!

According to one blogger who tried the courseware themselves, the materials take over a month to work through and the experience is a little rough around the edges. That said, this was a few years ago.

You do have the option to study independently before taking the exam. There are many alternative courses available from the likes of Udemy for instance, such as The Ultimate Guide to Game Development with Unity 2019.

Better yet, we found this FREE Unity Certified Programmer Exam Preparation Specialization course over at Coursera. You’re welcome!

Read also: Build your first basic Android game in just 7 minutes (with Unity)

Of course though, by foregoing the official exam materials you risk missing crucial information you’ll need for the test. If you have the money, then it’s recommended that you fork out for the official guide.

Is Unity Certification worth it for a Unity developer?

So, that’s Unity Certification in a nutshell. But is it worth it?

That’s a more complex question to answer, and as usual I’m going to cop out by saying that it depends on the type of developer you are.

It will cost you roughly $50-$200 per year to remain a certified Unity Developer

It is certainly true that Unity Certification will look good on your resume. As one Reddit user, Demaun, put it:

It’s certainly a boon to your resume, if it’s a bit thin. It’s designed to be a simple way to certify that a candidate is qualified for at least an entry-level job using Unity. Like LitchiSzu said, though, it could easily be replaced by actual projects, although that will not be as concise on a resume.

This is a fair statement. If you are a self-taught Unity developer and you just need something recognized to put on your LinkedIn, then Unity Certification is a good place to start. It’s recognized, it’s official, and it’s specific to the kind of work you’re looking for.

Read also: I made $50,000 from Android apps and you can too

But it’s also only one option, and it won’t be right for everyone.

Alternatives to Unity Certification

Unity itself is relatively simple to learn, and so I would hazard that for long-term job roles, any kind of C# qualification or certification will be just as useful (and likely less expensive) and more so if it’s degree level.

You could take this Introduction to C# from Microsoft and only pay a small amount for the certificate at the end.

Likewise, if you can demonstrate any previous experience – if you’ve worked for another company, or developed a successful game of your own – then this will be just as useful for finding work. Spend some time tinkering and building your own indie games, and take part in hackathons. If you can show something impressive that you built from scratch, this will be enough to land you a lot of jobs.

Unity developer

If you’re more interested in learning to become a Unity developer, then this certainly is not the most cost effective route. In that case, you would do far better to simply get started with a few simple projects, or to take a more structured course such as the aforementioned The Ultimate Guide to Game Development with Unity 2019.

In short, Unity Certification is a well-recognized qualification, but owing to the costs, it won’t be worth it for every kind of Unity developer. Start by teaching yourself the ropes and building some apps, then go from there.

More posts about Future Jobs

Spreadsheet Data Science

Microsoft Certification: A guide for tech professionals

Adam Sinicki Programming Android Development Java

How to become an Associate Android Developer, and is it worth it?

Adam Sinicki Keyboard Focus Closeup Typing

The best online certificate programs for enhancing your career

Adam Sinicki Working at Computer Future Jobs

Best online business courses to supercharge your career

Adam Sinicki Gadgets Laptop Headphones Work Online

Adobe Certification is a great career move for creative professionals

Adam Sinicki AI Automation of Jobs

Is your job safe? Jobs that AI will destroy in the next 10-20 years

Adam Sinicki Keyboard Typing Working Coding

What is ethical hacking? Learn how to hack and earn money

Adam Sinicki Data analyst

How to become a data analyst and prepare for the algorithm-driven future

Adam Sinicki Best LinkedIn Profiles

How to use LinkedIn and land your dream job!

Adam Sinicki

7 easy passive income ideas to make money while you sleep

Adam Sinicki

read more
Android Development

How to become an Associate Android Developer, and is it worth it?

Associate Android Developer is a certification from Google that may enhance your career as a developer. In this post, we’ll explore why.

Developing Android apps isn’t particularly hard. The hard part is developing good Android apps, and proving that to clients. Getting a certification will help with that, and what better organization to be certified with than Google itself?

What better organization to be certified with than Google itself?

Associate Android Developer is a Google Developers Certification that comes direct from the company responsible for the tools you’ll use. It’s globally recognized, and in theory it can demonstrate your expertise in Android development.

Also read: Unity certification for developers: Is it worth it?

How to become an Associate Android Developer

To become an Associate Android Developer, you will need to take an exam on Android Studio, the Android SDK, and either Java or Kotlin (you can choose which language you want to use). After paying and proving your identity, you will be able to complete the exam and must submit within 8 hours.

Certified Android Developer

If your submission is successful, you will then be asked to complete an exit interview, which involves recording spoken answers. If you are successful in this portion, you will be awarded your certificate. Marking can take up to 45 days.

Unlike Unity Certification, Associate Android Developer Certification is relatively inexpensive costing just $149 (prices may vary slightly depending on your location). However, you will need to pay again if you don’t pass the exam.

What do I need to know?

The exam is aimed at the “entry-level Android developer,” so certification should be achievable for most people willing to put in the effort, especially if they have experience with Android development.

Programming on Laptop Android Studio

It is your responsibility to study and educate yourself prior to taking the exam, though Google provides the exam content to help guide this study. Students should understand:

  • App functionality – Know how to build apps utilizing messaging, multitasking, and other features.
  • User interface – Understand how to use Android’s UI frameworks.
  • Data management – Utilize Android’s frameworks to store and retrieve data in a mobile environment.
  • Debugging
  • Testing

You can also find a full study Guide here.

We recommend that you consider taking an Android development course before you sit for the exam to avoid having to pay twice!

Also read: I want to develop Android apps – Which languages should I learn?

The most comprehensive and easy-to-follow course for learning Android development is Introduction to Android App Development by Gary Sims. This course will take you from complete beginner to seasoned Android developer over a series of short video tutorials. Once you’ve worked through the program, you’ll have more than enough experience to take a stab at the exam.

Is it worth it?

So, is it worth becoming an Associate Android Developer? I feel confident this time saying yes – at least for the right student.

Also read: I made $50,000 from Android apps and you can too

Certification of this nature won’t be a huge game-changer. Getting it is relatively easy, and employers will also want to see other qualifications and examples of your past work. Having developed a hit app or worked for a big software firm would absolutely matter more than Associate Android Developer status.

Google Developers Certification

In fact, the level of expertise in Android demonstrated by this certificate is probably nothing an organization wouldn’t be happy to train you in anyway.

So if you’re already in a good position in your developer career, this may not be game-changing for you.

That said, in a sea of CVs (a CV sea), this additional certification might just help you stand out. More to the point, if you’re a new developer and you want some kind of experience or qualification to gain the trust of potential clients or employers (especially if you’re self-employed), the Associate Android Developer certification is a great place to start.

If you have absolutely no experience or degree, this might be just enough to build confidence in a client.

Potential employers can search through an index of certified developers.

The price of the certification alone should clinch the deal. When it’s this affordable, there’s almost no good reason not to add it to your resume. It also doesn’t take a huge investment of time. As an added bonus, potential employers can also search through an index of certified developers; giving you another chance to get discovered.

Also read: How to work as a software developer online: everything you need to know

Android development

Keep in mind Associate Android Developer is just one of many Google Developers Certificates. We’ll be looking at those in future, but for now, let us know what you think of the Associate Android Developer certificate.

Will you be getting it? What good alternatives do you recommend?

Save 60% on our Introduction to Android Development Course

Android Authority has created a course to help you learn how to develop Android Apps! No Coding Experience Required. Start Your Journey on Becoming an Android Developer today. Visit DGiT Academy today. Enter discount code: SIXTYOFF at checkout to receive 60% off.

More posts about Android Development

Spreadsheet Data Science

Microsoft Certification: A guide for tech professionals

Adam Sinicki Widgets for Android Homescreen

Create a scrollable widget for your Android app

Jessica Thornsby Programming on Laptop Android Studio

Unity certification for developers: Is it worth it?

Adam Sinicki Building your Android UI Everything you need to know about Views

Building your Android UI: Everything you need to know about Views

Jessica Thornsby Laptop Coding Work Online

I made $50,000 from Android apps and you can too

Adam Sinicki Android Q Beta 5 Peeking

Android developer news and features round-up (July 2019)

Adam Sinicki Android Q Beta 4 Notification Swipe Direction

Android developer news and features round-up: June 2019

Adam Sinicki

Getting started with the Facebook for Android SDK

Jessica Thornsby Woman Typing or Coding on Laptop Outside

How to work as a software developer online: Everything you need to know

Adam Sinicki Mastering Android Programming

Uncover the secrets of Android app development for just $20

AA Picks

read more