• Breaking News

    Tuesday, February 16, 2021

    Android Dev - Weekly Questions Thread - February 16, 2021

    Android Dev - Weekly Questions Thread - February 16, 2021


    Weekly Questions Thread - February 16, 2021

    Posted: 16 Feb 2021 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]

    App suspended for a reason I cannot understand

    Posted: 16 Feb 2021 01:13 AM PST

    Hello. Today my app got suspended after 2+ years in the playstore. The reason has something to do with a "Hi-res icon (en_US)". I attached the image. Does anybody know more information about this? Thank you.

    Imgur Link: https://imgur.com/a/AXLajm8

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

    Android DataBinding kit for notifying data changes from Model layers to UI layers on MVVM architecture.

    Posted: 15 Feb 2021 10:26 PM PST

    Jetpack Compose Promoted to beta01 in Source

    Posted: 15 Feb 2021 03:06 PM PST

    Another ComposeDesktop App

    Posted: 15 Feb 2021 06:23 AM PST

    Hilt - okhttp scopes, variants and overall app performance ?

    Posted: 16 Feb 2021 07:37 AM PST

    I missed the Dagger learning-curve couple of years ago. I have seen it used in some previous brown-field projects at previous work-places, but it's already setup in the huge project code-base, so it works, and it's just been that way, nobody messes with anything that works.

    I want to learn what are the performance implications of instantiating varying instances of OkHttpClient, or may be even RetrofitClient, let's say, but the way I see it, I'd rather have varying RetrofitClients instantiated on-the-fly, depending on the current feature / screen that the user is on, rather than a global RetrofitClient that is either re-used, or re-instantiated the exact same way each-time client is switching screens. Anyhow, that's the whole idea. I want to understand how to instantiate varying instances of OkHttpClient, scope them as Singletons across the full life-time scope of the Application life-time for re-use, and whether that is better performance or re-instantiating each OkHttpClient variant-type depending on it's necessity every single time ?

    @Module

    @InstallIn ( SingletonComponent::class.java )

    object NetworkModule {

    @Named ( " Variant1 " )

    @Provides

    fun providesOkHttpClientVar1( cookieHandler1 : CookieHandler,

    interceptorMap : Map< String, Interceptor > ) = /** Your Code to provide the OKHttpClient instance **/

    @Named ( " Variant2 " )

    @Provides

    fun providesOkHttpClientVar2( cookieHandler2 : CookieHandler,

    interceptorMap : Map< String, Interceptor > ) = /** Your code to provide a different OkHttpClient instance **/

    }

    I am assuming the above code will keep creating new OkHttpClient instances as and how / when one of the FragmentComponent scoped or ActivityComponent scoped modules begin instantiating their own chain-of-invocation classes / instances - ViewModel, Repository, Mapper, Reducer, RetrofitClient etc.

    @Module

    @InstallIn ( SingletonComponent::class.java )

    object NetworkModule {

    @Singleton

    @Named ( " Variant1 " )

    @Provides

    fun providesOkHttpClientVar1( cookieHandler1 : CookieHandler,

    interceptorMap : Map< String, Interceptor > ) = /** Your code to provide the OkHttpClient instance **/

    @Singleton

    @Named ( " Variant2 " )

    @Provides

    fun providesOkHttpClientVar2( cookieHandler2 : CookieHandler,

    interceptorMap : Map< String, Interceptor > ) = /** Your code to provide a different OkHttpClient instance **/

    }

    Or whether this is better performance ? Scope the varying OkHttpClient instances as Singletons in Application life-time. My apologies if there are any code related blunders, but I hope you get the idea of my question.

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

    [D] Custom TensorFlow Lite model on Android using Firebase ML

    Posted: 16 Feb 2021 07:12 AM PST

    Why can't I compile the msm android kernel?

    Posted: 16 Feb 2021 06:57 AM PST

    I've been stuck at this for more than a week, so I'd appreciate any help.

    What am I trying to do?

    I'm trying to do android kernel exploitation. That's not my current problem though. To learn kernel exploitation, I need to be able to get a version of android that is vulnerable to a certain vulnerability. So here's what I'm doing:

    1. Going here to select a CVE that I want to learn how to exploit: https://source.android.com/security/bulletin/2020-10-01
    2. After selecting a CVE, I need to select a build that is vulnerable to that CVE from here: https://source.android.com/setup/start/build-numbers#source-code-tags-and-builds
    3. Now that I have chosen a build (QQ3A.200805.001 in my case), I note its branch name (android-10.0.0_r41 in my case)
    4. Now I need to be able to run this build in the android emulator (qemu) once as a production build, and once with KASAN+KCOV+debugging symbols for gdb

    Before I begin, I'm following these guides:

    1. https://source.android.com/devices/tech/debug/kasan-kcov
    2. https://source.android.com/setup/build/building-kernels-deprecated
    3. Google :)

    My Setup:

    I did this to download everything I need:

    git clone https://android.googlesource.com/kernel/msm cd msm git fetch --all --tags --prune git checkout remotes/origin/android-msm-coral-4.14-android10 cd .. mkdir AOSP cd AOSP repo init -u https://android.googlesource.com/platform/manifest repo sync -j`nproc` repo init -b android-10.0.0_r41 repo sync -j`nproc` cd .. 

    Then I created this bash script in the same folder to try to compile it normally (without KASAN/KCOV):

    ########### # Params: # ########### ARCH=arm64 CONFIG=cuttlefish_defconfig ########### # Script: # ########### read -p "Compile with clang instead of gcc? [y/N] " USE_CLANG if [ $USE_CLANG == y ] || [ $USE_CLANG == Y ]; then COMPILER=clang CC_PATH=$(pwd)/AOSP/prebuilts/clang/host/linux-x86/clang-r346389c/bin/ else COMPILER=gcc CC_PATH=$(pwd)/AOSP/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9/bin/ export CROSS_COMPILE=aarch64-linux-android- fi export ARCH=$ARCH export PATH=$PATH:$CC_PATH cd msm make clean make distclean make $CONFIG make CC=$COMPILER 

    When I run it with GCC, I get bombarded with depreciation warnings and I get an error:

    Android GCC has been deprecated in favor of Clang, and will be removed from Android in 2020-01 as per the deprecation plan in: https://android.googlesource.com/platform/prebuilts/clang/host/linux-x86/+/master/GCC_4_9_DEPRECATION.md ... Cannot use CONFIG_CC_STACKPROTECTOR_STRONG: -fstack-protector-strong not supported by compiler 

    When I run it with clang, I also get a ton of warnings and this error:

    ./arch/arm64/include/asm/stack_pointer.h:8:51: error: register 'sp' unsuitable for global register variables on this target register unsigned long current_stack_pointer asm ("sp"); ... In file included from ./include/linux/kvm_host.h:14: ./include/linux/signal.h:81:11: warning: array index 3 is past the end of the array (which contains 1 element) [-Warray-bounds] return (set->sig[3] | set->sig[2] | 

    Full outputs for the script can be found here (for gcc) and here (for clang).

    I don't know what to do now, xd. I also don't know if I should checkout the remotes/origin/android-msm-coral-4.14-android10 branch or another branch. Is there a way to know which branch/tag in the msm repo coressponds to the android-10.0.0_r41 branch in the manifest repo?

    Any help is greatly appreciated.

    submitted by /u/Byte-Master-101
    [link] [comments]

    is admob revenue calculator accurate?

    Posted: 16 Feb 2021 05:14 AM PST

    Access android notifications through ssh

    Posted: 16 Feb 2021 05:06 AM PST

    I'm trying to receive notifications from a smartphone/tablet through ssh so I can send them to a slack-channel. Is there something like a system folder where notifications are stored and can I access it?
    thx for your help

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

    CRUD with Paging 3

    Posted: 15 Feb 2021 08:56 PM PST

    Assume I have a pokemon list. I load data from API and binding data to Paging 3

    private val _pokemonList: MutableLiveData<PagingData<Pokemon>> =
    Pager(PagingConfig(pageSize = 50)) { PokemonPagingSource(getPokemonList) }.liveData
    .cachedIn(viewModelScope)
    .let { it as MutableLiveData<PagingData<Pokemon>> }
    val pokemonList: LiveData<PagingData<Pokemon>> = _pokemonList

    I would like to search and delete some item. Do you have any suggestion about it?

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

    Are Android Command line tools available for arm linux, for Raspberry Pi and arm chromebooks?

    Posted: 16 Feb 2021 12:02 AM PST

    I have a raspberry pi 4, 8GB ram, and with the current master channel on flutter I can fire up a flutter linux app on the pi.

    To create flutter android app, I need at least SDK 29, are there arm builds for the Android Command line tools, or can I compile them on the pi?

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

    Case Study GPL v3

    Posted: 15 Feb 2021 05:58 PM PST

    Hello,

    I would like to ask if there are any notable Android apps that violate GPL v3 license?

    What are the implications if an application would not comply and publish their source code?

    Thank you.

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

    Is worth it to use only firebase for a food store app?

    Posted: 15 Feb 2021 11:26 PM PST

    Hi!

    I want to create a food store app, actually is more like a coffee shop app. In the app clients can select coffee and customize it with toppings and size, I think to use firebase (firestore) to create the menu and register users and use realtime database to register orders. My question is if use only firebase is worth it or maybe is better to use other kind of databases, maybe is better to use sql database

    Another question is, I'm planning to use firebase directly with the app and I'm not gonna use an API, is it a bad idea?

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

    GSON AbstractMethodError - ProGuard issue

    Posted: 15 Feb 2021 06:54 PM PST

    Hi, I'm currently getting an AbstractMethodError in my app which looks to be related to GSON:

    java.lang.AbstractMethodError: abstract method "void com.google.gson.TypeAdapter.write(com.google.gson.stream.JsonWriter, java.lang.Object)" 

    I've added all the rules that google has recommended for their proguard: https://github.com/google/gson/blob/master/examples/android-proguard-example/proguard.cfg  

    I also used APK analyzer and see that relevant method(s) are still inside the dex files (write(),read()), so I'm not quite sure why it throws an error during runtime. I also noticed that the GSON TypeAdapter methods/classes are in 3 different dex files, not sure if this is normal?

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

    Android App Engineering

    Posted: 16 Feb 2021 12:51 AM PST

    I am thinking a making an Android Application using Kotlin. It will have the feature of uploading and watching videos (also streaming) online. User would have to make their account also.

    So I wanted to know What are the things that I should learn? Do I need to run the service on a cloud service platform? How should the backend be made? Which server is to be used for uploading and storing videos and other files?

    If you can explain me how the whole application will operate please do help so that I can learn about this.

    Feel Free to message me if you have any extra information or suggestions for me.

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

    How to make full backup of Android Studio project including all dependencies?

    Posted: 15 Feb 2021 01:33 PM PST

    I am super anxious about the upcoming shutdown of Jcenter and Bintray (https://www.reddit.com/r/androiddev/comments/lbssfn/now_that_bintray_and_jcenter_are_shutting_down/)

    I have probably many dependencies on them. How could I check, which dependencies are on Jcenter or Bintray? If I just remove Jcenter repository, the whole project does not build because Android Gradle Plugin dependencies.

    How could I make a bullet proof backup of the project, which works offline and that could be copied to other computers? I have Git repositories but they do not include the dependencies. Probably better would be to somehow replace the dependencies but this would be a good temporary solution.

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

    M1 mac emulator

    Posted: 16 Feb 2021 01:58 AM PST

    When come the new android emulator on the m1 mac

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

    How can I sort categories in the Recycler View?

    Posted: 15 Feb 2021 01:26 PM PST

    Suppose you want to insert items which belong to two different categories and they live all together in the same list. How can I drop a menu or use buttons to see one or the other? is it correct to assign then in different arrays?

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

    How much important/valuable to release a game multi-lingual on your experience?

    Posted: 15 Feb 2021 10:29 AM PST

    Does the benefits of a multi-lingual game worth the hassle of translation of a language and implementation of coding ?

    Imho gamers are usually know English -at least know enough to play the game-.

    Did you notice too much of a difference between a single language game success vs a multi-lingual one?

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

    Tools to run Python on Android

    Posted: 15 Feb 2021 12:58 PM PST

    Android multiple physical device testing advice.

    Posted: 15 Feb 2021 12:30 PM PST

    Hello awesome people. I have reached the point in my app now that I want to test my app on a suite of devices. I have been using the odd device and emulator. I now have built a test rig with six phones with different API levels etc and I can connect to them all via ADB, and Android Studio.

    Does anyone know if any self-hosted solutions would allow me to connect my phone rig to my server and via a web, GUI install an app and deploy it to all the phones but also be able to manage them via the GUI?

    Thanks in advance.

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

    How do you get paid when you set up IAP?

    Posted: 15 Feb 2021 12:22 PM PST

    Hello everyone !

    So when you set up IAP system, does the payment gets "stored" in google adsense account?

    I am curious because I have two accounts one with developer one with admob.

    Since both creates adsense account, I need to delete one of them....

    If worst comes to worst, I am going to delete both accounts and start fresh but wanted to make sure how IAP payment works

    thanks in advance !

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

    No comments:

    Post a Comment