• Breaking News

    Friday, April 17, 2020

    Android Dev - Weekly "anything goes" thread!

    Android Dev - Weekly "anything goes" thread!


    Weekly "anything goes" thread!

    Posted: 17 Apr 2020 05:40 AM PDT

    Here's your chance to talk about whatever!

    Although if you're thinking about getting feedback on an app, you should wait until tomorrow's App Feedback thread.

    Remember that while you can talk about any topic, being a jerk is still not allowed.

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

    Google at it's finest :)

    Posted: 17 Apr 2020 12:07 AM PDT

    Migrating to Material Components for Android

    Posted: 16 Apr 2020 06:15 PM PDT

    How can I achieve that kind of motion?

    Posted: 16 Apr 2020 07:49 PM PDT

    Kotlin Coroutines - Use Cases on Android

    Posted: 17 Apr 2020 04:57 AM PDT

    Google shenanigans

    Posted: 17 Apr 2020 07:46 AM PDT

    Anyone advertising their app via Adwords? How has last few days been for your campaigns?

    Posted: 17 Apr 2020 06:45 AM PDT

    We experienced massive drop in ad spend last few days, and are looking for similar stories to confirm this did not affect just our account.

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

    Play Store app policy changes go after misleading subscriptions, prep for Android 11 location permissions

    Posted: 16 Apr 2020 11:25 AM PDT

    Ads Market Place for mobile apps?

    Posted: 17 Apr 2020 07:45 AM PDT

    Is there any marketplace like buysellads.com to actually feature/sponsor other related apps in your app.

    I am using Facebook Audience Network ads for my mobile app, but I see there is a good opportunity to make some more bucks by featuring other apps. Please let me know if you have heard anything similar.

    Pardon me if it is not the right place to ask.

    Thanks

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

    OneDevice! Finally an android Phone that makes sense!!

    Posted: 17 Apr 2020 06:26 AM PDT

    Kotlin Multiplatform last news

    Posted: 17 Apr 2020 06:01 AM PDT

    Hi guys,
    There are a few last articles and topics considering Kotlin Multiplatform projects and technology.

    1. Arkadii Ivanov finally published the article "MVI in Kotlin Multiplatform — part 1 (1 of 3)" https://badootech.badoo.com/mvi-in-kotlin-multiplatform-part-1-1-of-3-205c6feb4ac7
    2. New post from Javier Arroyo Espallargas on ProAndroidDev.com! In this case, how to use Firestore in your KotlinMultiplatform project!
    3. Migration from Room to SQLDelight (https://medium.com/xorum-io/migration-from-room-to-sqldelight-28d6f4aaf31e) – small guide how to migrate from Room to SQLDelight.
    4. A State Machine for Multi-Threaded Coroutines in Kotlin Multiplatform http://brendanweinstein.com/a-statemachine-for-multithreaded-coroutines-in-kotlin-multiplatform
    5. Great talk with Jesse and Egor from CashApp (Square) to discuss how they decided to port OKio and OKHttp to Kotlin Multiplatform https://talkingkotlin.com/going-full-kotlin-multiplatform/

    Follow us on Twitter!

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

    ViewModelFactory injection with Dagger

    Posted: 17 Apr 2020 05:57 AM PDT

    Have been out of touch with the topic lately, have I missed anything about the most elegant way of injecting a ViewModel into Fragment/Activity using Dagger 2?

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

    What to use to send network requests in the background

    Posted: 17 Apr 2020 05:45 AM PDT

    I want to set network requests on periodic interval to see if any notifications come from my server. Currently I am using job service for this but it didn't seem to be periodically running.

    For example:

    1st time it sent the request after 15 minutes

    2nd time it sent the request after 15 minutes after the 1st

    3rd time it sent the request after 60 minutes after the 2nd

    4th time it sent the request after 15 minutes after the 3rd

    5th time it sent the request after 15 minutes after the 4th

    Here is my code:

    JobScheduler scheduler = (JobScheduler) getSystemService(JOB_SCHEDULER_SERVICE);
    ComponentName componentName = new ComponentName(this,NotificationService.class);
    JobInfo info = new JobInfo.Builder(1,componentName).setPeriodic(1000 * 60 * 15).setPersisted(true).build();
    scheduler.schedule(info);

    I am very new to android so i think i'm missing something here. What should i do?

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

    Getting Google Play App To Show Up In Google Search

    Posted: 17 Apr 2020 01:51 AM PDT

    I have two apps published on the play store. If i search on the play store I can find both apps without any issues. If i go to google search and search for the app, it doesn't find anything. I can see competitor apps show up in search engine results. Why is my app not showing up when i perform a Google search?

    Both apps were published in December 2019. Both appear if you search the play store but neither show up in traditional google.com searches.

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

    Google Play Services for AR

    Posted: 17 Apr 2020 04:56 AM PDT

    Hello all!

    I'm having issues with my phone...I think? Not sure if it's my phone or google so apologies if I'm posting in the wrong r/.

    I'm developing an AR app, I KNOW that my phone (Samsung Galaxy J6) is compatible with AR because it runs on 9.0, not just that but AR works fine in Pokemon Go. I have the AR in a seperate activity from Main and I'm not encountering errors on my phone. I open up the AR camera in my activity, it asks for permissions, allow, then tells me I need an updated version of Google Play Services for AR... This is where my problem starts: I go to the play store. And it tells me my device is not compatible with the app?

    I'm not sure what to do as googling the issue tells me to clear cache, data from G services + G play. Which I did, then retstarted the device and I'm still getting this error. I can't seem to find a fix for it nor an explanation of why it's doing it in the first place!

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

    How do you monetize in 2020 and what are your strategies?

    Posted: 17 Apr 2020 12:38 AM PDT

    I have been off the playstore from 2012 (back when adult apps got banned, was making decent $$ using airpush). Got an app and a game live on playstore now im wondering which ad network to use. Is admob still super strict on random invalid activity? if so how do you protect yourself? thanks.

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

    How to deal with DialogFragment and its communication with Activity/Fragment?

    Posted: 16 Apr 2020 06:52 PM PDT

    I have two actitives(or fragments if you only use single activity), each made up of a list of items, call them activity A and activity B

    the item type of the two Actitives are different, let's call them item type A and item type B

    the data backing these two item types, let's call them data type A, and data type B

    The dialogFragment is made of a simple list(radio group) with several options to choose from, in my case they are actually payment methods for user to choose from

    On each of the items(of the said activities) there is a button to do some actions, but before the action to take place, we have to prompt the user to select one of the options from the dialog

    In a supposedly happy world, in the onClickListeners of the buttons I will get the clicked item data, show the dialog, and in the DialogInterface callback I get the selected option, combine the item data and selected option I can continue with whatever I want to do next.

    Dialogs allows this exactly, but DialogFragments don't

    No matter which method I use to communicate between the dialogFragment and the activity, be it listener interfaces or viewModels, I don't have the item data that I clicked on when I receive the selected option from the dialog

    Passing the item data to the dialog is a bad solution because the responsibility of the dialog is simply to choose an option from a list

    Keeping a reference of the clicked item data somewhere sounds like a bad idea too because that is simply global data

    So what's your solution to these kind of senarios? Any suggestions would be welcomed.

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

    How do I make parallel calls in Retrofit and wait until they are all finished?

    Posted: 16 Apr 2020 01:06 PM PDT

    Do I need to make the objects observable? For example in the first answer of this post: https://stackoverflow.com/questions/36474120/how-to-make-multiple-request-and-wait-until-data-is-come-from-all-the-requests-i How do I get the response from the new Consumer<Object>? Why is there Object in each method, shouldnt it be objects like User, List<Photo> and List<User> I am so confused.

    The code example here: https://stackoverflow.com/questions/21890338/when-should-one-use-rxjava-observable-and-when-simple-callback-on-android is also not working, the Func2 function cannot be resolved.

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

    Help needed: creating and displaying fragments from Room Database

    Posted: 17 Apr 2020 02:32 AM PDT

    I'm new to Kotlin and Android. I've been burned enough by Android's messy recommendations on the documentation to know that this time I should ask beforehand.

    What: I want to create an activity for my app that is similar to Tinder's main "swiping" activity, except I don't have images but audio files and don't necessarily care for swiping. Basically, I plan on

    • from an always running "Sync Service" download certain audio files from my backend (let's say 10 at a time)
    • storing them in a Room Database
    • display them one at a time to the user in an "Explore" activity

    On each page/fragment in the Explore activity the user can interact with the Database entity and with a button load the next fragment.

    Question: How do you recommend I implement this Explore activity? Should I use ViewPager and FragmentStatePagerAdapter (apparently deprecated)?

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

    [URGENT HELP] is it safe to install system image in the boot or recovery partition?

    Posted: 17 Apr 2020 02:29 AM PDT

    i am installing pixel experience 10 on my redmi 4 using TWRP. i have installed the PIE zip file, and now am installing a system image file.

    the guides ive been seeing suggest me to install the system image on a partition called system image, however i am only getting two options in way of partitions. is it safe to install it in boot/recovery?

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

    [HELP] [NEWBIE] I have the project files (Source Code), I need to Completely remove Pull to Refresh functionality, please guide me through it. P.S I didn't code anything myself, this is a ready made project that I need to customize

    Posted: 17 Apr 2020 02:19 AM PDT

    4K SurfaceView on Android TV

    Posted: 16 Apr 2020 07:51 PM PDT

    I'm attempting to use a SurfaceView to render a 3840x2160 bitmap on a 4K Android TV device (Nvidia Shield TV running Android 9) at native resolution.

    According to the Android 6 release notes, I should be able to set preferredDisplayModeId to a Display.Mode that supports 4K resolution in order to get my SurfaceView to render at 4K. However, it seems that even after setting preferredDisplayModeId, the Canvas provided to the onDraw method of my view is only 1920x1080. Attempting to draw the 3840x2160 bitmap to it results in the image being downscaled to 1080p, and then upscaled back to 2160p, losing information in the process.

    Here's the relevant code from my Activity:

    ```kotlin windowManager.defaultDisplay.supportedModes.forEach { if (it.physicalHeight == 2160 && it.refreshRate > 60) { val params = window.attributes params.preferredDisplayModeId = it.modeId window.attributes = params } }

    setContentView(R.layout.main) ```

    My layout contains a custom view that extends SurfaceView. The custom view has an onDraw method that looks like this:

    kotlin override fun onDraw(canvas: Canvas) { canvas.drawBitmap( currentImage, Rect(0, 0, currentImage!!.width, currentImage!!.height), canvas.clipBounds, null ) }

    canvas.clipBounds is Rect(0, 0 - 1920, 1080), so when it tries to render the full bitmap, it has to scale it down to fit.

    Here's some output of adb shell dumpsys SurfaceFlinger when my SurfaceView is rendered:

    ```

    Display 0 HWC layers:

    Layer name

    Z | Comp Type | Disp Frame (LTRB) | Source Crop (LTRB)

    com.google.android.tvlauncher/com.google.android.tvlauncher.MainActivity#0 rel 0 | Device | 0 0 3840 2160 | 0.0 0.0 1920.0 1080.0


    Dim Layer for - Task=580#0 rel -1 | Client | 0 0 3840 2160 | 0.0 0.0 -1.0 -1.0


    com.android.tv.settings/com.android.tv.settings.MainSettings#0 rel 0 | Client | 0 0 3840 2160 | 0.0 0.0 1920.0 1080.0


    Background for -SurfaceView - Sys2023:dream#0 rel -3 | Client | 0 0 3840 2160 | 0.0 0.0 -1.0 -1.0


    Sys2023:dream#0 rel 0 | Client | 0 0 3840 2160 | 0.0 0.0 1920.0 1080.0


    Allocated buffers: 0x513aff00: 8100.00 KiB | 1920 (1920) x 1080 | 1 | 1 | 0xb00 | Sys2023:dream#0 0x5333f300: 4.00 KiB | 16 ( 64) x 16 | 1 | 1 | 0x1a00 | FakeFramebuffer 0x53340f80: 8100.00 KiB | 1920 (1920) x 1080 | 1 | 1 | 0xb00 | com.android.tv.settings/com.android.tv.settings.MainSettings#0 0x53341280: 32400.00 KiB | 3840 (3840) x 2160 | 1 | 1 | 0x1b00 | FramebufferSurface 0x53341700: 8100.00 KiB | 1920 (1920) x 1080 | 1 | 1 | 0xb00 | com.google.android.tvlauncher/com.google.android.tvlauncher.MainActivity#0 0x53341880: 8100.00 KiB | 1920 (1920) x 1080 | 1 | 1 | 0xb00 | com.google.android.tvlauncher/com.google.android.tvlauncher.MainActivity#0 0x53341d00: 8100.00 KiB | 1920 (1920) x 1080 | 1 | 1 | 0xb00 | com.android.tv.settings/com.android.tv.settings.MainSettings#0 0x53341e80: 8100.00 KiB | 1920 (1920) x 1080 | 1 | 1 | 0xb00 | com.google.android.tvlauncher/com.google.android.tvlauncher.MainActivity#0 0x55d35480: 8100.00 KiB | 1920 (1920) x 1080 | 1 | 1 | 0xb00 | com.android.systemui.ImageWallpaper#0 0x55d35900: 8100.00 KiB | 1920 (1920) x 1080 | 1 | 1 | 0xb00 | com.android.tv.settings/com.android.tv.settings.MainSettings#0 0x55d35d80: 8100.00 KiB | 1920 (1920) x 1080 | 1 | 1 | 0xb00 | Sys2023:dream#0 0x55d37580: 32400.00 KiB | 3840 (3840) x 2160 | 1 | 1 | 0x1b00 | FramebufferSurface Total allocated (estimate): 137704.00 KB ```

    For comparison, here's the same output when my app renders an ExoPlayer view, which is correctly rendering a 4K SurfaceView:

    ```

    Display 0 HWC layers:

    Layer name

    Z | Comp Type | Disp Frame (LTRB) | Source Crop (LTRB)

    SurfaceView - Sys2023:dream#0 rel -2 | Device | 0 0 3840 2160 | 0.0 0.0 3840.0 2160.0


    Sys2023:dream#0 rel 0 | Device | 0 0 3840 2160 | 0.0 0.0 1920.0 1080.0


    Allocated buffers: 0x513af180: unknown | 3840 (3840) x 2160 | 1 | 12B | 0x900 | SurfaceView - Sys2023:dream#0 0x513af300: unknown | 3840 (3840) x 2160 | 1 | 12B | 0x900 | SurfaceView - Sys2023:dream#0 0x513afc00: unknown | 3840 (3840) x 2160 | 1 | 12B | 0x900 | SurfaceView - Sys2023:dream#0 0x513afd80: 8100.00 KiB | 1920 (1920) x 1080 | 1 | 1 | 0xb00 | Sys2023:dream#0 0x5333f300: 4.00 KiB | 16 ( 64) x 16 | 1 | 1 | 0x1a00 | FakeFramebuffer 0x53340f80: 8100.00 KiB | 1920 (1920) x 1080 | 1 | 1 | 0xb00 | com.android.tv.settings/com.android.tv.settings.MainSettings#0 0x53341280: unknown | 3840 (3840) x 2160 | 1 | 12B | 0x900 | SurfaceView - Sys2023:dream#0 0x53341400: unknown | 3840 (3840) x 2160 | 1 | 12B | 0x900 | SurfaceView - Sys2023:dream#0 0x53341700: 8100.00 KiB | 1920 (1920) x 1080 | 1 | 1 | 0xb00 | com.google.android.tvlauncher/com.google.android.tvlauncher.MainActivity#0 0x53341880: 8100.00 KiB | 1920 (1920) x 1080 | 1 | 1 | 0xb00 | com.google.android.tvlauncher/com.google.android.tvlauncher.MainActivity#0 0x53341a00: 8100.00 KiB | 1920 (1920) x 1080 | 1 | 1 | 0xb00 | Sys2023:dream#0 0x53341d00: 8100.00 KiB | 1920 (1920) x 1080 | 1 | 1 | 0xb00 | com.android.tv.settings/com.android.tv.settings.MainSettings#0 0x53341e80: 8100.00 KiB | 1920 (1920) x 1080 | 1 | 1 | 0xb00 | com.google.android.tvlauncher/com.google.android.tvlauncher.MainActivity#0 0x55d35480: 8100.00 KiB | 1920 (1920) x 1080 | 1 | 1 | 0xb00 | com.android.systemui.ImageWallpaper#0 0x55d35900: 8100.00 KiB | 1920 (1920) x 1080 | 1 | 1 | 0xb00 | com.android.tv.settings/com.android.tv.settings.MainSettings#0 0x55d35f00: unknown | 3840 (3840) x 2160 | 1 | 12B | 0x900 | SurfaceView - Sys2023:dream#0 0x55d36080: unknown | 3840 (3840) x 2160 | 1 | 12B | 0x900 | SurfaceView - Sys2023:dream#0 0x55d36200: unknown | 3840 (3840) x 2160 | 1 | 12B | 0x900 | SurfaceView - Sys2023:dream#0 0x55d36380: unknown | 3840 (3840) x 2160 | 1 | 12B | 0x900 | SurfaceView - Sys2023:dream#0 0x55d36500: unknown | 3840 (3840) x 2160 | 1 | 12B | 0x900 | SurfaceView - Sys2023:dream#0 0x55d36680: unknown | 3840 (3840) x 2160 | 1 | 12B | 0x900 | SurfaceView - Sys2023:dream#0 0x55d36800: unknown | 3840 (3840) x 2160 | 1 | 12B | 0x900 | SurfaceView - Sys2023:dream#0 0x55d36f80: unknown | 3840 (3840) x 2160 | 1 | 12B | 0x900 | SurfaceView - Sys2023:dream#0 0x55d37100: unknown | 3840 (3840) x 2160 | 1 | 12B | 0x900 | SurfaceView - Sys2023:dream#0 0x55d37280: unknown | 3840 (3840) x 2160 | 1 | 12B | 0x900 | SurfaceView - Sys2023:dream#0 Total allocated (estimate): 72904.00 KB ```

    You can see that the SurfaceView buffers when displaying ExoPlayer are correctly 3840x2160, but it doesn't seem to be allocating any SurfaceView buffers when using my custom view.

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

    Retrofit with complex request model

    Posted: 17 Apr 2020 01:48 AM PDT

    Can anyone help me with this problem? I had posted it in stackoverflow and also in discord with little response. I just want to know if it's even possible to send the file in that way.

    https://stackoverflow.com/questions/61246724/send-file-using-retrofit-that-follows-specific-request-body/61252401#61252401

    I had found similar issues in the Github but with no response.

    https://github.com/square/retrofit/issues/1785#issuecomment-275998436

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

    Missing Ads Question in Google Play Developer Console

    Posted: 17 Apr 2020 12:27 AM PDT

    Missing Ads Question in Google Play Developer Console

    Hi fellow Android Developers, I am trying to complete my google play app publishing, but I can't seem to get pass this Ads sections. There is no question whatsoever.

    Does anyone of you encountered this?

    App Content Prompt

    Ads Content

    SOLVED: Disable the Adblock. @verdurakh

    submitted by /u/night-robin
    [link] [comments]

    JUnit in Android studio.

    Posted: 17 Apr 2020 04:00 AM PDT

    Are you using junit in Android studio? If yes, even for relative small apps? Do you think it is mandatory to use it? Thank you in advance!!!

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

    No comments:

    Post a Comment