/r/androiddev

Photograph via snooOG

News for Android developers with the who, what, where, when and how of the Android community.

News / Articles / Talks / Tools / Open source!

About

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:

  • News for Android developers
  • Thoughtful, informative articles
  • Insightful talks and presentations
  • Useful libraries
  • Handy tools
  • Open source applications for studying

Alternatives

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

New Developer Resources

Build your first app

Starting Android career in 2022

Android Job Interview Questions and Answers

App Portfolio Ideas, Tiered List

Awesome Android UI

Material Design Icons

Weekly Threads Calendar

Autoposted at approx 9AM EST / 2PM GMT

Links

Rules!

Wiki and FAQ!

Discord!

/r/androiddev

231,752 Subscribers

1

Play protect certification

So my phone lost its certification overnight. Didn't root it, didn't open bootloader, etc., tried everything I can imagine, no avail. Not important.

My question is if I were to change its motherboard to a new one, would it possibly get the certification with the new hardware? If not, is there any hardware I can change for it to work?

0 Comments
2024/04/23
20:44 UTC

2

What's the name of this theme?

So today at work one of my coworkers showed me this image (it's and instagram post) and wanted to the name of the theme. He wanted the theme for visual studio but I think it's for android studio. I hope I'm right and also, I hope that it's a well known theme and I can find it for visual studio as well. Just need to know the name of it for android studio.

I've searched android/visual studio (and vs code) themes for pink and cyan themes. The closest I got was some sakura themes and dracula.

Here are the images:

The side menus (navigation) and the fact that it's flutter, made me think it's android studio (although on mac and probably showing the ios output xd)

Close up image of the editor window. I've also tried google image search but to no avail.

2 Comments
2024/04/23
19:28 UTC

28

Articles - How to detect Process Death Issues

Hello,

Lately I've been writing about Process Death in details as to help everyone be aware of the issues it can bring on our apps if we don't pay attention to it.

Till now I've written three posts!

  1. Process Death is the Rule, not the Exception!

  2. Every Screen is an Entry Point

  3. How to detect Process Death issues

Hope this helps, and of course constructive feedback will always be welcomed 😊

8 Comments
2024/04/23
07:59 UTC

8

Anyway to reduce app size.

I made a very simple app just to show a map and a marker following google's recommended architecture (Compose, Hilt, VM, Coroutines) and Map Library. The final apk size was 7.2 mb. What are the recommended approach to reduce my apk size. What would have been my app size if it would have been made in pure java and XML.

https://preview.redd.it/x7rwttzp66wc1.png?width=1170&format=png&auto=webp&s=926115ef4f3af848f86792c2a95f938c55e271a2

https://preview.redd.it/4a4sruzp66wc1.png?width=668&format=png&auto=webp&s=36d6c3b358970079ce72ac68cec12277dc97cc0e

28 Comments
2024/04/23
06:05 UTC

6

Book Recommendations

Currently taking an Udemy course on Android App Dev to learn the nuts and bolts of coding in Kotlin and Jetpack Compose and am looking to supplement this with some books that look at the big picture of Mobile App development, architecture, design philosophy, business models, etc. Any book recommendations, or even podcasts, YouTube channels or blogs, would be appreciated. Thanks.

10 Comments
2024/04/23
02:40 UTC

2

Weekly discussion, code review, and feedback thread - April 22, 2024

This weekly thread is for the following purposes but is not limited to.

  1. Simple questions that don't warrant their own thread.
  2. Code reviews.
  3. Share and seek feedback on personal projects (closed source), articles, videos, etc. Rule 3 (promoting your apps without source code) and rule no 6 (self-promotion) are not applied to this thread.

Please check sidebar before posting for the wiki, our Discord, and Stack Overflow before posting). Examples of questions:

  • How do I pass data between my Activities?
  • Does anyone have a link to the source for the AOSP messaging app?
  • Is it possible to programmatically change the color of the status bar without targeting API 21?

Large code snippets don't read well on Reddit and take up a lot of space, so please don't paste them in your comments. Consider linking Gists instead.

Have a question about the subreddit or otherwise for /r/androiddev mods? We welcome your mod mail!

Looking for all the Questions threads? Want an easy way to locate this week's thread? Click here for old questions thread and here for discussion thread.

2 Comments
2024/04/22
12:00 UTC

16

How often are app releases at your current organisation?

At my current org (mid-large sized startup), we have weekly app release, which I feel is too many releases.
In my previous orgs, I have seen releases happen at end of each sprint, i.e 2 Weeks.

Weekly release is extremely tiresome and is very unnecessary IMO. Each release not only takes additional bandwidth, but also causes constant deadlines and anxiety to people.

What is the app release cycle be like at your organisation? Want to know the general standard followed across industry.

24 Comments
2024/04/22
11:55 UTC

8

AOSP 13/14 have the same RAM requirements of their full Google Android counterparts?

Is it 2 GB for all or can AOSP, in its latest form, be useful in tiny devices with 1 gig or less?

6 Comments
2024/04/22
09:47 UTC

1

What are some good data visualization solutions and why? (Jetpack compose for ui)

I am working on an app that is using kotlin and jetpack compose for the ui. So far I only know about MPAndroidCharts but are there any other libraries that are well documented or a better fit for my user interface?

9 Comments
2024/04/22
05:05 UTC

0

Can I Learn android programming with LOW END PC ?

I Love Programming since I was kid every time I start learning I drop in the middle, So I decided to learn this time but it seems my pc is too bad so can I still programming with this specs or not

INTEL CELERON G1840
4GB
INTEL HD GRAPHICS FAMILY 1824

23 Comments
2024/04/21
23:19 UTC

1

Need help with protobuf generation

[SOLVED]
See comments below for 2 different solutions for the problem.

Ok I'm actually losing my mind over this and I need help. I'm pretty new to android development so if this post is missing info let me know and I'll edit to post to add it.

All I'm trying to do is get a single .proto file to be genrated into java code within my project so that I can import it to use my java files.

The gradle build is kotlin (gradle.build.kts) and every single example I could find was using the groovy build (build.gradle) and no matter how I tried to translate it nothing works. Either it doesn't compile the .proto file at all, or at best it manages to compile it to a java file which causes a build error itself when im building the project.

I can't figure out what I'm doing wrong and I've been on it all day and losing my sanity with every failed build. Any help is appreciated.

5 Comments
2024/04/21
19:10 UTC

7

Getting wifi info from network?

Can an android app obtain the current network's SSID and password? I know it can be done on Windows, but does an android app have that kind of permissions? Either by asking the network or retrieving a stored file?

5 Comments
2024/04/21
16:18 UTC

1

Synchronizing a countdown timer in multiplayer game between clients?

I want to add a time limit to my multiplayer. The countdown timer should run for 1-minute, and game must be finished when it reaches zero. There is two clients in the room, and I want to synchronize their clock, so it finishes almost simultaneously for both.

It seems impossible to implement all the logic on client-side only, because of the differences in device performances and possibilities of "cheating".
I also though about running a clock on the server using Firebase Functions CLI, and updating rooms' time left field each second. However this solution not only inefficient, but also very depended on server connection latency, which alters the time.

Is there any better approach to this problem?

4 Comments
2024/04/21
07:41 UTC

20

A note regarding progress and innovation in SWE

Reading the recent threads and its replies about two versions of the same application - one barebones and one not-so barebones - reminded me of a video I watched on Android services and IPCs where the lector mentions how programmers, in the beginning, were opposed to control flow statements and information hiding amongst under things, because it was 'new and unnecessary '.

Then a few years later they changed their minds. This has been happening since the 60s with every new innovation.

Video in question, timestamp 43:41 - the segment is just a few minutes long I strongly recommend it.

My point is innovation is needed, separating the wheat from the chaff too. But, allowing myself to use another aphorism - let's not throw away the baby along with the bathwater.

3 Comments
2024/04/21
07:21 UTC

0

Is writing code in a repository and then writing the same code in a viewmodel the most blatant example of boilerplate code?

Can't you just have a viewmodel?

17 Comments
2024/04/20
22:55 UTC

1

Slow gradle build on Surface Pro 9

I'm having issues where the grade build is very slow on my Surface Pro 9. Even the default empty activity project takes 2 min to build. Things I have tried: disable Windows Defender, enable parallel build, physical Debugging device, highest performance mode in windows. Any help is appreciated.

13 Comments
2024/04/20
15:12 UTC

3

Annotated PDFs still doesn't work in Android 15?

The below code works well for PDFs without annotations. Now, I'm looking to enhance this to support annotated PDFs as mentioned in the Android 15 Developer Preview release notes. But the annotated text isn't being displayed.

        val params = RenderParams.Builder(RENDER_MODE_FOR_DISPLAY)
            .setRenderFlags(FLAG_RENDER_HIGHLIGHT_ANNOTATIONS).build()
        
        page.render(bitmap, null, null, params)
        Image(bitmap = bitmap.asImageBitmap(), contentDescription = null)

Here's a sample annotated pdf - here

1 Comment
2024/04/20
14:45 UTC

12

Questions of Jetpack Paging 3

Hi friends,

I'm learning Paging 3 and being struggle with it. I can list here some concerns of mine could you guys help to answer?

  1. The PagingSource has the getRefreshKey function. When will this function get called? What is its purpose?

  2. Does Paging 3 only work with hot stream?

  3. The PagingDataAdapter use the PagingData from hot stream and set it directly via submitData. Could you guys help me to explain How it work under the hood?

Thanks for helping me friends ⊂((・▽・))⊃

16 Comments
2024/04/20
13:53 UTC

10

New Secured Background activity Launches?

https://preview.redd.it/vx63fob22nvc1.jpg?width=1156&format=pjpg&auto=webp&s=1bd75eef8ae3d41db746c0fb621645803fc30a3e

I have seen this in new Google's now in android video but cannot find any resources talking about it , Anyone has any idea what that means ?
The Medium Article

8 Comments
2024/04/20
13:48 UTC

35

Google Maps poor performance in Jetpack Compose

I was making an app which could have thousands of markers shown on map at a time, so I decided to use Marker Clustering ( a feature by google maps to combine markers and prevent collision). It is unbelievable to see such a poor and laggy performance even in high end android device for marker clustering. Any suggestions are welcome.

GIST: https://gist.github.com/spss20/b1b9781889113c6d3863846204c85412

https://reddit.com/link/1c8jo9k/video/2qncpqmp1lvc1/player

32 Comments
2024/04/20
07:01 UTC

2

How do I pass the value and onValueChange parameters of a Textfield as parameters in the constructor of a Composable?

I keep getting an error saying val cannot be changed.

Also when creating an instance of the composable with the TextField, what do I put the parameters?

9 Comments
2024/04/20
03:42 UTC

0

How big of a disadvantage is using windows Instead of MacOS

Is there a big difference in build times, gradles syncing etc? I know android studio is tailored towards unix but how much if a difference is it. Is it worth moving towards Mac if your develop native android?

I'm considering buying a Mac Mini M2 as they seem to be the best value and don't take up too much space. Just looking for information on whether it's worth the change in os

61 Comments
2024/04/19
16:52 UTC

7

Does Realm's frozen architecture let you view live data from the background thread?

Last time I used realm I had to embed the realm models and adapters etc throughout the app to get the live updates since you couldn't pass the objects between threads. I'm creating a new app now and came across "Frozen Architecture" in the docs but I don't fully understand what this gives me in reality.

Could anyone with experience using this this let me know if the following is now possible?

  • Launch a coroutine from the ViewModel to get data from a repo which abstracts realm from UI modules
  • Internally the repo will query realm on background thread with results asFlowable() and frozen
  • Objects are mapped and returned to the ViewModel
  • ViewModel will be able to collect this flow and react to live updates on the main thread

If this can't be done what is the best practice these days for using realm? Pretty much all the "how to do realm right" articles are like 5 years old unless ive missed something that someone could link me to?

1 Comment
2024/04/19
16:15 UTC

27

Guide to app architecture - What is the domain layer?

Heyo!

At my company we've been talking about how we want to layer our app and have decided to align with Google recommendations for its wide recognition and readily available documentation. However, when looking through the documentation their description of "domain" confused me, so I'd love to hear some of your guys thoughts/opinions.

From my current understanding, the domain layer usually serves as the heart of a software's design. It contains the core business models, logic, rules, and is independent of platform and any other layers.

However, I noticed a deviation in Google's "Guide to App Architecture" where the domain model is seemingly integrated within the data layer, causing the domain layer to depend on the data layer for its operations. This approach seems at odds with traditional clean architecture ( I know I know) , where the domain layer should ideally be decoupled from data handling and UI concerns.

Given that Google’s architecture guide outlines a separation into UI, domain, and data layers, it appears there's an intention to align with clean architecture principles. Yet, the implementation details suggest otherwise.

  • Have you observed this in your practice?
  • How do you define and implement the domain layer in your projects?
  • Do you think Google's approach might influence the conventional understanding and implementation of the domain layer in Android development?

edit: Fixing terrible wording

16 Comments
2024/04/19
15:45 UTC

3

SQLite & Room Synchronization Library

Hey devs!

I've ran into the same issue with a few apps I've made and I wanted to ask if you have the same experience. Offline-first databases synced online. I'm considering writing a library and I'd like some thoughts.

The Problem

Apps that rely on an online connection (think anything with *Retrofit`) stop working if there is no connection, the servers die, and are generally slower. Apps that rely on local data (think Room) keep the data local unless code is intentionally written to communicate with a server.

There is no middle-ground, offline first library with scheduled or user-initiated sync functionality.

(that I know of. Let me know if I'm wrong)

Example

AnkiDroid. An amazing app. 100% of the functionality is available offline, but the user may, optionally, sync with a web server and access their collection on different devices.

I want to implement something similar, in a reusable library.

Implementation

Imagine a library that acts between two layers:

  • The local database, likely an SQLite file (possibly created by the Room library).

  • An external database, whether on the web, or a .db file on the user's external storage.

My library would propagate additions, deletions, and changes between these two. You could self-host your own database, easily create backups, or share your database over something like Syncthing.

My Questions

  • Would something like this be useful to you?

  • Did I miss an implementation that already exists?

  • Any other suggestions?

8 Comments
2024/04/19
14:27 UTC

7

AVD keeps terminating whenever I use hardware as the graphics option

I've been struggling with this for a while. At the moment the emulator simply terminates whenever I try to run something on the hardware.

​

https://preview.redd.it/obutow2yubvc1.png?width=497&format=png&auto=webp&s=8b9b402884572f0d88abd950d68ac9a9a649aec6

This is the only device I can run, as it's graphics is set to Software. but for any of the others that are set to automatic or hardware, it just does this when I try to run it.

​

https://preview.redd.it/y4prz9yzubvc1.png?width=488&format=png&auto=webp&s=af3c890fc97a47e400299db2bb482673bf980620

​

​

https://preview.redd.it/qqvv7nebubvc1.png?width=376&format=png&auto=webp&s=3b191bdc462ee2db17502e0603a7f08f8e705ea3

I've run -accel-check and it spits out

accel:

0

AEHD (version 2.2) is installed and usable.

accel

So from that I assume hardware acceleration should be on using the android emulator hyperdriver, but I'm really inexperienced when it comes to this and I'm not sure what's going on.

Some places said to make sure Hyper-v is disabled in windows features, and I don't even have access to it due to my windows version, so it can't be that. And the other virtual machine features are disabled there too, virtualisation is also enabled in my bios.

Ultimately I'm not sure what to do, I can try and provide any more information if needed but I'm out of ideas. Do you happen to know what else I could try?

13 Comments
2024/04/19
00:06 UTC

10

What will happen if one of my testers related to a banned developer account?

As i said, will i get terminated if one of my testers are already banned or related with banned accounts? Just because of this i am really scared to share my link to my friends from internet

10 Comments
2024/04/18
13:44 UTC

16

SMS Call/Log permission reject for device automation app

I'm a developer of a leading device automation app on the Play Store and I have recently had an update rejected because it violates the SMS/call log permission policy. I filled out the policy declaration form years ago and all has been well because they have an explicit exception for device automation apps as listed here: https://support.google.com/googleplay/android-developer/answer/10208820?visit_id=638320367743206642-844692561&rd=1#exceptions&zippy=%2Cexceptions

https://preview.redd.it/m3imu05sp6vc1.png?width=1059&format=png&auto=webp&s=371948c65bf0ba77429009afd214b3523aff293c

The initial rejection was as follows:

  • Your in-app experience does not match the core functionality for your declared use case.
  • Please submit an updated Permissions Declaration Form that includes instructions on how to verify your declared functionality. If portions of your app are restricted, please share a link to a video of your app to help us verify the core functionalities you’ve declared.
  • Device Automation

The whole purpose of my app is to enable the user to specify automations based on triggers set by the user, so I found this a little surprising. I appealed the decision to point this out but the appeal was rejected very quickly (obviously by a bot)

I submitted a new updated and updated the policy declaration from to include a link to a video. This video demonstrates how to configure a simple automation such that when an SMS is received from a certain contact it will auto reply to that SMS with an automated reply (specified) by the user. In addition in the policy declaration form along with step by step instructions how to use the app to do the same.

This has also been rejected:

  • The video you submitted does not demonstrate the functionality necessary to verify and approve your use case declaration (for example, if your app uses SMS for account verification, your video should clearly show this).
  • Device Automation

I have appealed yet again, but of course there is a 99.9% chance it will be quickly auto rejected.

Does anyone have any advice on an appropriate route to bypass the bot wall and somehow convince someone that an app that has been a leading device automation app for over a decade and has the word "Device Automation" in the app title is actually a device automation app?

My app has a lot of downloads but I'm just an indie dev with no connections in Google so the popularity of my app counts for pretty much nothing in this scenario

14 Comments
2024/04/18
06:59 UTC

Back To Top