• Breaking News

    Tuesday, August 3, 2021

    Android Dev - Weekly Questions Thread - August 03, 2021

    Android Dev - Weekly Questions Thread - August 03, 2021


    Weekly Questions Thread - August 03, 2021

    Posted: 03 Aug 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]

    AppSweep, mobile application scanning for developers

    Posted: 03 Aug 2021 05:29 AM PDT

    AppSweep, mobile application scanning for developers

    Hi all!
    Today we've released the first version of our free app scanning tool 'AppSweep'.

    https://appsweep.guardsquare.com/

    https://i.redd.it/mfudoz26z4f71.gif

    The initial set of static analysis passes aims to check your uploaded apk for bad crypto setups, faulty handling of TLS connection and webviews, visible keys, leftover logging code, etc..

    Different from other tools, our goal is to make a tool for mobile apps that is focused on dev users.
    This means, for example;

    • we don't tell you which permissions your app is using 😉
    • you can easily cut through any potential noise using familiar navigation such as the package structure, libs & dependencies vs your code,…
    • we support ProGuard/R8 mapping files so you can easily locate issues
    • clear, technical explanations of findings
    • a simple API for CI integration and a GitHub app are available

    We also created a Gradle plugin, in order to seamlessly integrate into CI/CD pipelines. The plugin can be found on the gradle plugin repo and on GitHub.

    Similar to ProGuard, we're counting on the Android developer community to guide us in further development. What did you like? What annoyed you? Any insights on things you hoped we would flag, info about issues you previously had flagged in pentests… All input is welcome here or at our Discourse community.

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

    How to make a custom SeekBar?

    Posted: 03 Aug 2021 05:50 AM PDT

    How to make a custom SeekBar?

    I want to make a SeekBar with which you can move another view. This seekbar should have preview of another view as a background. It should look like this one in the picture. Is this a custom SeekBar or something completely different?

    https://preview.redd.it/t5w1nbyi35f71.jpg?width=1998&format=pjpg&auto=webp&s=d15cf4ad5157840f367a0e665f8517bea4855a93

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

    What does it mean for apps like reddit to have nearby device permission?

    Posted: 02 Aug 2021 12:22 PM PDT

    Accessing chrome content provider

    Posted: 03 Aug 2021 06:46 AM PDT

    Im trying to access the browsing history of my mobile browser (Chrome) via adb shell.The command i'm using is:

    content query --uri content://com.android.chrome/org.chromium.chrome.browser.provider.ChromeBrowserProvider

    Please correct if i'm wrong, but the string "com.android.chrome" is the name of Content Provider of the Chrome app, and the string "org.chromium.chrome.browser.provider.ChromeBrowserProvider" is a reference to the database table that i'm presuming contains data related to my browsing history.

    When i run this command i get a "No results found" message in the shell terminal so obviously there's something i'm missing here.Am i going about this the right way? Is my content uri structured correctly? Can anyone provide me some sort of link that can help me out with accessing data specifically from the Chrome content provider via adb shell? If it makes any difference i'm using powershell on windows 10 and my phone is android 10

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

    Emulator on Android Studio crashes me and opens crash report but does not show the error

    Posted: 03 Aug 2021 09:00 AM PDT

    Can anyone help me with this? I'm now stuck assuming its hardware, but wouldn't make too much sense as it used to work before, and just stopped out of nowhere.

    Yesterday the whole day, when trying to open emulator on any device, in any api, in any app (including opening just the emulator by itself), I get This crash message.

    I've tried uninstalling and installing android studio, and didn't work. I ended up fully formatting my pc, and installing AS again. The error persisted in the first 3 runs, and after creating a device running api 28, it shows This error (that I have had before). When I used to see it, I would still be able to run the app, but now it was just a black screen.

    I found out that even though I installed the latest recommended version of AS, it didn't come with abd.exe. I downloaded the plstform-tools.zip, and when adding everything inside my sdk folder, avd stopped working. I decided to only add instead, the abd.exe file. Avd opened again, but the screen still stayed black.

    I'm running amd Radeon 7500, so I decided to try an emulator running ARM64. The emulator just loads forever, but never opens up.

    Right now, when I try to run api 29 or 30, instead of getting the same crash message as usual, I will just get a pop up saying the emulator was terminated, and shows in console log "error while waiting for the device: emulator proccess for avd was killed"

    I'm at a lost... This is the only pc I can use android studio on. The professor gave us 5 apps due this sunday, and a final exam next week

    To add: for some random reason, all my installations today and yesterday, did not include an uninstall.exe

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

    Android Studio arctic fox blurry preview in XML

    Posted: 02 Aug 2021 08:27 PM PDT

    Has anyone seen this?

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

    Android Integrated Softphone

    Posted: 03 Aug 2021 05:08 AM PDT

    Hello all,

    I have been using zoiper for a while, but it is quite expensive and I don't even use 1/3 of my total devices

    I'm wondering if there's any native / integrated softphone already in android

    Thanks for any help you can give

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

    Viewmodels, delays and lifecycle problems

    Posted: 03 Aug 2021 04:40 AM PDT

    I am animating a view in a fragment. I would like to pause the animation when it goes to background and restart it again when it returns to foreground. I also need to show a button with 10 seconds delay in the same screen. How can I achieve it on ViewModel ?

    We can get the fragment to inform ViewModel about the lifecycle changes like onResume() or onPause() by calling some methods in ViewModel. Or we can use LifecycleObserver. Is there any other way to do this ? Which option would be better for my scenario ?

    To show button with 10 second delay, we can use Handler in ViewModel. Or use coroutines which would still use Handler internally. I also need to cancel the delay if app goes to background. Is there any other way to handle this ?

    submitted by /u/No-Week7414
    [link] [comments]

    WorkManager setExpedited (new method instead of foreground service)

    Posted: 02 Aug 2021 01:22 PM PDT

    Hi all,

    I want to integrate to my app this new method instead of foreground service because of https://developer.android.com/about/versions/12/foreground-services Android 12 foreground service restrictions. Did you try new setExpedited method for background tasks. Because I tried to use it as suggested. But it throws exception when work manager is triggered.

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

    Can someone walk me through how emojicompat works and its implementation?

    Posted: 02 Aug 2021 11:04 PM PDT

    I've spent about 2 weeks looking at different articles and the little information I can find on youtube but I have no idea what to do or how to implement it. There must be a code already made or something. If there is, I can't find it.

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

    ViewModel and Fragment

    Posted: 03 Aug 2021 01:12 AM PDT

    I have a couple of questions regarding viewmodel and fragment as I couldn't find my answers online.

    Let's assume we have a fragment and inside of it we do:

     private val viewModel by viewModels<UsersViewModel>() 

    As I understood, here we use the extension method viewModels() which will create an instance of the class UsersViewModel .... So let's say in the UsersViewModel I have:

     private val userLiveData = MutableLiveData<MutableList<UserResponse>>() private val dataStatusLiveData = MutableLiveData<Int>() fun getUsers(): MutableLiveData<MutableList<UserResponse>> { return userLiveData } fun getDataStatus(): MutableLiveData<Int> { return dataStatusLiveData } init { loadUsers() } private fun loadUsers() { viewModelScope.launch { dataStatusLiveData.postValue(View.VISIBLE) val users = repository.fetchAllUsers() when (users.isSuccessful) { true -> { if (users.body() != null) { usersLiveData.postValue(countries.body()) dataStatusLiveData.postValue(View.GONE) } } else -> { dataStatusLiveData.postValue(1) } } } } 

    And in Fragment I have:

     private fun setUpUserList() { adapter = usersView.adapter as UserAdapter viewModel.getUser().observe(viewLifecycleOwner, { userList -> adapter.setUserList(userList) }) observeStatus() } private fun observeStatus() { viewModel.getDataStatus().observe(viewLifecycleOwner, { status -> when(status){ 0 -> { progressBar.visibility = View.VISIBLE } 8 -> { progressBar.visibility = View.GONE } 1 -> { Toast.makeText(context,getString(R.string.errorMsg),Toast.LENGTH_SHORT).show() } } }) } 

    1. When this is called private val viewModel by viewModels<UsersViewModel>() does it call the init block since it's creating an instance of it? Or when getUser().observe(..) does it call the init block and observes the data?
    2. Inside loadUsers I'm using a liveData for status and for the data I'm getting from the web service. If let's say I comment this call observeStatus() in fragment, why doesnt getDataStatus() observe the status?
    submitted by /u/learningcodes
    [link] [comments]

    Question on optimizing recyclerview/viewpager2 that loads image performance.

    Posted: 02 Aug 2021 11:30 PM PDT

    Hi. I'm looking for ideas as to how I could improve the performance of my code. I need to populate my recyclerviews with data that includes image data, and the loading of images take time. I implemented viewbinding bindingadapters in my recyclerview item layout. Currently in my fragment, I call submitList to my adapter only after receiving all of my data from the server, and even loading 5 profiles takes up to 8 secs on this.

    I believe I can optimized the recycle view by decoupling the loading of the image from the rest of the data, but I'm not sure how to bind the image if I'm loading it later because with my current implementation I submit the list in the fragment which includes the image bytes data. Can anyone please help me through this?

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

    Where to go from here?

    Posted: 02 Aug 2021 06:28 PM PDT

    Hi guys I've been taking computer engineering in college and I'm in my 5th semester last semester I took mobile programming in android studio since then I've been dead set on getting a job in the field I enjoy it very much I'm just gonna finish my degree since it's a 6 semester program but so far in android I've made tons of apps and I'm comfortable using rest apis getting them using okhttp, fragments or activities, json parsing and some material design aspects also I'm a java programmer is kotlin that much different? What should I try to learn next to make myself a better programmer?

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

    Looking for a bit of guidance on architecture of a project.

    Posted: 02 Aug 2021 01:33 PM PDT

    Hi all, hope this isn't breaking rule 2. I'm just looking for a bit of architecture guidance. I have a decent amount of experience in front/backend web dev and this is my first forray into the android world.

    I am looking to develop an IOT application that records video and then performs a bit of computer vision analysis on the video as it records. The results of recording would be logged into a local database/webserver which should be remotely accessible. Eg, bird appears to the camera at 1:00:00 gets written into the database. I can then remotely access the android device thru it's IP to review database results (as to prevent constant data transfer over the network.)

    In an ideal world I'd just run two docker containers on the device but obviously that isn't possible and I'm having a bit of trouble wrapping my head on what the Android OS will allow me to accomplish. Is it going to be better architecturally to try to jam these into a single APK or can I get away with two background processes? Can I set a cron or systemd process in android? These applications would need to run 24/7/365. Any guidance is appreciated.

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

    Ffmpeg Library

    Posted: 02 Aug 2021 09:49 AM PDT

    Is there anybody who has worked with android Ffmpeg library I've been searching a lot on internet but cannot find a good also my job depend on this task so please if u can help I'll be very greatful to u.

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

    Am I too slow on Jetpack Compose codelabs?

    Posted: 02 Aug 2021 09:46 AM PDT

    I have been learning Jetpack Compose using the android developers Jetpack Compose codelabs for a few days now and it seems like there is no way I can match the remaining time at the upper corner of each tutorial.

    I Just want to know if I am way to slow on learning those new stuff and something is wrong with my learning curve (might be getting old for these stuff?) or is there something wrong with the 'remaining time estimation'. I just can't keep up with the estimated time remaining.

    All comments will be highly appreciated, including those that will say that they finished those codelabs before the time estimation.

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

    No comments:

    Post a Comment