• Breaking News

    Tuesday, October 19, 2021

    Android Dev - Weekly Questions Thread - October 19, 2021

    Android Dev - Weekly Questions Thread - October 19, 2021


    Weekly Questions Thread - October 19, 2021

    Posted: 19 Oct 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]

    When will we see benchmarks for the new Macbook Pros for Android/Gradle Builds?

    Posted: 19 Oct 2021 05:59 AM PDT

    Apple claims some insane performance boosts, but obviously they aren't benchmarking Android builds and they aren't exactly unbiased. Still, I mostly believe them based on the m1 performance.

    I'm rocking a 16" Macbook Pro and will probably upgrade. It performs much better than my coworker using a similarly spec'd windows machine (don't read too much into this, he has a bunch of security software and other stuff going on). It still gets hot af and churns building my not huge project.

    A few months ago someone started a github project people could pull down and build, then share their results to benchmarking various machines with Gradle builds. My Google skills failed me. Does anyone know what I'm talking about? I want to add an issue to benchmark with the new M1 Pro/ M1 Max chips. Please share if you're aware of any other benchmarks for the Macbook pros.

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

    ObjectBox 3.0 released: superfast object database now with String List and Map support

    Posted: 19 Oct 2021 05:28 AM PDT

    Does google giving priority of his own product in Android 12 !!!

    Posted: 19 Oct 2021 12:04 AM PDT

    Recently I am reading Android 12 changes foreground service restrictions . Main point is.. in android 12 we will not be able to start foreground service from background. But we will able to start it in certain condition where my eye get caught by one condition.

    > Exemptions from background start restrictions

    As far I know there is other messaging service like firebase cloud messaging which is used in many app. link

    So, what will happen to them in android 12. Do we able to start them also like FCM?
    If not then why google added this special advantages for FCM in OS level ?

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

    Navigation: back vs up and deep-linking

    Posted: 19 Oct 2021 12:19 AM PDT

    According to the navigation principles, the back and up buttons have different behaviours: the back button is a reverse of the user's journey (equivalent to a back button on a browser), whereas the up button is entirely hierarchical - pressing up on a screen will always go back to the same other screen, regardless of how the first one was opened. This is all pretty straightforward...

    Until you mix in deep links.

    This page states:

    When your app is launched using a deep link on another app's task, Up transitions users back to your app's task and through a simulated back stack and not to the app that triggered the deep link. The Back button, however, does take you back to the other app.

    Now, let's imagine an app that has three destinations: A is the root, B has A as a parent (so up from Be would go to A), and C has B as a parent. C is also the target of a deep link.

    Let's imagine a scenario where the user opens C through a deep link from another app. Then, presses up - we go to B. But now, what happens if the user presses back? Going back to C wouldn't make much sense. Going back to the other app also feels kind of weird - pressing up kind of broke that backstack expectation. The one that feels the more natural to me is to go up to A, but I can't find a reference on that.

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

    How to make a network request synchronously with rxjava? This function always returns null. (I need this function to return a string, cannot return a Single)

    Posted: 19 Oct 2021 08:27 AM PDT

    Images in Mobile Apps shouldn't be large - Would You need image processing Service which adjusts Image size?

    Posted: 19 Oct 2021 08:24 AM PDT

    I intend to create image processing service, which would load your online images scaled down, for users phone needs. Would You find it useful? All the processing would happen on the online service, so the user loads the small - yet still high-quality image

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

    Question

    Posted: 19 Oct 2021 06:29 AM PDT

    Any one managed to get a work around for this code working in android 10 ? Tested but won't work in chromecast GTV I know they have changed some stuff in android 10 so just checking if someone managed to get a work around

    public class Receiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { if (intent.getAction().equals(Intent.ACTION_BOOT_COMPLETED)) { Log.i("onReceive", "call onReceive ACTION_BOOT_COMPLETED"); Intent i = new Intent(context, Activity.class); i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(i); }

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

    I do the funny emoji weapon into my mobile game that makes you attack people by emoji. Poop, robot, ghost, smile,....... What are your favorite emojis?

    Posted: 19 Oct 2021 04:17 AM PDT

    Assisted Inject for less boilerplate?

    Posted: 19 Oct 2021 03:24 AM PDT

    Appwrite announces version 0.11 of its open-source Firebase alternative

    Posted: 18 Oct 2021 10:17 AM PDT

    Hey, this is Aditya, I'm a maintainer at Appwrite, an open-source Firebase replacement, and I'm extremely happy to share that Appwrite 0.11 has just been released with some interesting features, new SDKs and new and updated Cloud Functions!

    This release was also one where our open source contributors have outnumbered the maintainers! We've merged over 150 PRs from our contributors during Hacktoberfest, and still have over 450 PRs waiting to be merged! It's been an exciting time for us and we're really grateful to the entire community for their exceptional support.

    Appwrite 0.11 comes with a lot of new features including a brand new Client and Server SDKs, new Cloud Function runtimes and Cloud Function demos, lots of new translations along with bug fixes and improvements.

    If you haven't heard already, Appwrite is an open-source end-to-end BaaS that helps you build your Web, iOS, Android and Flutter apps much faster with a focus on simplicity, developer experience, privacy and security that you can self-host with a single Docker command.

    We'd love to get your feedback as we move on to v1.0 of Appwrite in the coming weeks. Community feedback has been one of the major driving forces for where the project is today.

    You can check out our latest release at: https://github.com/appwrite/appwrite

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

    I am going on a business trip to San Francisco. Are there any interesting places I could visit as an Android dev?

    Posted: 19 Oct 2021 02:25 AM PDT

    Progressive migration to cross-platform

    Posted: 19 Oct 2021 02:05 AM PDT

    Hi all.

    We currently have a big app (iOS & Android) which dates from 2013, and we would like to progressively move to a cross-platform solution, but we would like the migration to be progressive and have both native and cross-platform in the current native app, this so we can test the performance and decide if moving forward with the solution is good enough for us. Do you guys have any experience on doing so? what would be the right cross-platform solution for doing so? I am thinking of KMP, and have different modules for the migrated features.

    Thanks for any thoughts/experiences.

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

    Different monetization schemes for different platforms - possible?

    Posted: 18 Oct 2021 09:15 PM PDT

    Has anyone done different monetization schemes for different platforms? Like a paid app for WearOS, but a freemium one for the phone? Or any other combination?

    I'm wondering if it's possible with the Play Store and how much success people have had with it, and wanted to hear from you people.

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

    Compass Gets Stuck

    Posted: 18 Oct 2021 05:19 PM PDT

    Hello and thanks in advance for the help.

    I am working on an app with provides range bearing to a particular spot based on GPS and compass.

    From time to time (every week or so) I have noticed the compass orientation freezes. I have installed a different compass app and, while it isn't frozen, it is clearly giving a very wrong reading (for example, north indicated directly at the sun). Similarly Google Maps is showing the wrong heading. I am sure the bearing are wrong because if the sun was in the north we'd be really screwed :). Plus I have another compass on my watch and it is OK.

    I have tried recalibrating (maybe 40 times), shutting off the phone, resetting the phone, clear the app's memory, stopping the app, etc..

    What I noticed today is that if I place my phone on its magnetic mount, all of a sudden the compass started working again once I remove it from the mount.

    I have never had an electronic compass behave like this. Unfortunately google searches invariably point me to suggestions to recalibrate.

    If it matters, the phone is a OnePlus 6T with Android 11, Oxygen OS 11.1.1.1

    Thanks

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

    React Native Todo List App with lottie animated splash screen #1

    Posted: 18 Oct 2021 08:36 PM PDT

    How to set IFrame Interval with MediaRecorder 240fps to speed up reverse play

    Posted: 18 Oct 2021 03:52 PM PDT

    Camera2 API. Media Recorder. Slomotion recording (240fps). Xamarin C#.

    Using MediaRecorder, and everything is working good. However, I need to implement reverse single frame playback, and with 1 second iframes for 240fps video it can be very slow. I need to be able to jump to any spot in the video and single frame reverse, so caching frames is not a workable solution.

    I came upon this, but it's not having an effect regardless of where in the order of steps before mediaRecorder.Prepare() that I put it:

    mediaRecorder.Metrics.PutInt(MediaRecorder.MetricsConstants.VideoIframeInterval, 30);

    I have a suspicion that I may have to abandon MediaRecorder and do my own MediaCodec encoding, but hopefully there's an easier way.

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

    MediaCodec Async - What's using all the processing time?

    Posted: 18 Oct 2021 03:52 PM PDT

    Android, MediaCodec/MediaExtractor, Xamarin, C#

    I've implemented the async approach to extracting frames from a video file. And noticed something seemingly odd. Here are the results of a speed test:

    IN: 240f @ 0.39s = 601.19fps OUT: 240f @ 0.23s = 1024.46fps Time: 1.59s = 150.39fps

    IN: relates only to the time within OnInputBufferAvailable

    OUT: relates only to the time within OnOutputBufferAvailable

    Time: relates to the time from MediaCodec.Start until the final frame arrives at OUT.

    Which means... of the total 1.59s time to execute… 0.39s is IN, 0.23s is OUT… for a total of 0.62s.

    So, my wonderment is... where is the other 0.97s all gone?

    If I understand what's going on correctly, the only thing happening outside of the OnBufferAvailable functions is the allocation of the buffers. Surely this can't be taking so much time?

    There's noting else going on in the app at this time. If this is all used by the GUI thread, which isn't doing anything, is there some way to prioritize so that these functions get the maximum possible speed?

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

    Is my app rating wrong?

    Posted: 18 Oct 2021 09:28 AM PDT

    My app fetches some reviews online then displays them to users and those reviews may contain some extreme swearing.

    So to avoid violating any Google policies during the questionnaire I chose it contains swearing so it got rated 12+ even though my app only displays them

    Is it right for my app?

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

    Invalidate() and PostInvalidate() for OpenGLSurfaceView?

    Posted: 18 Oct 2021 08:57 AM PDT

    I'm putting together an custom UI that is all drawn through a GLSurfaceView. I'm implementing typical gesture controls (fling, pinch zoom) with Scroller (there are basically no content boundaries, so no need for overScroller).

    However, in the tutorial for scrolling (and most animations that I can find), a ViewCompat.postInvalidateOnAnimation(this) is called to redraw. But after digging into the View class, I see that that Invalidate() ties back to draw calls for a Canvas, not something arbitrary I can plug requestRender() into. So by just

    https://developer.android.com/training/gestures/scroll#kotlin

    So as it stands, for the fling animation, I'm using a while loop to update the screen. But A. I can't interrupt the fling animation and B. my log is telling me I skipped ~150 frames and am doing too much work on the main thread. So I'm guessing a while loop is a bad way to do this and I ought to be using some sort of animation framework (like the one invoked by invalidation) that handles the animation backend stuff more elegantly. However I can't find anything like that for an OpenGLSurfaceView.

    Any advice? Here's the fling function I call in my gesture listener .onFling(...). I'm using startScroll() instead of fling() because it reproduces the issue more consistently.

    private fun fling(velocityX: Int, velocityY: Int) { mScroller.forceFinished(true) mScroller.startScroll( -viewData.xMin.toInt(), -viewData.yMin.toInt(), 250, 250, 2500 ) var duration: Int = mScroller.duration var passed: Int = mScroller.timePassed() while (passed < duration) { // this is using too many frames. I only need it to happen ~25-60x/second. also, it won't stop when I start a new gesture. if (mScroller.isFinished) { break } else { mScroller.computeScrollOffset() passed = mScroller.timePassed() viewData.xMin = -mScroller.currX.toFloat() viewData.yMin = -mScroller.currY.toFloat() //Thread.sleep(50) //still skipping frames according to log, but visually has lag. Need a better way. gLView.requestRender() } } } 

    and the gesture listener just in case:

     private class MyGestureListener: GestureDetector.SimpleOnGestureListener() { override fun onDown(e: MotionEvent): Boolean { mScroller.forceFinished(true) gLView.requestRender() return true } // viewData.xMin & yMin are watched by the renderer to update positions of stuff I draw override fun onScroll( e1: MotionEvent, e2: MotionEvent, distanceX: Float, distanceY: Float ): Boolean { mScroller.forceFinished(true) viewData.xMin = viewData.xMin - distanceX viewData.yMin = viewData.yMin - distanceY gLView.requestRender() return true } override fun onDoubleTap(e: MotionEvent): Boolean { viewData.xMin = 0f viewData.yMin = 0f mScroller.forceFinished(true) return true } override fun onFling( e1: MotionEvent, e2: MotionEvent, velocityX: Float, velocityY: Float ): Boolean { fling((-velocityX).toInt(), (-velocityY.toInt())) return true } init { } } 
    submitted by /u/dealingwitholddata
    [link] [comments]

    No comments:

    Post a Comment