/r/androiddev
News for Android developers with the who, what, where, when and how of the Android community.
News / Articles / Talks / Tools / Open source!
News for Android app developers with the who, what, where, when, and how of the Android community. Probably mostly the how.
Here, you'll find:
This sub-reddit isn't about phones' and apps' general functionality, support, or system software development (ROMs). For news and questions about these topics try using other subs like
Starting Android career in 2022
Android Job Interview Questions and Answers
App Portfolio Ideas, Tiered List
Autoposted at approx 9AM EST / 2PM GMT
/r/androiddev
Hello guys!
I've been working with Kotlin for a few years and the last 2 with Compose. I'm a big fan of both.
Nevertheless, one of the things that I find really unfortunate is the awful discoverability that Kotlin introduced in the ecosystem. I used to learn a lot just by navigating and reading through code/packages/libraries, but now everything is so spread out that it makes it impossible.
I've recently came across "Extension-oriented Design" by Roman Elizarov which expands on why this was the choice for Kotlin and I enjoyed the article.
But surely there should be an easy way to allowed devs to keep up to date, right? Right?
E.g. 1:
Previous to Kotlin, if I'd want to perform some transformations on collections, I'd go into the Collection interface or take a look at the package and find some neat methods that would steer me in the right path.
Nowadays it'll be some extension that will be hidden in some package that I must include as a dependency that is almost impossible to find unless you know what you're looking for.
E.g. 2: I was trying to clean up some resources, android compose documentation hints `onDispose` method. Only by chance today I found there is LifecycleResumeEffect - which seems much more appropriate and up-to-date.
TL;DR - I think it's very hard to discover new methods / keep up to date with functionality (Kotlin & Compose) when it is spread out over X packages / libraries.
Do you agree? How do you navigate that? Am I missing some trick?
Is there any Android Studio plugin to automatically extract all hard coded strings and put in strings.xml file?
Is anyone out there slicing up their ViewModels to encapsulate related functionality for modularity and facilitation of simpler testing with Mocks?
Example:
class MyViewModel @Inject constructor(
private val delegate: HelperVMDelegate.Factory,
private val scope: ViewModelScope,
) : ViewModel(scope), HelperVMDelegate by delegate.create(scope) {
I am getting pushback from some on this because:
This is a reminder that this Subreddit isn't for career advice. We regularly see posts asking how the job market is, or whether Android development is a good career, or if it's a good thing to add to a resume. We don't allow these questions for two reasons. First, the market is constantly changing, and differs enormously depending on location, politics, and the time of year. Second, a person's likelihood of success is dependent on their tenacity, skill, and experience. A job coach, developers at a local meetup, or simply looking up jobs in your area on LinkedIn will give you more meaningful information than replies on here.
If what you're really asking is, "can I easily learn this and make a lot of money shoveling an ad-ridden copycat game onto Google Play"... no. If you're new and trying to fine-tune your skills, you can ask your question here in the "newbie and advice" thread.
This is a reminder that this Subreddit isn't for marketing advice. Yes, if you are an independent developer how you market your app, how you price it, and making sense of sales and impression trends are all important. However, that is a separate skill set from application development. There are excellent communities of professionals that should be your preferred source of information. That said, questions regarding sales and marketing will be allowed here in the "newbie and advice" thread.
This is a reminder that this Subreddit isn't a replacement for learning or working with your team. Although we now allow questions that are of general interest to the development community, we expect the question to demonstrate a baseline knowledge of Android development and that it should prompt a healthy discussion between professionals. There has been a recent rise in questions that are at once too broad and too specific. These questions generally amount to "walk me through how to develop this core feature of my app". It's often couched in different ways. "Is it possible to do this...", "Can someone partner with me...", "How would you implement...", but the result is the same. If you want to have this kind of discussion, please join our Discord server, or reserve the questions for this "newbie and advice" thread.
So, with that said, welcome to the December 2024 newbie and advice thread! Here, as usual, we will be allowing basic questions, seeking situation-specific advice, and tangential questions that are related to but not directly Android development.
If you're looking for the previous October 2024 thread, you can find it here.
If you're looking for the previous November 2024 thread, you can find it here.
Happy holidays, and wishing everyone the best as we wrap up 2024,
The Mods
Hi Android Community! I was wondering if anyone has been able to do compose testing with ExoPlayer3 video and if you are able to mock or play a local video. I’ve looked around online but see really limited resources on this and was wondering if it’s possible! There doesn’t seem to be much documentation around testing ExoPlayer as well.
I did an application to a junior android position where they asked me to develop a challenge to fetch and use the GitHub API.
I did it and the final result worked well, however they decide to not do a technical interview with me.
At least, they give me feedback which I would like to know if you agree with them, and if was your case you also didn't go with the next interview.
Positive points
Use of appropriate tools: It was clear that you have a solid foundation and are familiar with some of the important tools for
Complete functionalities: All the functionalities requested in the challenge were implemented, which demonstrates attention to the requirements
Well-structured pagination: The use of pagination was executed effectively, showing a good understanding of this
Presence of navigation: Despite some points for improvement, the application includes navigation, which is always positive.
Areas for Improvement
Implementation of Flows: Despite having mentioned the use of Flows, the practical implementation does not correspond to what was expected, except for the pagination part. It is important to align the use of the tool with good practice and the purpose described.
Lack of Dependency Injection (DI): The lack of DI compromises the scalability and organization of the code, and is an essential point to consider in future
Inconsistent architecture: Although there was an attempt to structure the application, the use of ViewModels was lacking. Instead, there was an excessive use of LaunchedEffects to bridge this gap, which is not a recommended
Lack of repository layer: A repository layer was not implemented, which is essential for separating responsibilities and improving code
Problems with the Home Screen: The implementation of the Home Screen presents some choices that could be simplified. For example, the use of Scaffold and Column would have been sufficient, avoiding redundancies such as multiple containers, remembers and unnecessary LaunchedEffects.
Use of viewModelScope.launch: Although I tried to use viewModelScope.launch(Dispatchers.IO), its application was not correct, and it deserves special attention for future projects.
I mean, I agree with them in some cases, but I wouldn't definitely refuse an interview because of them, given that was a junior position.
Can you give me your opinion? This is the github link: https://github.com/andrecasal00/bliss-challenge
I am working on an Android project using the GameActivity
template in Android Studio. I've encountered an issue where touch events sometimes go out of sync with the render loop. When this happens, I do not receive any touch events for the current frame, and the missed touch events are instead received in the next frame.
onTouchEvent
without changing the frame rate? I want to handle touch inputs more frequently without impacting the render loop's frame rate.Any insights, workarounds, or solutions would be greatly appreciated!My Questions:How can I fix this synchronization issue?
Hi,
im using surface.setFramerate() with the parameter " Surface.FRAME_RATE_COMPATIBILITY_DEFAULT" to set the users display to match with my games FPS which is 60, however changing the hz doesn't work on Xiaomi phones, Motorola and pixel phones working fine, any ideas on how to change the refresh rate on Xiaomi phones?
Link to the official framerate doc: https://developer.android.com/media/optimize/performance/frame-rate
I guess it has something to do with MIUI, but I'm not sure.
Any help would be appreciated!
Thanks
As a side project, I’ve been experimenting with bytecode optimization and achieved some intriguing results:
🚀 3x speedup in Android’s presentation layer
⏩ 30% faster startup times for Uber
These are proof-of-concept results, but the potential feels significant. If there’s interest, I’d be happy to release the code, explore further, and explore these techniques further.
I know tools like Redex, baseline profiles, and Dexguard/R8. They operate at a different level and these results suggest there’s still a lot of potential.
Why aren’t these kinds of optimizations more common? I’d love to hear your thoughts or collaborate to push this further!
I created a small Android Studio plugin that creates previews from you composable function. It's quite simple so far. When you cursor is on a top level composable function name you can find "Create Composable Preview" in the generate menu (control + enter). It then takes the name of the composable function and creates a preview function with a suffix you can set in the settings. It also initializes all parameters of you composable and adds an import for the preview annotation if there is none.
You can find it here:
https://plugins.jetbrains.com/plugin/25951-jetpack-compose-preview-creator/
and the code on github: https://github.com/EarlOfEgo/Jetpack-Compose-preview-creator
Hello Everyone!
I am working on a project and I am trying to find the best way to securely store and handle secret keys (like secretEncryptKey, AWSKeys, etc.) without exposing them in code. I am looking for solutions that do not include:
I am seeking some secure and scalable ways of handling secrets—be it a third-party service, encryption methods, or a secure storage solution that integrates well with the project. Any suggestions or best practices would be much appreciated!
Thanks in advance for your insights!
I am working on a project and have a very small interface and a class that implements it. I placed them in the same file as I think it's not really necessary to split them into two separate files because of their size.
In the Kotlin coding conventions page it's encouraged to place multiple declarations in a single file as long as they are closely related to each other. Although it states that in particular for extension functions.
I was suggested to split them into separate files. So, what would the best practice be here ?
Hello Android devs! 👋
We've just released an open-source WYSIWYG Rich Editor for Jetpack Compose that makes adding rich text editing to your Android apps easier and more fun than ever!
If you've ever wanted to seamlessly integrate rich text features like bold, italic, underline, and different heading levels into your Jetpack Compose applications, this editor is for you!
Key Features
Bold, Italic, and Underline Formatting — Easily apply bold, italic, or underline styles to your text, enhancing the user experience with just a tap.
Multiple Heading Levels — Organize content effectively with support for various heading sizes, perfect for note-taking apps, blogs, or any text-rich application.
User-Friendly Interface — An intuitive UI that makes text editing straightforward for users of all levels.
Seamless Integration with Jetpack Compose — Designed specifically for Jetpack Compose, so you can integrate it effortlessly into your existing projects.
Why Use It?
Easy to Implement — Get up and running quickly with straightforward documentation and examples.
Customizable — Tailor the editor to fit your app's design and functionality needs.
Open Source — It's open for contributions! Help us improve by submitting issues or pull requests.
Give It a Try and Share Your Thoughts!
If you're looking to enhance your app with rich text editing capabilities, give it a shot and let us know what you think! We'd love to hear your feedback or any contributions you want to make.
👉 GitHub Repository: https://github.com/canopas/rich-editor-compose
Hi, i'm an iOS Developer that is developing on an Android application. Before using the app, the user must individually turn on permissions on each platform. In iOS, if a certain permission is turned off either through the OS Settings app, or from swiping down on the screen, then we use an OS popup/message that the user can either press close or press Settings, and go to the OS Settings. How is this handled on Android applications? Do you do the same thing or do you go back to the permissions like you did on first use?
Hi fellow developers,
I hope this post complies with the sub's rules, otherwise, mods, feel free to remove it if it doesn’t add value. Still, I believe the story is worth sharing.
I’m an Android developer, and published an app a few years ago. Today, I work on it full-time. It’s not making me rich, but it’s enough to live a happy live. I couldn’t be happier!
Last week, however, disaster struck. One of the major Chinese phone manufacturers began flagging my app as malware, falsely claiming it steals payment information and leaks data. Their system even displayed a pop-up urging and allowing users to delete the app.
Obviously, these accusations were baseless, but the damage was immediate—my app started losing over 5,000 users per day. I discovered this only through numerous negative user reviews.
I reached out to the manufacturer through every channel I could think of: emails to their security team, developer support, global support and national support teams, phone calls to the local support service, social media,... Days passed, but no response from anyone, except for one support representative who forwarded my complaint to their global support team. Meanwhile, the app continued loosing 5,000 users daily. I was desperate!
Luckily I contacted the commercial chamber in my country, an organization which represents all businesses in my country (a relatively small country). Though the staff there didn’t know much about how to help me, they suggested reaching out to their representative in Beijing, which I did.
What I didn’t realize at the time was that I had essentially contacted my country’s embassy in China! To my surprise, they responded immediately. They forwarded my complaint to the local consul, who then reached out to the manufacturer with an official email and personally called the vice president of the company.
Within a few hours, the warning was removed, and the user losses stopped.
I was absolutely amazed, not only by how quickly the situation was resolved but also by the dedication of my country’s representatives. I was so excited on how they supported a small business like mine.
The aftermath:
In just eight days, my app lost over 30,000 users due to this incorrect notification. My review section has now multiple negative reviews accusing my app of being a virus. To date, I haven’t received any direct communication from the manufacturer on the resolution of this issue. While I’ve considered pursuing damages, I doubt there’s any real chance of success against a company based in China, and with this size.
Anyway, it was an exciting experience. Even when you do everything right, bad things will happen. So be persistent, explore every option, and ask for help wherever you can.
So, if you ever find yourself being treated unfairly by large corporations, reach out to involve local authorities or business organizations. Even as a small business, you’re a valuable part of your country’s economy, and they will stand with you.
Final thought:
Is your life too boring? Become an indie developer!
EDIT: while it was a Chinese manufacturer, its devices are used globally, so I was loosing users all around the globe.