• Breaking News

    Tuesday, May 11, 2021

    Android Dev - Weekly Questions Thread - May 11, 2021

    Android Dev - Weekly Questions Thread - May 11, 2021


    Weekly Questions Thread - May 11, 2021

    Posted: 11 May 2021 06:00 AM PDT

    This thread is for simple questions that don't warrant their own thread (although we suggest checking the sidebar, the wiki, our Discord, or 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!

    Also, please don't link to Play Store pages or ask for feedback on this thread. Save those for the App Feedback threads we host on Saturdays.

    Looking for all the Questions threads? Want an easy way to locate this week's thread? Click this link!

    submitted by /u/AutoModerator
    [link] [comments]

    Multiple backstacks (Fragments, Jetpack Navigation) is now fixed!

    Posted: 11 May 2021 04:09 AM PDT

    Two modern ProGuard tools we used to quickly find the optimal -keep rules for DuckDuckGo

    Posted: 11 May 2021 06:58 AM PDT

    Hi all,

     

    Writing -keep rules for ProGuard can be a daunting task, mainly because -- due to reflection -- the impact of such rules may have an impact while executing the application. Fortunately, one can easily tackle these issues by using the right approach along with the right tools.

     

    My colleague has created a blog post which presents a step-by-step approach to apply ProGuard on the DuckDuckGo app. It describes:

    • the use of the -addconfigurationdebugging option to find out the missing classes, methods and fields from an application.

    • how to use the ProGuard playground to assess the impact of ProGuard/R8 -keep rules on an application.

    This allows you to easily get a stable ProGuard configuration for the application. The post is available here: https://www.guardsquare.com/blog/configuring-proguard-an-easy-step-by-step-tutorial

     

    Any feedback is welcome, since it will help the whole community while configuring ProGuard.

    (announcement https://twitter.com/Guardsquare/status/1392102226810843137)

    Enjoy!

    submitted by /u/Floni
    [link] [comments]

    Support multiple back stacks for Bottom tab navigation has finally been fixed.

    Posted: 11 May 2021 02:58 AM PDT

    From issue tracker:

    With these last changes and snapshot build #7351514, we've completed all of the required changes to support multiple back stacks in:

    • Fragments (i.e., without using the Navigation Component at all): this is an opt in change by using the new FragmentManager APIs of saveBackStack
      and restoreBackStack
      .

    • The core Navigation Runtime: adds opt-in new NavOptions
      methods for restoreState
      and saveState
      and a new overload of popBackStack()
      that also accepts a saveState
      boolean (defaults to false).

    • Navigation with Fragments: the FragmentNavigator
      now utilizes the new Navigator
      APIs to properly translate the Navigation Runtime APIs into the Fragment APIs by using the Navigation Runtime APIs.

    • NavigationUI
      : The onNavDestinationSelected()
      ,BottomNavigationView.setupWithNavController()
      and NavigationView.setupWithNavController()
      now use the new restoreState
      and saveState
      NavOptions
      by default whenever they would pop the back stack. This means that every app using those NavigationUI
      APIs will get multiple back stacks without any code changes on their part after upgrading the Navigation 2.4.0-alpha01.

    • Navigation Compose: NavHost
      and the ComposeNavigator
      have also been updated to support saving and restoring the state by using the Navigation Runtime APIs. An example of using the restoreState
      +saveState
      APIs with a bottom nav can be seen in the

    • BottomBarNavDemo.

    All of these changes will be available in the upcoming Fragment 1.4.0-alpha01 and Navigation 2.4.0-alpha01 releases. (Note that Navigation Compose versioning has been merged into the rest of Navigation as per

    b/172823546).

    That being said:

    • there's a lot more documentation and samples that need to be updated. We'll be tackling as much of this as possible between now and the alpha01 release.
    • As you may have seen, there's been a huge number of changes needed to make this happen across all levels. As such, please file separate bugs as you discover any edge cases that we need to handle and we'll make sure those changes are addressed in an alpha02 release.

    I'd like to thank you for your patience and respectfulness in not spamming this issue with comments.

    submitted by /u/blacpythoz
    [link] [comments]

    Reason for Amazon flex app being a direct download rather than app store download? Does this increase the amount of data they could harvest from users?

    Posted: 10 May 2021 07:37 PM PDT

    Is it possible to make my own (third party) keyboard that will have password manager integration like GBoard have?

    Posted: 11 May 2021 07:17 AM PDT

    Can someone post a detailed review of using Android studio on the new M1 chip with the recent updates?

    Posted: 10 May 2021 11:12 AM PDT

    It would be really great if someone could post a detailed review of building/writing code on the new machine. Ideally I would be looking at:
    1) General look and feel. How quickly does autocomplete work? How smooth is the first look?
    2) Build and process times. There could be a sample project and it would be great if we had a comparison with M1 vs i7.
    3) Emulator Performance. I'm guessing with the new updates, the emulator might be a bit faster.

    I understand someone might have done that already, but with the new updates coming in, it would be great if anyone could do new benchmarks!

    submitted by /u/BabyDunHurtMeNoMo
    [link] [comments]

    Unable to Create a sale on mobile device.

    Posted: 11 May 2021 09:00 AM PDT

    I am unable to create a sale on google play console website in iOS phone. Unable to select a date range. I don't want to open a laptop for this very small thing.

    submitted by /u/FlexSmart
    [link] [comments]

    Advantages of new Fragment Version (1.3.3)?

    Posted: 11 May 2021 08:22 AM PDT

    By default Android seems to use Fragment version 1.1.0 & the docs says to add a dependency

    def fragment_version = "1.3.3"

    // Java language implementation implementation "androidx.fragment:fragment:$fragment_version"

    In this fragment version, the fragment transaction syntax is different as at takes Fragment's class instead of instance variable of Fragment & also startactivityforresult, target fragment etc are depreceated

    What are the advantage(s) of this version compared to default 1.1.0?

    submitted by /u/jaroos_
    [link] [comments]

    How to send body in Android Valley StringRequest?

    Posted: 11 May 2021 06:12 AM PDT

    My endpoint looks this way:

    @DELETE @Path("product") public Uni<Boolean> deleteProduct(JsonObject productData){ return Products.delete(client, productData.getString("product_name"), productData.getString("brand"), productData.getString("user_name"), productData.getString("password")); } 

    When I delete product by using Postman everything work.

    This is my body in Postman:

    { "product_name": "name", "brand": "brand", "user_name": "user", "password":"password" } 

    So how to do that by Android Volley?

    I'm trying by adding this:

     @Override protected Map<String, String> getParams() { Map<String, String> body = new HashMap<String, String>(); body.put("product_name", "name"); body.put("brand", "brand"); body.put("user_name", "user"); body.put("password", "password"); return body; } }; 

    to my StringRequest but I have an error:

    E/Volley: [627] NetworkUtility.shouldRetryException: Unexpected response code 400 for http://....

    submitted by /u/GrimPloughman
    [link] [comments]

    Android Automotive OS review: Under the hood with Google’s car OS

    Posted: 11 May 2021 04:33 AM PDT

    A library I made that allows you to make quizzes and questionnaires without having to code a complex UI.

    Posted: 10 May 2021 11:44 AM PDT

    Hi. Does anyone know what the bubble options in Spotify Library (playlists, artists)and Google Maps (restaurants, gas, groceries) are called? Thanks

    Posted: 10 May 2021 07:29 PM PDT

    USB Type-C API

    Posted: 10 May 2021 03:53 PM PDT

    Does anyone know if there exists an API that allows the app developer to utilise all the pins of the type-C port on the phone for accessories? I want to be able to specify which pins to read from for certain data and which to read from for other data etc...

    submitted by /u/obitachihasuminaruto
    [link] [comments]

    Dagger Android 2.28 deprecated

    Posted: 11 May 2021 06:35 AM PDT

    I got this error from Lint all of a sudden:

    FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':module:lintRelease'. > Lint found errors in the project; aborting build. Fix the issues identified by lint, or add the following to your build script to proceed with errors: android { lintOptions { abortOnError false } } Errors found: module/build.gradle:147: Error: This version is . Details: Consider switching to recommended version 2.35.1. [OutdatedLibrary] api "com.google.dagger:dagger-android:$versions.dagger" 

    Does anybody know why or has a link to some explanation why they deprecated it? Was there any heads up for this?

    submitted by /u/arekolek
    [link] [comments]

    I want to sort a LiveData<List<Players>> from Room in my Scorekeeper app. Do I need to be using Transformations? MutableLiveData? MediatorLiveData? Or something else?

    Posted: 10 May 2021 08:25 PM PDT

    Right now my app is observing a player list of LiveData and displaying it in a RecyclerView.

    My original thought was that when I want to sort the data, I can use a Room query to return a new list of players sorted any way I want and then be able to switch that new, sorted list for the old.

    But I'm having trouble figuring out how to observe the player list correctly if I'm trying to switch the unsorted list for the sorted list.

    My next thought was then that I just need to return MutableLiveData from the original Room query so that I can just swap in the new sorted list, but Room only returns LiveData objects.

    Can anyone see where I'm off in my conception of LiveData here? I feel like this should be something fairly routine (sorting a list of LiveData), but I'm struggling.

    Thanks for reading!

    submitted by /u/bluepandadev
    [link] [comments]

    Facebook Audience Network bidding in Android

    Posted: 10 May 2021 11:31 PM PDT

    Hey, I hope many of you are using Facebook Audience Network for app monetization. I am having some questions regarding their latest new "bidding" strategy.

    I want to integrate AdMob as a mediation partner with Facebook Audience Network. After reading the documentation mentioned, it seems like I have to add both (AdMob + FAN) SDK's and make ad requests separately from both of these. Can someone please confirm for me if that is true?
    Does that mean if I want to integrate multiple mediation partners I'll have to add multiple SDKs? Don't you think it will increase the app size unnecessarily?

    Please share your thoughts if any of you have implemented Bidding in their Android App.

    Thank You

    submitted by /u/davidkonal
    [link] [comments]

    Need some advice - Firebase newbie here

    Posted: 10 May 2021 04:30 PM PDT

    Hi,

    We need some urgent advice to help us complete an app based the buddyPress site we launched years ago, that will look like this.

    https://i.ibb.co/rxXN9NG/image-2021-05-06-T05-11-40-687-Z.png

    The badges on the notification will display

    1. number of new messages not yet opened by user.
    2. new friend request
    3. new posts on the forums the user follows.

    As the user checks these new messages, the count displayed in the badge will go down.

    Something like this:

    https://i.ibb.co/txsQ2n6/image-2021-05-06-T05-04-40-027-Z.png]

    Or if updating the count is complex, we can go with a badge that clearly indicates there are new messages waiting to be checked.

    Like this

    https://i.ibb.co/0QfC1nD/hudl-notifications-2x.png

    We would like to implement something that is simple and robust without much change to our codes already built.

    We have been told that Firebase can be used to solve this problem. But we know very little about Firebase. Where to find the documentation?

    Your suggestion is greatly appreciated.

    Jing

    submitted by /u/Business-Fun1469
    [link] [comments]

    Releasing my first paid app and have some questions

    Posted: 10 May 2021 04:10 PM PDT

    Hey guys, so I'll soon be releasing my first paid app to playstore (closed testing and then open testing) and have a few questions:

    1) If I start gathering users in a closed testing phase, how does that work? Do they get the app for free for testing or do I have to use promo codes for them to be able to get it for free?

    2) Same question above but for open testing

    3) How do I give a free version of my app to anyone? I think the way to do it is with promo codes but they have an expiration date? That confuses me. What happens when that deadline expires?

    4) What is the best way to start gathering users for feedback? Do you guys use closed testing or open testing? I'm a single dev if that makes any difference.

    Thank you.

    submitted by /u/PowerMoki
    [link] [comments]

    Anyone have issues with their app not working on a specific model regardless of OS version?

    Posted: 10 May 2021 07:08 PM PDT

    For some reason my app is having issues with a galaxy A11 regardless of which OS version they're running. I haven't been able to replicate the issues with any other phone model or OS.

    Do you guys have any ideas on what it might be? Like CPU architecture or some weird obscure thing I'm missing?

    submitted by /u/MoHashAli
    [link] [comments]

    What's up with the Android SQLite access?

    Posted: 11 May 2021 12:58 AM PDT

    tl;dr: Maybe I'm simply missing something here, but don't you feel as if the quality of how we can access the Android database got considerably worse over the years? (or wasn't there at all in the first place?)

    When I started working on Android in 2017, I used Stetho. I needed to add it as a dependency to my app, plug it in somewhere there in the code, install the app on the phone, and then go to Chrome to chrome://inspect, and there it was - my app's database displayed in the web browser. Weird flex, but ok.But I think even back in 2018 Stetho got broken on newer Chromes. I still was able to access my database, but I couldn't execute any SQL commands on it. For a long time since then I had three web browsers on my computer: Firefox for normal use, Chrome for some debugging work, and an old un-updated Chromium solely for the purpose of accessing the database on my phone.

    Recently, though, even that was broken. I have a new MacOS now and chrome://inspect on an old Chromium is unusable anymore. And that bug which prevented me from using it on newer Chromes was never fixed - instead, Stetho was deprecated.

    So I turned to Database Inspector in Android Studio. And here's a weird thing: It's only available since Android 4.1 and it only works for SDK 26+. For "reasons" I need to use a slightly older Android Studio and sometimes I do work on an older SDK. For a moment I even tried to use two Android Studios simultaneously, one older, one newer, just as I used three web browsers before, but it confused adb. I had to close one to use adb log in the other. On top of that, AS 4.1 pretty often didn't recognize my app (?).

    I tried some plugins for the older Android Studio I use, but the best I have found was one that worked offline on a database file copied from the phone. That's not exactly a solution for me. It's too clunky and anyway I like to test and debug by watching and modifying data in the database while the app is working.

    In the end, I started to use adb shell from the terminal and sqlite3 from there. It's ugly as hell but at least it works.

    In conclusion: If you have some miraculous solution, please let me know. I already tried quite a few but maybe I missed something. What's more interesting for me, though, is your opinion on the issue. I feel that it should be much easier. After all, it's just SQLite, one of the easiest to use databases. All I need really is a simple GUI somewhere - a plugin or an app - that would display db tables in a clear way and let me execute SQL queries. It's not rocket science. And, on the other hand, it's a powerful tool for testing and debugging. So why do I feel as if this functionality is neglected? is there a difficulty I don't see? Or is the interest low? Don't people write SQL anymore? :)

    Cheers,

    submitted by /u/makingthematrix
    [link] [comments]

    What is External marketing in PlayStore console?

    Posted: 10 May 2021 05:10 PM PDT

    What is External marketing in PlayStore console?

    I've found that our app has been turned off for this. Does anybody know what exactly it is? Is there any reason not to enable it?

    https://preview.redd.it/gsx4slp1vdy61.png?width=1436&format=png&auto=webp&s=6028db74626e383315a21c3652a2ab005ef891f6

    submitted by /u/isharing
    [link] [comments]

    No comments:

    Post a Comment