• Breaking News

    Wednesday, February 2, 2022

    Android Dev - Weekly Questions Thread - February 01, 2022

    Android Dev - Weekly Questions Thread - February 01, 2022


    Weekly Questions Thread - February 01, 2022

    Posted: 01 Feb 2022 06:00 AM PST

    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]

    EasyAdapter: Android Annotation Processing Library to generate your adapters only with Annotations on your model

    Posted: 02 Feb 2022 02:04 AM PST

    EasyAdapter is my last project in 2021 :D, it's an annotation processing library to generate adapter class from your model with listeners and diffutil in the Compile time only, it also supports using Kapt and KSP processors

    Github: https://github.com/AmrDeveloper/EasyAdapter

    Full documentation: https://amrdeveloper.github.io/EasyAdapter/

    Demo for Version 1.0.0

    https://www.youtube.com/watch?v=tAABBvt4qc0&ab_channel=AmrDeveloper

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

    I Started Android Development At 40

    Posted: 01 Feb 2022 02:58 PM PST

    Open-source Chinese keyboard: Stroke Input Method (筆畫輸入法)

    Posted: 02 Feb 2022 05:47 AM PST

    This is my first ever Android project. It is a recreation of the minimalist Chinese input method found on Nokia dumbphones, where you input characters by typing stroke sequences on a digit pad (e.g. 天 is ㇐㇐㇒㇔ or 1134). I was unsatisfied by existing Android implementations being closed-source, lacking many characters, and/or having inconsistent stroke sequences.

    I don't know very much about programming (self-taught). I hope my code isn't too awful; I'm a recent deserter from academia, and during that time I saw much horrendous code (and produced my share of it). This is my first project where I expect other people to be reading the code besides me.

    My main concern is I load the entire stroke data set into memory when the input method service is instantiated. This takes a long time on lower-end devices (1.2 seconds on my cheap phone with ~1.3 GB RAM). Any suggestions?

    Feedback welcome and appreciated.

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

    What laptop to use?

    Posted: 02 Feb 2022 11:00 AM PST

    Hi y'all,

    I just landed an Android gig and they're asking me which laptop I'd want to use. Do you guys have any suggestions?

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

    Add BitBucket dependency using ssh

    Posted: 02 Feb 2022 03:17 AM PST

    Add BitBucket dependency using ssh

    Hello, is it possible to add dependency to build.gradle using ssh. Plugin is hosted on private BitBucket repo and I currently access it with my BitBucket username and password which is not ideal but works.

    BitBucket ssh url looks something like this " [git@bitbucket.org](mailto:git@bitbucket.org):<TEAM>/<REPO>.git "

    I tried adding it like that but plugin is not found.

    Currently, it's implemented like in the picture and like this it works.

    https://preview.redd.it/xpxjq2molef81.png?width=763&format=png&auto=webp&s=ba7b24db0791037932b3761d12c568dd069e997d

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

    What is a good general-purpose mobile device to test my apps/games on?

    Posted: 02 Feb 2022 04:29 AM PST

    Do you guys have any recommendation for what phone device to use for development of my Android game?

    I'm thinking about getting a Google Pixel 6 for testing my game on as it has the cleanest android, and I suppose it will have all the latest android updates, any other thing I should take into account?

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

    An iOS developer and new to Android here. In iOS when you long tap an item you should show a drop down menu with actions, and in Android you should show the actions in the top app bar, so what is the correct way to update the top app bar when you long tap an item? I’m using Jetpack Compose.

    Posted: 02 Feb 2022 08:01 AM PST

    Things to know for a junior developer position and where to find such jobs

    Posted: 01 Feb 2022 05:59 PM PST

    I've worked with Java and kotlin but only on personal projects. I've also been working with jetpack compose and I really like it. But I want to get a job this year and I'd like to know what I'm expected to know, and where I can find jobs also. Thanks

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

    Help, i have lowered screen dp too low

    Posted: 02 Feb 2022 05:19 AM PST

    Help, i have lowered screen dp too low in dev options and the screen is on but blank. Can turn off and on but cant even see now to reset device. Have gfied power off and volum but blank screen. How do i fix it? Thanks

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

    MDM for AndroidTV and Owner permission issue

    Posted: 02 Feb 2022 04:37 AM PST

    Hello.
    I need to install a MDM (Headwind MDM) on any AndroidTV but i'm having a lot of problems with setting up device owner permission, even on rooted device

    adb shell dpm set-device-owner com.hmdm.launcher/.AdminReceiver 

    With this command, the MDM has owner permission and work fine until next reboot, then the device going in loop reboot trying to load the launcher. I read on internet who edits device_owner_2.xml and device_policies.xml to grant owner permission, but this files are created with the command above.

    Can any android expert tell me something I can try? I have also tried to disable the default launcher before restarting but without success. I can't debugging because the adb is not available during rebooting

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

    Build & Deploy Kivy App (Python) with Buildozer on Android

    Posted: 01 Feb 2022 03:18 PM PST

    New Bundle_Util a utility for bundletool

    Posted: 01 Feb 2022 02:04 PM PST

    Just uploaded an open source utility for Android's bundletool.

    It's basically a GUI for it and supports every bundletool command.

    If you want, you can check it out:

    https://sourceforge.net/projects/bundle-util/

    https://github.com/joes0451/Bundle_Util

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

    App updates are taking at least a week(message shows "in review") to go live on playstore. Is anybody else facing the same issue?

    Posted: 01 Feb 2022 02:04 AM PST

    I'm facing the issue since start of this year for multiple apps

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

    Media info error

    Posted: 01 Feb 2022 09:59 PM PST

    When I check playback resolution using .\adb shell dumpsys media.resource_manager for youtube, It returns the resolution I have set manually only for HDR videos. For other content, it just returns a fixed low res value next to Media Info. Same for Netflix. Can anyone please elaborate?

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

    Every Composable deserves a ViewModel

    Posted: 01 Feb 2022 07:29 AM PST

    Best practice to connect a WearOS app to a smartphone app?

    Posted: 01 Feb 2022 12:05 PM PST

    I bought a WearOS watch and have some ideas in my mind what I want to do with it. For example having an app running on my phone, and if something specific happens, I want my watch to vibrate. Another example would be, I want to input something in the watch and analyze this on the phone. Both scenarios should work at every time. I don't want to sync something by hand .

    What are the best practices for interdevice-communitcation for these scenarios?

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

    Should I change my ad network from Admob to another?

    Posted: 01 Feb 2022 11:46 AM PST

    Hello This month my ad revenue was 7752 TRY and Admob cut 2006 TRY for invalid traffic. It's 25% cut and annoyed me greatly. Admob did cut invalid traffic before but those were around 5-10%. I made a quick research around the web and people doesn't really recommend other ad networks because of low fill rate and ecpm values. My user base is from 2-3 tier countries mostly. What do you think?

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

    [WIP] The main menu of my new project.

    Posted: 01 Feb 2022 02:10 PM PST

    For the "oldest" of the place and lovers of retro games, just by reading the title and subtitle (there are 4 clues in them) you will get an idea of the type of game it will be and what ancient jewels it is inspired by 😁 I will keep reporting my progress.

    https://youtu.be/k3a2Hoa00hY

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

    A modern android app must have!!

    Posted: 01 Feb 2022 12:06 PM PST

    I request all of you to please suggest one or more thing that according to you is a must have in a modern android app, Any library, any pattern that you follow which helped your app grow in any way,

    for example implementing some analytic tool, crashlytics any sick library, or anything that makes your app shine in terms of performance, UX, design ,animation, scaling, robustness(crash free) and security.

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

    Can you write an Android app that will monitor another app's screen while in the background?

    Posted: 01 Feb 2022 03:46 PM PST

    So if a given app doesn't share your data, can you write an app that will go into background mode (not be the front app) and monitor the screen activity of another app?

    So if you had Twitter, a game, a weather app, email app, etc... and you wanted to record something like screen changes or read screen data, could you do that.

    Let's say it was a news app or email app and you wanted to record the screen looking for your name or some keyword or just screen changes and then record info about them by screenshot and/or screen scrapes.

    Assume you have full control over the device, it's not someone else's phone, it's yours and you can run in any mode you want.

    Maybe even live echo to a laptop or even the target app running in a simulator on a laptop.

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

    Find BLE DEVICES program crashes

    Posted: 01 Feb 2022 02:24 PM PST

    Line37: BluetoothAdapter bluetoothAdapter = BluetoothAdapter.getDefaultAdapter();crashes program with error...Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'android.view.LayoutInflater android.view.Window.getLayoutInflater()' on a null object referenceGoal is to scan and show on mobile phone the bluetooth devices

    submitted by /u/No-Sleep-9475
    [link] [comments]

    Writing and calling system apps/libs in Android

    Posted: 01 Feb 2022 06:49 AM PST

    Writing a C binary to access /dev/ttyGS0 port running as system.

    I have seen this work on a binary i did a capture on during a certain process that made escalated system calls just by injecting an ARM binary. I'm trying to do the same. Believe the other binary used system libs and was able to access (read/write) to port /dev/ttyGS0 that in it's current state has these permissions:

    rw-rw---- 1 system system 502, 0 2021-12-31 04:29 ttyGS0

    Can i make an APK that runs as system (maybe device manager hack?) and then have it call that internal binary as system? Please help me think on this one -- i'm new to C, have some experience in writing APK's and compiling arm binaries for NIX.

    Using a modified version of this C code: https://forum.arduino.cc/t/debug-code-attached-read-dev-ttyusb0-from-a-c-program/99900

    After modifying to /dev/ttyGS0 and compiling i get this message:

    $ ./test_binary

    init_serialport: Unable to open port : Permission denied

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

    Is it normal for a Scheduled Timer to pendle in at 60FPS?

    Posted: 01 Feb 2022 06:43 AM PST

    I'm experiencing some weird behavior with my Timer.

    I have a Game-Looping thread.

     t.scheduleAtFixedRate(run, 0, 1); 

    It calls:

    view.onDraw(c); //in view.onDraw: totalframecount++ 

    This results in: 60-65 FPS in the Game.

    My Method for calculating FPS:

     int totalFrameCount = 0; int maxFps = 0; int resetmaxfpstemp=0; TimerTask updateFPS = new TimerTask() { public void run() { resetmaxfpstemp++; if (resetmaxfpstemp==2){ resetmaxfpstemp=0; maxFps=0; } if (maxFps<totalFrameCount) { maxFps=totalFrameCount; } totalFrameCount = 0; } }; 

    Here is the weird part: wether I schedule every 1MS or every 15MS, it stays at ~60FPS.

    When I draw a LOT of stuff on the screen, which no doubt takes some time to calculate and draw, it STILL stays at the same FPS as when I only do canvas.drawcolor(black), which should take very little time.

    Why does it pendle in at the same FPS wether expensive calculations are done or not? I mean, I like it, 60FPS is nice, but why? And I wonder if this is device specific. If a faster smartphone than mine (Poco F3, very fast for now) comes along, would that pendle in at a higher number, making the game too fast?

    I am aware that scheduling the task to run every 17MS would result in 60 possible runs per second, but I lose a few FPS when at 17 compared to 1.

    If anyone wants to try to run this on their device, feel free to check and report back with your results.

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

    Aab trouble

    Posted: 01 Feb 2022 06:08 AM PST

    Hey I'm a total noobie to Android app development... I'm just a designer... I wanted to make some profit by creating widgets.. so i started doing kwgt widgets.. the kwgt app has a companion app called kapk which lets you create an apk file consisting of all the widgets you created.. i got myself a developer account to publish the apk to PlayStore.. but it seems PlayStore now only supports aab format and not apk... I do not know how to convert an apk to aab... I have Android studio latest version installed.. can anyone please help me figure this out..

    submitted by /u/Missy-raja
    [link] [comments]

    OnePlus flodding logger with debug logs?

    Posted: 01 Feb 2022 03:37 AM PST

    My new work developer phone is a OnePlus and I noticed some weird behavior. One is that the logs are getting flooded by this

    E/DisplayPanelInterface: GetDisplayPanelOBrightness [oplus_brightness]= [6]

    This doesn't sound like an error, so it should be an info or even verbose, right? Am I missing something, why those logs might be useful for someone?

    Another problem I have is, that on some breakpoints, the OnePlus version of android seems to override the "wait for debugger"-option and throws an ANR. I can reproduce this while doing the migration in my realm database. My personal pixel phone is fine waiting on the breakpoint, but the OnePlus crashes after like 5 seconds with this ANR.

    Anyone else noticed similar stuff and has a solution for the ANR?

    I start believing that OnePlus should not be used for developing.

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

    No comments:

    Post a Comment