• Breaking News

    Friday, April 23, 2021

    Android Dev - Weekly Anything Goes Thread - April 23, 2021

    Android Dev - Weekly Anything Goes Thread - April 23, 2021


    Weekly Anything Goes Thread - April 23, 2021

    Posted: 23 Apr 2021 06:00 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]

    Dagger Hilt is now stable with 2.35!

    Posted: 22 Apr 2021 06:17 PM PDT

    How to save a file with a custom extension so that only my app can open that particular file?

    Posted: 23 Apr 2021 08:19 AM PDT

    I am working in a project in which I have to save files like html or epub. I don't want users to copy it from their storage and run it with a different app. So I want to save it in such a way that It can only be readable with my app.

    submitted by /u/Hairy-Nectarine-1387
    [link] [comments]

    Approach to debugging in Android

    Posted: 23 Apr 2021 06:03 AM PDT

    Scoped Storage Recap

    Posted: 22 Apr 2021 11:03 AM PDT

    Hi everyone, my name is Yacine Rezgui and I'm a developer relations engineer on the Android team.

    I saw some threads on the upcoming May 5th 2021 deadline regarding Scoped Storage/All Files Access Permission, and wanted to share more. This Google Play policy refers specifically to apps that target API level 30 and need the MANAGE_EXTERNAL_STORAGE permission (All Files Access). If you don't use or plan to use this permission, this policy shouldn't affect you. If you are currently targeting API level 29 and want to use this permission when you update to target API level 30, you will need to comply with this policy.

    Here's a summary and some resources to help resolve some questions we have seen 👇

    In 2019, we introduced Scoped Storage as our vision of a privacy-first storage approach on Android. With it, applications have sandboxed access to shared storage so that users have fuller access control over their device storage. (see this storage talk).

    Use cases that don't need permissions

    • Add media files
    • Add non-media files (pdf, zip, docx, etc.) to the Downloads folder
    • Query MediaStore to get all the files added by your application
    • Use the Storage Access Framework to access all types of files on the shared storage

    Use cases that require permission

    • Query MediaStore to get all the media files on the device, including ones added by 3rd party apps, by requesting READ_EXTERNAL_STORAGE (non-media files aren't included)
    • Modify or Delete a media file not created by your app (the user will be prompted to allow this action every time)
    • Location data (Exif) is by default stripped when accessing 3rd party media files unless your app requests the ACCESS_MEDIA_LOCATION permission
    • Once your application is uninstalled and reinstalled, files added in the shared storage by your app won't be accessible unless it requests the READ_EXTERNAL_STORAGE permission

    On Android 10 (API 29), we've provided developers with the ability to temporarily opt-out of Scoped Storage by using the requestLegacyExternalStorage flag when targeting Android 10 (API 29). When targeting API 30 on Android 11+ devices, apps will no longer need the requestLegacyExternalStorage flag but for specific use cases on devices running Android 10, we recommend to still use it as your app can still benefit from it.

    On API level 30, we've added some enhancements related to Scoped Storage:

    • Bulk edit/delete consent dialog when editing 3rd media files
    • Your app's external storage directory won't be accessible to 3rd party apps and vice versa
    • Direct file path access for media files
      • Performance may be impacted through this interface. If performance is critical to your application, we recommend that you use MediaStore

    In conclusion, starting with API 29, no permission is required when adding or modifying your own files in the shared storage. If you need to read and edit 3rd party media files, you have to request READ_EXTERNAL_STORAGE.

    For some apps that have a core primary use case that requires broad access of files on a device, but cannot do so efficiently with the privacy-friendly storage best practices, you can request the special permission called MANAGE_EXTERNAL_STORAGE (All Files Access). Keep in mind that only specific use cases are permitted to use this permission. This Google Play policy spells out some examples of permitted use cases. This permission is what the May 5th deadline is referring to in the email some of you have shared in other threads.

    Read more about storage in our storage guide documentation and our code samples.

    Let me know if you have any questions 👋

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

    Mobile System Design interviews - Exhaustive / Low-Level Design aspects

    Posted: 22 Apr 2021 08:28 PM PDT

    Further to https://www.reddit.com/r/androiddev/comments/mrxgkr/android_system_design_interviews/

    a little about my background - 10 years experience specializing in android, 17 years experience overall using java. all of my android experience has been with two industry sectors - investment bank real-time stock trading apps, and media audio-video playback apps.

    Typical System Design Interview questions that I had experienced recently at companies that could have offered upwards of $250K+ total-compensation, as a staff-level android engineer.

    1. Design a "Todo" list taking notes app, with the feature of allowing multiple clients being able to use the list, or the items in the list, and such, like a family or a group of friends.
    2. Shopping Cart experience in an e-comm app like amazon or ebay or anything similar for that matter.
    3. Analytics / telemetry capturing library.

    Based on my responses in the above discussion, you may have noticed that I do well with HLD - most recent trends for clean app or feature-functionality architecture practices, all the buzzwords, keywords, jargons and such.

    Some interviewers have probed deeper into -

    1. Defining the RESTFul web-services end-points - what http methods would that be? what will be the request structure. what will be the response structure?
    2. what do low-level data-models actually look like ? write code for the data-class, define as many properties as possible.

    I had been finding it really hard to deal with Low-Level and Exhaustive Design questions. I manage to provide a very high-level answer, if-or-else, plenty different ways to do it, accommodate different Product Team proposals and requests and such. However, I find it hard to provide some concreteness to my answers even.

    If similar questions were probed based on my real experience - I had developed Real-time remote check-image deposit feature for banking-industry mobile apps, and analytics for video-playback apps etc. I am certainly well-versed in low-level aspects from my real experience, but I am unable to convincingly "guess what the interviewer is expecting me to say" at low-level design aspects for challenges that are relatively new to me, in a timed-setting such as an interview.

    All of my android experience for 10 years, I have only consumed RESTFul web-services, defined and developed by other teams. The request and response structure is pre-determined based on further back-end system needs. At most, I may have collaborated, reviewed, suggested one-or-two improvements, new properties and such, here-and-there, but on the whole, I strongly believe, at least from experience that Low-Level and Exhaustive Designs are technically -

    1. Industry-sector and Business-domain specific.
    2. ideally not designed by mobile engineers themselves. instead, we design our mobile-apps resolving further challenges that poorly designed web-services present.
    3. there's no one-shoe-fits-all framework for low-level / exhaustive design aspects across all industries and business-domains.
    4. most low-level and exhaustive design aspects evolve after much brain-storming over time, however, most high-level designs are broadly set-in-stone early-on, due to industry-wide standardization of practices - SOLID principles, unit-testability, programming language features such as structured-concurrency, and platform APIs such as WorkManager for deferred and coroutines for immediate background-tasks.

    How to overcome this challenge of low-level design questions during mobile system design interviews ? Is there a template / framework - a blog, a website, any OSS source or such that can help learn the skill of designing low-level aspects particularly for system design interviews, on-the-fly ?

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

    Showing No internet in Android App

    Posted: 23 Apr 2021 09:15 AM PDT

    Hello All,

    What is the latest trend in Android to show the user has lost internet connection in Android Apps?

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

    Help understanding System.loadLibrary duration

    Posted: 23 Apr 2021 08:41 AM PDT

    I'm doing a little profiling on an app and am looking at some calls to System.loadLibrary() on the main thread. These were flagged by the StrictMode policy violation checker as

    StrictMode policy violation; ~duration=150 ms: android.os.strictmode.DiskReadViolation .... at java.lang.System.loadLibrary(System.java:1667) 

    but when I put some timing around the call to System.loadLibrary() it appears to only take around 10ms.

    What is causing the difference in timing here? Is the disk read deferred to some later time? As far as I know everything I'm doing is on the same thread. Thanks in advance

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

    Open source - Stock graph with hover functionality

    Posted: 23 Apr 2021 04:29 AM PDT

    If you were to “start over”, how would you go about learning fundamentals?

    Posted: 22 Apr 2021 06:19 PM PDT

    For reference, I haven't programmed in 3 months. I got a SaaS sales job at a well known tech company in Austin and I want to transition to the Android team down the road.

    I have built apps and have one on the play store, but I feel like I hacked it together. I did not truly understand everything happening...used Kotlin, the nasa API and retrofit to display some images, recyclerview, etc. It had a local db to save photos. Very simple to most of you, but I spent a month on it lol.

    I really want to be a great developer and focus on programming fundamentals THEN keep growing my knowledge in Android. For example, I can tell you plenty of Android specific knowledge, but I cannot reverse a linked list without looking it up.

    What are some good resources you would recommend? Any with Kotlin focus?

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

    Emulator appearing offline on M1 Mac after the last update of arm64-v8a

    Posted: 23 Apr 2021 05:36 AM PDT

    Yesterday the emulator was working perfectly. The system image was arm64-v8a. I don't exactly remember the Release name of the working system image but, yesterday there was an update for the ARM 64 system image which I accepted and the release name is "S".

    I can start the emulator from my AVD Manager, the emulator also starts when I press the 'Run app' button however, the app isn't loaded on the emulator and the emulator appears offline if I check through "adb devices" or if I click on "Troubleshoot Device connections" it shows:

    "emulator-5554 - Device is currently in the offline state"

    I have tried most of the suggestions found on StackOverflow like:

    • adb kill-server, adb start-server
    • Remove and re-create AVD device
    • Invalidate Caches/Restart
    • Enable USB debugging inside the emulator
    • Wipe data and cold boot from AVD manager

    I am using Android Studio 4.1.3

    Build #AI-201.8743.12.41.7199119, built on March 10, 2021 Runtime version: 1.8.0_242-release-1644-b3-6915495 x86_64 VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o macOS 10.16 GC: ParNew, ConcurrentMarkSweep Memory: 1981M Cores: 8 Registry: ide.new.welcome.screen.force=true, external.system.auto.import.disabled=true Non-Bundled Plugins: org.jetbrains.kotlin 

    AVD:

    Name: Pixel_4_API_S CPU/ABI: Google Play ARM (arm64-v8a) Path: ~/.android/avd/Pixel_4_API_S.avd Target: google_apis_playstore [Google Play] (API level S) Skin: pixel_4 SD Card: 512M fastboot.chosenSnapshotFile: runtime.network.speed: full hw.accelerometer: yes hw.device.name: pixel_4 hw.lcd.width: 1080 image.androidVersion.codename: S hw.initialOrientation: Portrait image.androidVersion.api: 29 tag.id: google_apis_playstore hw.mainKeys: no hw.camera.front: emulated avd.ini.displayname: Pixel 4 API S hw.gpu.mode: auto hw.ramSize: 1536 PlayStore.enabled: true fastboot.forceColdBoot: no hw.cpu.ncore: 4 hw.keyboard: yes hw.sensors.proximity: yes hw.dPad: no hw.lcd.height: 2280 vm.heapSize: 256 skin.dynamic: yes hw.device.manufacturer: Google hw.gps: yes hw.audioInput: yes image.sysdir.1: system-images/android-S/google_apis_playstore/arm64-v8a/ showDeviceFrame: yes hw.camera.back: virtualscene AvdId: Pixel_4_API_S hw.lcd.density: 440 hw.arc: false hw.device.hash2: MD5:6b5943207fe196d842659d2e43022e20 fastboot.forceChosenSnapshotBoot: no fastboot.forceFastBoot: yes hw.trackBall: no hw.battery: yes hw.sdCard: yes tag.display: Google Play runtime.network.latency: none disk.dataPartition.size: 6442450944 hw.sensors.orientation: yes avd.ini.encoding: UTF-8 hw.gpu.enabled: yes 

    Any idea what has gone wrong? Or how to tackle this issue?

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

    What's a good Android 11 compatible library to implement photo, image and file picking for uploading?

    Posted: 22 Apr 2021 08:04 PM PDT

    Let's consider a typical scenario. We have a, say, messenger, and want to provide user with ability to attach image from photo, image from gallery, or any other file, to a message.

    Is there any convenient library to do this in Android 11 - compatible way? I used android-multipicker-library, but it works only with "requestLegacyExternalStorage" manifest flag, so basically no go for Android 11.

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

    Smart AutoClicker: An open-source auto clicker on images for Android

    Posted: 23 Apr 2021 04:42 AM PDT

    Top Tools for Mobile App Wireframe Design to use in 2021!

    Posted: 22 Apr 2021 11:34 PM PDT

    can i promote anothers apps out of play store inside my app?

    Posted: 22 Apr 2021 07:35 PM PDT

    hi, i'm development an game, originaly i thought about monetize it just with donations and without ads or in app purchases, but i figure out you cant do something like a link to patreon inside your app.

    can i create my app, and promote inside it a itch.io or web page with another apk ?

    the apk in play store would has rewarded ads and subcriptions, the apk in itch.io just a patreon link or donations request

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

    Are updates manually reviewed?

    Posted: 22 Apr 2021 11:59 PM PDT

    I have an app with a very specific-use scenario that needs special hardware for testing. From your experience, is the update-functionality manually tested by people at Google Play? Because they would need to aquire that hardware...also my app hasn't been updated in a long time.

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

    SAF - filter by file extension

    Posted: 22 Apr 2021 09:13 AM PDT

    I can't believe there's no way for SAF to show files filtered by extension.

    I'm working with unusual files (.sav, .gb, .cht, .stat etc) not tied to any Mime Type and, apparently, there's no way to show a filtered list of only interesting ones... so i have to fallback to set "*/*" as MimeType and let the user to search between them

    Someone has a workaround to propose me? I'm so sad :(

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

    How can i handle two way binding in MVI architecture ?

    Posted: 22 Apr 2021 06:41 PM PDT

    I see many articles handling two way binding with MVVM. But i want to handle this issue with single source of truth. I dont want to create multiple stateflows for this case. I have a StateFlow which has all view state inside entity. How can i provide to sync with multiple EditText values to the StateFlow ?

    I have added multiple TextWatcher's to sending event to ViewModel but this way causes so boilerplate code.

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

    Is there any android emulator that Supports magisk? I need an emulator that passes the safetynet, and as of nowl think that can be done only using magisk!

    Posted: 22 Apr 2021 09:47 AM PDT

    Developing notes application

    Posted: 22 Apr 2021 01:32 PM PDT

    Hello Developers! I would like to ask for help. I am about to start a exam project and I want to develop a Notes application. I will use Angular and Android clients. Backend will be NestJS and PostgreSQL. I have also requirement to use Socket.IO for real time communication, therefore I would like to ask if anyone has any experience with similar case as mine. Basically I would like to develop Simplenote.com application clone. I would like to be able to see update of a note in android app if I will edit note in web browser and vice versa. Can you guys give me some hints when it comes to live updates? Can I use Socket.IO for that? Anything I should be careful about? Any help will be greatly appriciated. Thanks a lot !

    submitted by /u/Constant-Dragonfly-8
    [link] [comments]

    How do you work with E2E testing?

    Posted: 22 Apr 2021 11:49 AM PDT

    I know there are different strategies when dealing with e2e tests, given they might take some time to execute.

    We perform our tests on staging branch each night if there were any changes merged into staging branch, then we print out a report to slack with links to PRs that got merged and report to the test run. Some companies have e2e tests as a blocker to merge every PR and run it multiple times as new commits are introduced.

    How do you do it? What are other strategies to execute these tests? What are the upsides and downsides? Do you only test them on one branch? How often do you run them?

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

    No comments:

    Post a Comment