• Breaking News

    Wednesday, February 9, 2022

    Android Dev - Weekly Questions Thread - February 08, 2022

    Android Dev - Weekly Questions Thread - February 08, 2022


    Weekly Questions Thread - February 08, 2022

    Posted: 08 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]

    Jetpack Compose 1.1 is now stable!

    Posted: 09 Feb 2022 10:32 AM PST

    Developer account lifetime ban - Data deletion via GDPR to avoid to be tracked/banned again?

    Posted: 09 Feb 2022 02:58 AM PST

    Hey, I have read a lot about developer account deletions and lifetime bans of developers on Google Play Store in the recent days. It seems like Google tracks your every move and keeps data on you, so to detect if a banned developer reopens a developer account in the future and ban him again.

    In case the developer is based in Europe, do you think that he/she could request a total deletion of his data via his "right to be forgotten" given to EU/EEA residents via the GDPR? So to avoid a future automatic ban?

    Side note: I have not been affected by a ban and never had issues with Google in any form. It is just something that came to my mind when reading about it and I have become curious, since I also spent a lot of time deciphering the GDPR recently. Please, no comments about if it is correct to be banned or not or your opinion on bans in general, this is purely a technical question. Thanks 😊

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

    Trying to implement RecyclerView with data updated via WebSocket

    Posted: 09 Feb 2022 06:42 AM PST

    Trying to implement RecyclerView with data updated via WebSocket

    I am trying to develop a MVVM test application which gets the list of 20 crypto currencies, then via WebSocket update the current price of the currency. Using Ktor I successfully managed to get the list and connect to the WebSocket and started receiving the values. I used livedata to observe the Flow<Map<String, String>> which is received from WebSocket.

    private val _cryptoPrice = MutableLiveData<Map<String, String>?>() val cryptoPrice: LiveData<Map<String, String>?> = _cryptoPrice fun initSession() = viewModelScope.launch { when (assetPriceSocketService.initSession()) { is Resource.Success -> { assetPriceSocketService.observeCryptoData() .onEach { _cryptoPrice.value = it }.launchIn(viewModelScope) } is Resource.Error -> { //TODO Handle Error state } } } 

    Inside ViewHolder bind method I observe the livedata, get the value of the given key in Map, and update the TextView inside the RecyclerView item.

    viewModel.cryptoPrice.observe(this@MainActivity) { it?.let { textViewPrice.text = it[data.name] } } 

    However, the problem is that, everytime an item is recycled it creates a new observer, which in turn causes the value of item TextView to be updated again but with a value of different currency.
    My main goal is to update the value of TextView inside RecyclerView items without updating the whole list. It should look something like this:

    CoinMarketCap from PlayStore

    When the value of the currency changes, only the TextView inside corresponding item is updated, not the whole RecyclerView. What is the best approach to this problem? How can I remove the observer after the item is recycled?

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

    My app crashes while starting the intent(after pressing the button)

    Posted: 09 Feb 2022 12:07 PM PST

    My app crashes while starting the intent(after pressing the button)

    My app crashes after pressing the button. I have even added the 2nd kt file in the AndroidManifest file. Please help me!

    2nd activity kt file:

    package com.example.socialmediaintegrationimport android.os.Bundleimport androidx.appcompat.app.AppCompatActivity

    class LoginPage : AppCompatActivity() {override fun onCreate(savedInstanceState: Bundle?) {super.onCreate(savedInstanceState)setContentView(R.layout.login_activity)

    }}

    AndroidManifest file:

    <?xml version="1.0" encoding="utf-8"?>
    <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.socialmediaintegration">
    <application android:allowBackup="true" android:icon="@mipmap/ic\_launcher" android:label="@string/app\_name" android:roundIcon="@mipmap/ic\_launcher\_round" android:supportsRtl="true" android:theme="@style/Theme.SocialMediaIntegration">
    <activity android:name=".LoginPage" android:parentActivityName=".MainActivity">
    </activity>
    <activity android:name=".MainActivity" android:exported="true" >
    <intent-filter>
    <action android:name="android.intent.action.MAIN" />
    <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>
    </activity>
    </application>
    </manifest>

    Main kt file

    submitted by /u/69HvH69
    [link] [comments]

    How can I record video and store it in app specific folder instead of gallery?

    Posted: 09 Feb 2022 10:43 AM PST

    Destroyed source code

    Posted: 08 Feb 2022 09:04 PM PST

    There's a project - Uses Java and Volley - Have most of the http request codes put in activities - Json serialization is done with JsonObject.putString(key,value) - Have mixed up parsing in the ui code(like different date formats for ui and api) - uses no viewmodel or such things - uses custom paging logic instead of the paging library - lot of recycler view adapters have a duplicate list(Don't know why) - tests are done by trying out the app in the phone. If none found then update is released instantly. - adding features is hellish - Replaced almost all fragments with activities because view updates are done in Volley request callbacks and that causes lots of life cycle issues - I'm and intern trying to get on with it

    I have two questions - Will this project servive? - What should be done to address these issues?

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

    Measuring code quality in an app?

    Posted: 09 Feb 2022 08:46 AM PST

    Are there any tools that I can use to measure code quality as a number?

    Context: I want to quantify code quality so I can convince management to let us spend time improving it.

    submitted by /u/No-Let-1734
    [link] [comments]

    What should I write in the privacy policy if my app does not gather any data?

    Posted: 09 Feb 2022 12:25 AM PST

    Hi! I'm trying to figure out what to put in the privacy policy document for google play if my app does not gather any data. I have a one-sentence privacy policy saying basically there's no data gathering whatsoever, but mye app was rejected for not having "a valid privacy policy". Does anyone know what's a valid privacy policy for an app that doesn't gather any data? Is there a standard text or something that I can copy-paste in?

    submitted by /u/fokker-planck
    [link] [comments]

    Dynamic UI webview inside recyclerview

    Posted: 09 Feb 2022 10:43 AM PST

    In one of my projects I am using webview inside a recyclerview and that webview's height is dynamic and comes from firebase depending on url changes and page interaction, the problem is: vertical scroll does not work inside my webview, it scrolls fine when I simply load that page without recyclerview. I have tried some methods on stack but no luck.

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

    Finding a Job Abroad

    Posted: 09 Feb 2022 10:42 AM PST

    Hello everyone.

    I have been developing mobile applications professionally for Android and iOS platforms for 2 years. I am very happy at my current company, but my company is a small company and I feel that it is not enough for me anymore. I want to continue my career abroad. I have been meeting with different companies for about 6 months.

    Recruitment phases are generally as follows.

    1) Meeting with the human resources department.

    2) A homework assignment that must be completed within a week.

    3) Meeting with the technical team.

    4) And offer.

    I never got an offer. Some companies have criticized me. Such as Unit Testing, clean code, testable code, design patterns.

    In this process, I worked on them one by one and made demos. I tried to make up for my shortcomings. They said unit test, I took the course from udemy and did it. They said clean code principles, and I focused on this area in the same way. I said I shouldn't be like everyone else. I worked on RxSwift and RxJava.

    Despite all this, I still haven't reached my goal. I still haven't found a job abroad.

    What do you think is the problem?

    1) Technical incompetence.

    2) I am not a European citizen. That's why I need a visa and work permit, so bureaucracy processes are long.

    3) My competitors are more and better than me.

    What's the solution ? Do I need to know everything? Or do I need to have even more in-depth knowledge under these headings? I don't quite understand what is expected of me.

    - Swift, SwiftUI, Kotlin, Java

    - Reactive Programming with RxSwift, RxJava

    - Understanding REST, GraphQL

    - Clean Code

    - Testable Code

    - MVC, MVVM, Viper Design Patterns

    and go on...

    This list goes on. Do I need to know them all perfectly? I am really confused and tired.

    I need your help to find my way. Thank you, love and respect.

    Healthy days.

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

    Lost all the source code, trying to come back as a Dev.

    Posted: 09 Feb 2022 10:39 AM PST

    I used to make apps back in 2016-17 but had to switch to other professions as I was not making enough money. I had made 3 apps all of there were running fine but since the target audience was below SDK 25, all of the apps were removed before 2022. I don't have my old laptop nor its source file however I do have the keys of all the apps and I have an apk file as well. The thing is I have almost forgotten everything Java and I just want to revive my apps by readjusting the target SDK version to 31/32. Is there any way I can revive those apps? I tried decompiling but the latest android studio is very new to me and as I said earlier I have 2% memory of Java now. I want to revive them as it would boost my portfolio in future.

    Thanks

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

    How to implement video call feature in Native android with kotlin?

    Posted: 09 Feb 2022 02:30 AM PST

    I am trying to search the android docs to implement video call feature. I know there are lot of third party sdk's but my company has refused to use any of them due to poor experience of third party sdk. I am looking for a complete full stack tutorial with backend integration. In short I need to implement something like video calls of zoom, Microsoft teams, WhatsApp calls etc. Does anyone have good starting point and tutorial? Also is WebRTC specific to web and browsers. Does it have native implementation for android?

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

    In App Purchase dilemma

    Posted: 09 Feb 2022 09:59 AM PST

    Hi,

    I develop the app with the feature of creating events, searching for them, and participating, and one of the event creator options to make the event better indexed in search results is to promote it. The promotion will be available to buy, but... i am not sure if it should go through IAP or standard way. From what i understood reading in app payments terms and conditions, it should rather go through IAP, but the thing is, i checked popular material goods trade app - OLX, which also makes possible to promote offers for cash, and they are not doing it through IAP. What am I missing here, anyone know?

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

    Pixel 6 Pro available for Android 12L beta.

    Posted: 09 Feb 2022 09:38 AM PST

    What's faster, C++ or Java ?

    Posted: 09 Feb 2022 09:00 AM PST

    In processing, to be specific, calculating sha256

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

    App Reskin

    Posted: 09 Feb 2022 08:25 AM PST

    How do people on the app store reskin apps and spam them even when they have been banned before? Do they change everything like code variables, package name etc. I am really curious because I see many clones/reskins.

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

    Snap kit review time

    Posted: 09 Feb 2022 08:19 AM PST

    Hey everyone,

    Do you have any experience with Snapchat's Snap kit reviews? How much time does it usually take?

    Thanks

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

    Android Java Udemy Lessons recommended for a junior mobile developer.

    Posted: 09 Feb 2022 08:14 AM PST

    Java Android i dont mind if it also has apple phones. but i focus on android java, i dont want kotlin. I want to learn in general about android java mobile development

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

    Preview of Kotlin 1.6.20 With Prototype of Context Receivers, Parallel Compilation on JVM, Incremental Compilation in JS, and More

    Posted: 08 Feb 2022 09:25 AM PST

    Which library to use for web sockets with kotlin?

    Posted: 09 Feb 2022 02:41 AM PST

    I want to implement web sockets in my android app.

    I can't use firebase as we have our own backend.

    I came across this lib https://github.com/Tinder/Scarlet but is not properly maintained as lat release was almost a year ago so my lead won't allow me to use this library. There are some java libraries as well but even they are not properly maintained. We are trying to avoid java libraries as much as possible.

    We are using Retrofit in our app but as far as I searched retrofit does not provide web sockets implementation.

    There is ktor from jetbrains but including ktor client will defeat the purpose of retrofit.

    Does anyone know of any other popular actively maintained library for android kotlin?

    We are using https://github.com/socketio/socket.io#readme library in our Nodejs backend so I will need something compatible with this.

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

    Is there any way I can loop around the Android resampling for my headphones?

    Posted: 09 Feb 2022 05:16 AM PST

    I want to stream hi res loseless out of my Apple music subscription and saw that because of Android I can only get 24 bit/ 48khz at the max so, that's why I was thinking whether or not I can change the USB drivers for my phone

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

    Google OAuth problem with project's Icon URL?

    Posted: 09 Feb 2022 03:49 AM PST

    We're trying to get our game authorized and we got a reply that there is a problem with our project's Icon URL. I can't find what it could possibly mean. It's the same icon we use for Google Play listing. Anyone had similar issue while getting a review?

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

    error in android classes

    Posted: 09 Feb 2022 02:25 AM PST

    What's your strategy for figuring out Gradle errors?

    Posted: 08 Feb 2022 01:54 PM PST

    I was trying to add Glide to an old project (old being early 2020) yesterday and I ran into a Gradle error when I tried to add the latest Glide version that was just released last night, 4.13.0

    The error was

    In project 'app' a resolved Google Play services library dependency depends on another at an exact version (e.g. "[1.2.0-rc04]", but isn't being resolved to that version. Behavior exhibited by the library will be unknown. Dependency failing: androidx.fragment:fragment-ktx:1.2.0-rc04 -> androidx.fragment:fragment@[1.2.0-rc04], but fragment version was 1.3.1. 

    Oh great, Gradle errors. I got Googling and Stackoverflowing and I couldn't figure it out. Obviously the reason it gives is Glide depends on fragment version 1.3.1 when i use 1.2.0-rc04 in my project.

    I got hacking away, updating versions hoping the error went away and it finally worked when I updated the Gradle wrapper itself. Updating my Gradle wrapper from 5.4 to anything above 6.1 fixed it. I can't seem to figure out why. From Googling, I see Gradle6 has Module Metadata but Glide doesn't seem to publish this file.

    So does anybody have any idea how updating to Gradle 6 fixed my error?

    .

    And more importantly, what's your method when you hit a Gradle error? I just Google the error message, read some StackOverflow answers and try to figure it out. I know to run gradle app:dependencies and pore over that huge text file to figure stuff out. But after that, most of the time I'm just updating version numbers to see if it goes away

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

    Why does "Allow USB debugging" not showing on my mobile? I have already connected my mobile to PC and set it to transfer files.

    Posted: 09 Feb 2022 01:51 AM PST

    No comments:

    Post a Comment