• Breaking News

    Tuesday, January 26, 2021

    Android Dev - Weekly Questions Thread - January 26, 2021

    Android Dev - Weekly Questions Thread - January 26, 2021


    Weekly Questions Thread - January 26, 2021

    Posted: 26 Jan 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]

    noob here!

    Posted: 26 Jan 2021 01:26 AM PST

    Hi. I am actually a civil engineer but I have a huge interest in coding and web development. I just finished learning HTML on my own and also have a basic knowledge in C programming. now i want to learn about android app development but i don't have any basic background knowledge.. so which programming language should i learn ? or what are the things i need to learn for developing android app? where can i get the best online courses? (For free)

    (thanks in Advance)

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

    What exactly does Google Play want in my privacy policy?

    Posted: 26 Jan 2021 06:05 AM PST

    I have had my app rejected a few times because of my privacy policy. I am using Admob to serve ads.

    This is the privacy policy that got rejected:

    I use a Admob, a third party service. It collects some information about the user's habits and/or devices.

    Admob's privacy policy is available here: https://policies.google.com/privacy

    Does anyone here have experience with this? What exactly do they want?

    Edit: Heres what I am going to try again with:

    This app uses Admob, a third party service.

    It collects the following information:

    • IP address, which may be used to estimate the general location of a device.
    • Non-user related crash logs, which may be used to diagnose problems and improve the SDK. Diagnostic information may also be used for advertising and analytics purposes.
    • User-associated performance data such as app launch time, hang rate, or energy usage, which may be used to evaluate user behavior, understand the effectiveness of existing product features, and plan new features. Performance data may also be used for displaying ads, including sharing with other entities that display ads.
    • A Device ID such as the device's advertising identifier or other app-bounded device identifiers, which may be used for the purpose of third-party advertising and analytics.
    • Advertising data, such as advertisements the user has seen, may be used to power analytics and advertising features.
    • Other user product interactions like app launch taps, and interaction information, like video views, may be used to improve advertising performance.

    It uses the information to:

    • Deliver their services
    • Maintain and improve them
    • Develop new services
    • Measure the effectiveness of advertising
    • Protect against fraud and abuse
    • Personalize content and ads you see on Google and on our partners' sites and apps

    In order to opt out of personalized advertising, click here: https://adssettings.google.com/authenticated

    Admob's privacy policy is available here: https://policies.google.com/privacy

    submitted by /u/DROP-TABLE-GOOD-ALTS
    [link] [comments]

    ConstraintSet Overlay Issue

    Posted: 26 Jan 2021 07:51 AM PST

    ConstraintSet Overlay Issue

    Trying to insert a view below a recycler view at runtime for a fragment. For some reason, the inserted view keeps overlaying the recyclerview instead of going below it. Created simpler example below (real one inserts AdMob banners at runtime for any fragment so you could reuse it too)

    Screenshot

    https://preview.redd.it/g0a4d85d6pd61.png?width=135&format=png&auto=webp&s=7dde802f74b641ec8c6f87c00988801a5d29769f

    linear_recycler.xml

    <?xml version="1.0" encoding="utf-8"?> <layout> <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/constraintLayout" android:layout_width="match_parent" android:layout_height="match_parent"> <androidx.recyclerview.widget.RecyclerView android:id="@+id/recyclerView" android:layout_width="match_parent" android:layout_height="0dp" tools:listitem="@layout/font_list_item" tools:itemCount="30" app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" /> </androidx.constraintlayout.widget.ConstraintLayout> </layout> 

    premium_banner.xml (view that should go below recycler)

    <?xml version="1.0" encoding="utf-8"?> <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/premium" android:padding="@dimen/margin_small" android:layout_width="match_parent" android:layout_height="wrap_content"> <ImageView android:id="@+id/lock" android:layout_width="50dp" android:layout_height="50dp" android:src="@drawable/lock_flat" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" app:layout_constraintBottom_toBottomOf="parent" /> <TextView android:id="@+id/textview" android:layout_width="0dp" android:layout_height="wrap_content" android:text="@string/premium_banner_remove_title" android:textAlignment="center" android:paddingHorizontal="@dimen/margin_medium" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toStartOf="@+id/noAds" app:layout_constraintStart_toEndOf="@id/lock" app:layout_constraintTop_toTopOf="parent" /> <ImageView android:id="@+id/noAds" android:layout_width="50dp" android:layout_height="50dp" android:src="@drawable/no_ads" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintTop_toTopOf="parent" /> </androidx.constraintlayout.widget.ConstraintLayout> 

    Fragment

    class TestFragment : Fragment() { override fun onCreateView(inflater: LayoutInflater,container: ViewGroup?,savedInstanceState: Bundle?): View? { val binding = DataBindingUtil.inflate(inflater, R.layout.linear_recycler, container, false) insert(binding.recyclerView) val adapter = TestAdapter(this) binding.recyclerView.adapter = adapter return binding.root } fun insert(belowView: View) { val layout = belowView.parent as ConstraintLayout val pb = View.inflate(shared.context, R.layout.premium_banner, null) pb.layoutParams = ConstraintLayout.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT) layout.addView(pb) val set = ConstraintSet() set.clone(layout) set.clear(belowView.id, ConstraintSet.BOTTOM) set.connect(pb.id, ConstraintSet.BOTTOM, layout.id, ConstraintSet.BOTTOM) set.connect(pb.id, ConstraintSet.START, layout.id, ConstraintSet.START) set.connect(pb.id, ConstraintSet.END, layout.id, ConstraintSet.END) set.connect(belowView.id, ConstraintSet.BOTTOM, pb.id, ConstraintSet.TOP) set.applyTo(layout) } } 

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

    Can't find Network Debugging in my Android TV (MiBox)

    Posted: 26 Jan 2021 07:28 AM PST

    Results of the 2021 /r/AndroidDev rules survey!

    Posted: 25 Jan 2021 09:59 AM PST

    Hey all,

    A month or so ago I asked for feedback on our rules, and got 61 responses (full spreadsheet). I was hoping for more, but I understand everyone was busy over xmas / new year! The survey also wasn't as visible as it could have been.

    In this post I'll discuss the results, and propose changes based on the data gathered. Keep in mind there was no username validation (so don't blindly trust the stated author!), and it's a very small sample size. Click the links for pretty charts etc, fresh from Google Forms.

    Check the very bottom of the post for 3 possible changes I'd like your thoughts on!


    General results

    • People are generally happy with the subreddit (most rated 7-8/10).
    • General feedback is mixed & varied. Some feel there is not enough for beginners, others too much!
    • Most people visit daily, with slightly fewer visiting weekly.
    • 58.3% of users have been an Android dev for 5+ years, with 31.7% for 2-4 years.
    • 56.9% of users didn't know we had a Discord, but 24.1% are a member.
    • Users feel high vote / comment rule breaking posts should be kept up, with no real consensus on what counts as "high".
    • People feel a survey 1-2 times a year is good, I'll stick to once a year for now.

    Rules

    Rule 1: Must be related to Android Development

    • Everyone agreed with this rule at least 7/10, with 71.7% agreeing 10/10.
    • Most users felt that posts about cross-platform technology or general mobile dev were OK.
    • Most users felt that posts about Android apps or Google's other businesses were off-topic.
    • Generally people were happy with this rule, with an equal number of complaints about it being too strict / not strict enough.

    Rule 2: No "help me" posts

    • Most people agreed with this rule, but some strongly disagreed.
    • People felt generic questions about how to enable viewbinding / fix a crash / manifest values were rule breaking.
    • People felt "discussion" topics were valuable, as were posts sharing a found solution.
    • There were a lot of interesting proposals in the feedback, with some advocating questions being allowed, others only advanced questions being allowed. The topic definitely needs further discussion.

    Rule 3: No promoting your apps without source code

    • Almost everyone agreed with this rule (60% 10/10).
    • An astounding 98% of users felt a direct link to the app was breaking the rule. Makes sense!
    • Most users felt it was okay for people to post a description of their app, along with the source code & store link. This is what the rule is meant to encourage, happily.

    Rule 4: No app takedown/Play Store vent posts

    • The most divisive question by far! Users mostly agreed with it, but only just.
    • With the current implementation, most people agreed takedown / update rejected / admob posts were all rule breaking.
    • 48.9% of users would like the posts to be allowed so long as the app is described, and a full communication history is included.
    • 36.2% of users want a megathread instead. This topic also needs further discussion.

    Rule 5: No hiring posts

    • 83.3% of users agree with this one, nice.
    • A few good suggestions (a monthly megathread instead, a new subreddit, being linked to a google form), but most users seem OK with the current setup.

    Rule 6: Self promotion must be max 50% of posts

    • Users generally agree with this rule, not overwhelmingly though.
    • Users are ok with "weekly roundup" posts / videos, but would prefer people interacted with the community too.
    • Some people asked how we track this. We have an overview tool for the last 1k posts/comments that is pretty good at spotting spammers: https://i.imgur.com/Zd3huvR.png

    Rule 7: No hardware/software purchasing advice

    • Most people are happy with this rule, and agreed with the interpretation of it.
    • There were some comments disagreeing, but these posts are much rarer than they used to be so not a major issue imo.

    Rule 8: No paywalled submissions

    • Pretty much everyone agrees with this rule.
    • Comments mentioned it's debatable whether Medium counts as paywalled. I personally don't (since incognito bypasses), but this differs. Medium is probably okay, right?

    Rule 9: No meme / low effort posts

    • Almost everyone agrees, and appreciates our friends at /r/mAndroidDev!

    Rule 10: Be respectful and engage in good faith

    • Again almost everyone agrees (unsurprisingly!), and finds all the mentioned behaviours rule breaking (harassing, insulting, discriminating, etc)
    • 87% found discrimination by race / gender unacceptable, 67% found vaguer discrimination (e.g. "Tech bros") unacceptable.
    • Some comments mentioned it's a quite vague rule. This is somewhat unavoidable, as it's impossible to list every way humans can be mean to each other. However, the wording hasn't been changed in years, and could do with updating, esp. to be more positive.

    Tl;dr

    • People are generally happy (woo!), with some possible changes around questions & app takedown posts to resolve.

    Points for discussion

    1. Should we make a change to "no questions" allowed rule? Currently we recommend the Discord or StackOverflow, would you prefer if we redirected users to a new /r/AndroidDevHelp instead?
    2. Do you want to try allowing high quality app takedown posts? They would have strict requirements, like a full description of the app, copies of emails from Google, etc.
    3. If a post is rule breaking but has gathered attention, most people thought it should stay up. What should be the requirements for staying up, or is it at moderator's discretion?

    Thanks!

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

    Live coding interview - good or bad? Why?

    Posted: 26 Jan 2021 02:20 AM PST

    Hi All,

    I would like to know your opinion about live coding during the interview.

    What do you think about a live coding interview?

    What good or bad practices have you seen?

    I deliberately gave only two extreme answers in the survey, because others would be "it depends" answers. Please feel free to elaborate.

    My opinion:

    I see different types of live coding:

    1. Pair programming with IDE
    2. Solving real code problems without IDE
    3. Algorithmic challenge

    I have put it according to my personal usefulness ranking.

    Ad 1) Pair programming live coding can test not only technical skills but also teamwork. This is ok.

    Ad 2) Solving real code problems is a more realistic case scenario, but not a great check without code autocompletion.

    Ad 3 ) IMHO for any modern developer, algorithmically thinking isn't so much needed nowadays. Communication and analysis of business requirements are more useful.

    Of course, algorithms can help but in most common cases and for most of the tasks it's not necessary. Lots of things are done by Framework or IDE. An algorithm challenge can be funny, like solving sudoku, but is it really helpful to check the skills of the candidate? Maybe when it would be a simple algorithm you could check someone's way of thinking, but many times I've seen very hard algorithms and not much time to solve it. You need to know the answer from the beginning to solve it.

    FAANG uses algorithmic challenges, and many other companies want to copy it, but FAANG has a different business model, and they give much more time for the candidate than a typical company.I personally don't believe that this would work for typical software companies where the programmer needs to provide business value for the users.

    View Poll

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

    [theory] I think microdroid is related to android apps on windows

    Posted: 26 Jan 2021 05:22 AM PST

    Microdroid is a further stripped down version of GSIs, atleast as per XDA. At the same time, microsoft has announced its plans to bring android apps to windows. I think microsoft will implement microdroid in windows. The XDA post writer thinks microdroid will be used for drm and stuff, and maybe it will, but I think microsoft will also use microdroid for its own purposes.

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

    Admob match rate and impression dropped to 0 !

    Posted: 26 Jan 2021 03:51 AM PST

    Admob impression were fine when app launched, now it's dropped to 0 impression and 0% match rate per day. No policy violation email, no ad limit , nothing.. I don't understand what's happening. I know sometimes there isn't any ad to serve but it's been 10 days. There is no option to contact admob either.

    If any one had this problem and how you guys fixed it please let me know, Thanks !

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

    Video capture quality on social media apps

    Posted: 26 Jan 2021 03:13 AM PST

    Hey all, just a noob here Recently switched from iOS to Android and came to find out there's a noticable difference in video quality when captured in app (tiktok, ig, etc). I heard it's due to a difference in ios vs android coding.

    Does anyone know of a fix for this issue? If not, why is it not yet fixed in the firstplace?

    I hope my question is in place Thank you

    submitted by /u/Inside-Bread
    [link] [comments]

    To use a dependency injection framework or not to

    Posted: 25 Jan 2021 11:25 PM PST

    Ive been reading up on dagger2 and hilt to generate injectors. My use case is to instantiate the data sources, repository and viewmodel factory in an injector class so my code in the views avoid boilerplate. So for any module, I would need 4 methods in my injector object to achieve my requirement. Taking this into account, do I really need to spend time learning a framework and to deal with the pitfalls associated with committing to a library?

    submitted by /u/Revolutionary-Print4
    [link] [comments]

    As AsyncTask is deprecated, what do I use?

    Posted: 26 Jan 2021 02:17 AM PST

    Hi peeps!

    I hope everyone is safe and well!

    I'm taking advice from my previous thread on here and creating a Repository to deal with my database. However, the tutorial of sorts I'm using to do this is using AsyncTask to do the majority of thread based functions. For example, I'll put my insert class within my repository class:

    public class ProjectRepository { public static class InsertProject extends AsyncTask<Project, Void, Void> { private ProjectDao dao; protected InsertProject(ProjectDao dao) { this.dao = dao; } @Override protected Void doInBackground(Project... projects) { dao.insertProject(projects[0]); return null; } } } 

    Now I'm very aware that AsyncTask is deprecated since API level 30 and I want to use the best way that is as future safe as possible.

    I already have an ExecutorService "ThreadUtil" class which is in charge of the initialisation of my app so should I use that? If so, how? Otherwise what should I use to achieve what the above is doing?

    Thanks guys!

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

    After updating to Android 11, screen recording doesn't exist on Xiaomi Mi A3

    Posted: 26 Jan 2021 05:07 AM PST

    My phone just get updated to Android 11 and all the new features are there... Except the most exciting one, built in screen recording. Can anyone help me?

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

    Draw trail on offline map - which library would you choose ? (Excluding google maps)

    Posted: 25 Jan 2021 04:50 PM PST

    Help with privacy policy

    Posted: 25 Jan 2021 10:08 PM PST

    My app which is designed for families has been removed bec of privacy policy.

    I got an email telling me to provide privacy policy. But i have already provided link to privacy policy in google developer portal

    This is email i got

    Issue: Violation of Families Policy RequirementsApps that contain elements that appeal to children must comply with all Families Policy Requirements. We found the following issue(s) with your app:

    Eligibility Issue Privacy policy
    You must provide a link to your app's privacy policy on your app's store listing page. This link must be maintained at all times while the app is available on Google Play, and it must link to a privacy policy that, among other things, accurately describes your app's data collection and use. Please provide a link to a valid privacy policy in your app's store listing page in the Play Console. For more details, please refer to the Privacy policy section (#6) of the Families Policy Requirements.

    I dont know what to do. Privacy policy is already provided

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

    Firebase crashlytics and gdpr

    Posted: 25 Jan 2021 10:49 AM PST

    Hey guys, I'm living in Europe and I work on a side project and I wanted to add crashlytics to my app. Now I'm uncertain if I need to add something more besides an opt in and opt out for crashlytics and analytics or if I need to add a gdpr or something similar. Have you any similar experience on that? Is there any alternative that does not store user data ?

    Thanks in advance

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

    Android remote interview preparation

    Posted: 25 Jan 2021 03:58 PM PST

    Hi folks,

    On tomorrow, Wednesday I will have my first ever remote interview for an Android Engineer position at a top german company.

    I want some advices and tips from y'all.

    Best regards !

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

    [Help] Generic, Dagger 2 Injected ViewModel

    Posted: 25 Jan 2021 04:15 PM PST

    I'm a huge fan of /u/zhuinden's post about generic, one-liner ViewBindings for activities and fragments, and have even gone so far as to write generic, Dagger 2 Injected versions (using dispatching android injector & DaggerAppCompatActivity) that I now inherit from for each new project.

    The issue then is that I'm working towards replacing all my RxJava2 dependencies with Kotlin Flow. My problem is that the standard DispatchingAndroidInjector doesn't work with the ViewBinding classes for injection: Only for Fragments/Activities/Services/Broadcasts.

    Conceptually I don't see why there shouldn't be a way to use interfaces or reification to inject an abstract view model in line with the activity lifecycle.

    What I have is this:

    abstract class InjectedBoundViewModelActivity : DaggerAppCompatActivity(){ // Example Usage: override val binding: ActivityExampleBinding by viewBinding(ActivityExampleBinding::inflate) protected abstract val binding: ViewBinding protected abstract val viewModel: ViewModel //What we want to inject override fun onCreate(savedInstanceState: Bundle?) { AndroidInjection.inject(this) //Where I suspect we want to inject the ViewModel via reification or interface // (application as InjectingApplication).androidInjector.inject(viewModel) //Does not work super.onCreate(savedInstanceState) setContentView(binding.root) } fun registerDestroyLifecycleCallback(callback: ()-> Unit){ destroyCallbacks.add(callback) } protected inline fun <T : ViewBinding> AppCompatActivity.viewBinding( crossinline bindingInflater: (LayoutInflater) -> T) = lazy(LazyThreadSafetyMode.NONE) { bindingInflater.invoke(layoutInflater) } } 

    Any thoughts? Suggestions?

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

    How many old versions do you support?

    Posted: 25 Jan 2021 04:02 PM PST

    When it comes to older versions of apps, they quickly become a support burden. Especially if your application speaks to server API's, supporting old versions meaning keeping old API's online. I'm trying to figure out what people do in reality? I've noticed that modern Android versions aren't a problem as they mostly all auto-upgrade apps, but on older platforms people often don't update unless forced.

    Do you force upgrade?

    View Poll

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

    Music Licensing for your App, ASCAP, BMI, SESAC - has anyone done this?

    Posted: 25 Jan 2021 01:29 PM PST

    Hi all! I am trying to license music for our mobile application and have come across these three organizations that help with that. The prices seem relatively low, but was curious if anyone has gone through this process before and knows what it entails or has advice.

    This is a new process for me so your thoughts would be very helpful - Thanks!

    https://www.ascap.com/music-users/types/website-mobile-app-landing-page

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

    Best jetpack compse resources that helped you

    Posted: 25 Jan 2021 01:11 PM PST

    I want to start learning jetpack compose because, honestly xml can be a real shore.

    I want to learn it right though, want to know all the best practices and techniques to develop an app the right way using compose.

    Just curious which resources helped you guys the most and you feel provided you the most valuable information.

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

    Has anyone else here had to deal with permission declaration for background location when you don't actually use background location?

    Posted: 25 Jan 2021 12:48 PM PST

    Has anyone else here had to deal with permission declaration for background location when you don't actually use background location?

    I posted a little over a week ago that I got an email and a Play Store Console notification telling me that I might be using background location.

    After emailing with the Play Store support they assured me that there was nothing wrong with my app and I can continue as usual, but the item on Play Store Console still said that I have to submit that (it isn't like the news one where they'll just assume if you don't submit it).

    This is the Play Store notification

    So I went there and selected NO when asked if I use background location because I don't. And quickly after that I got an email saying that the update I made is rejected because of background location use. I have submitted an appeal but I'm not holding out much hope on that.

    I went ahead and used apktool to extract my AndroidManifest.xml just to make sure something else wasn't adding the background location and nothing is. I am using 29 as my target SDK.

    These are the permissions on my apk:

    <uses-permission android:name="android.permission.INTERNET"/><uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/><uses-permission android:name="android.permission.CHANGE_WIFI_STATE"/><uses-permission android:name="android.permission.CHANGE_WIFI_MULTICAST_STATE"/><uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/><uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/><uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT"/><uses-permission android:name="android.permission.READ_PHONE_STATE"/><uses-permission android:name="android.permission.WAKE_LOCK"/><uses-permission-sdk-23 android:name="android.permission.ACCESS_FINE_LOCATION"/><uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/><uses-permission android:name="com.google.android.finsky.permission.BIND_GET_INSTALL_REFERRER_SERVICE"/><uses-permission android:name="com.android.vending.BILLING"/><uses-feature android:name="android.hardware.screen.LANDSCAPE" android:required="false"/><uses-permission android:name="android.permission.FOREGROUND_SERVICE"/><uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/><uses-permission android:name="com.google.android.c2dm.permission.RECEIVE"/>

    Has anyone else had to deal with this?

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

    No comments:

    Post a Comment