• Breaking News

    [Android][timeline][#f39c12]

    Wednesday, January 26, 2022

    Weekly Questions Thread - January 25, 2022 Android Dev

    Weekly Questions Thread - January 25, 2022 Android Dev


    Weekly Questions Thread - January 25, 2022

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

    Android Data Safety Form: SDKs documentation

    Posted: 26 Jan 2022 02:45 AM PST

    Saw a couple of posts recently around what to fill if you have some SDK in your mobile app like admob etc. Here is an active github project where I am maintaining the values you need to fill for various SDKs. Create an issue if there is some missing SDK.

    https://github.com/Privado-Inc/SDK-Privacy-Report

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

    Steep learning curve

    Posted: 26 Jan 2022 03:11 AM PST

    Is it just me or android is not very developer friendly? Usually when I study new things I start with the general idea and slowly go deeper just to get the full picture of how things are going. But I'm unable to do this with android, there are always ton of methods to override and hidden things working in background. Is working with android just about doing what has to be done without knowing what is really happening? Android docs wasn't helpful for me, I'm getting most of my information from youtube.

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

    Android Context - A Deep Dive!

    Posted: 26 Jan 2022 06:48 AM PST

    Anyone who uses Android Studio on Windows 11?

    Posted: 26 Jan 2022 08:03 AM PST

    I was wondering, is there anyone here who uses Android Studio on Windows 11? Apparently with Bumblebee Google still hasn't declared official support for it yet, so I am still using Windows 10.

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

    Android Studio Bumblebee (2021.1.1) Stable

    Posted: 25 Jan 2022 10:46 AM PST

    App not using any kind of obfuscation

    Posted: 26 Jan 2022 05:35 AM PST

    I'm currently working on a legacy app which has minify disabled. I tried to reverse engineering the store APK and it worked. Besides larger APK size, in your experience do you think it's dangerous having a marketplace app without any kind of obfuscation?

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

    While Google Maps navigation is going on, just pressing the power button shows the navigation without unlocking the phone. How are they doing this?

    Posted: 26 Jan 2022 09:13 AM PST

    Hi all,

    After I start navigation on Google Maps, if I lock the phone by pressing the power button and press the power button again, navigation shows up right away without having to unlock the phone. And while I'm on the navigation screen, if I swipe up from the bottom to go to the home screen, then the unlock screen shows up where I have to put in my PIN/Pattern.

    I'm trying to implement the same for the navigation feature in my app and was wondering how Google Maps is achieving this. I wasn't even sure what to search for so any leads will be very helpful.

    Thanks

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

    Cooperation request for sharing Android app data with foreign police

    Posted: 26 Jan 2022 08:03 AM PST

    Brace yourself, this is a strange one: I have published an Android app on the Play Store and maintain it in my spare time (personal project). Today, I have received an official request from a foreign police authority to share data with them on users involved in a crime. (Yes, it is indeed the a police force, I have done several checks...) It is an official request, although not a court order.

    Did this happen to anyone else? What should I do as the developer?

    I do not intend to cooperate, however they already pointed out that they will request the app to be blocked in such country if I do not. Besides, I am based in the EU and due to the GDPR, it is illegal for me to share information with third-parties if no local court order is provided. Furthermore, I do collect only non-identifiable data (Firebase Analytics) for statistical purposes, hence will not even have any data to provide.

    Just some background information: the app is a super banal app, not at all targeting to be used in crimes (lets compare it with using MS Word to note down revenues from crimes).

    Crazy times, crazy times. Didn't expect this to happen by developing apps in my spare time 😅

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

    how can I get an apk path from an android emulator?

    Posted: 26 Jan 2022 07:01 AM PST

    Navigation in Jetpack Compose using ViewModel state

    Posted: 26 Jan 2022 12:51 AM PST

    Have issues mentioned in popular libraries in Github affected your app's functionality & UX?

    Posted: 26 Jan 2022 05:57 AM PST

    We see many issues in GitHub for even popular libraries like Glide, Retrofit, okHttpClient etc. Have these issues caused your app's users unable to use important functionalities in the app or have negative effect on UX leading to client/customer dissatisfaction? If so how can companies/clients expect developers to make apps which works without any issues on any scenario?

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

    Room Migration

    Posted: 26 Jan 2022 05:28 AM PST

    please ... Does anyone know how to run migrations of room tables ... what i want to do specifically is to change the ID of the table

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

    What's new in Android Studio Bumblebee

    Posted: 25 Jan 2022 10:43 AM PST

    I need to make a text based game that can run on android, pronto

    Posted: 26 Jan 2022 03:20 AM PST

    Hi, I've decided to surprise my wife with a text based game for her birthday. I usually hide her gifts and try to come with new ways to give her clues to find them, she loves that shit.

    Now the problem is that I have only about 15 hours (At most probably less) available to learn the "engine" and make the game. And it should run on an android phone (It doesn't matter if as an android app or a web app that works on android).

    The game won't be very complicated, logic wise. Just about 10 navigable rooms and the ability to come back and forth between them, I don't know how pure text based games work so I guess having some buttons for navigation will be best.

    I've made unity games for her before (2D simple platformers or pongs and the like) but never tried a text based game before and my unity is kind of rusty right now. I don't know how much hours I need to invest before I start seeing progress on that engine.

    It should be free or have the basic functions for free.

    Edit: I'm going for Twine

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

    Your Deep Links Might Be Broken: Web Intents and Android 12

    Posted: 25 Jan 2022 11:11 AM PST

    Does DiffUtil work to update an item whose value has been changed?

    Posted: 25 Jan 2022 08:02 PM PST

    Hello, i recently changed the way my recycler view works from using the normal recycler view adapter and calling notifydatasetchanged to using ListAdapter and DiffUtil to notify data changes, which is more efficient.

    This approach works great whenever i add or remove an item to my list, and the list updates correctly, however it does not update the list when i change the text of one of the existing items. Am i implementing diff util in a wrong way? Or is that just how it is?

    Adapter class

    object DiffCallback : DiffUtil.ItemCallback<Task>() { override fun areItemsTheSame(oldItem: Task, newItem: Task): Boolean { return oldItem.id == newItem.id } override fun areContentsTheSame(oldItem: Task, newItem: Task): Boolean { return oldItem.text == newItem.text } } class Adapter( private val viewModel: ViewModel, private val childFragmentManager: FragmentManager ) : ListAdapter<Task, Adapter.ViewHolder>(DiffCallback) { class ViewHolder(view: View) : RecyclerView.ViewHolder(view) { val itemTitle: TextView = view.findViewById(R.id.recycler_view_title) val itemDescription: TextView = view.findViewById(R.id.recycler_view_description) val itemLayout: ConstraintLayout = view.findViewById(R.id.item_layout) val buttonOptions: Button = view.findViewById(R.id.button_options) } override fun submitList(list: MutableList<Task>?) { super.submitList(list?.let { ArrayList(it) }) } //ges task list size //creates the layout for each list item override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder { val layout = LayoutInflater.from(parent.context).inflate(R.layout.item, parent, false) return ViewHolder(layout) } // binds data to each list item override fun onBindViewHolder(holder: ViewHolder, position: Int) { val task = viewModel.tasks.value!![position] holder.itemTitle.text = task.text holder.itemDescription.text = task.description holder.buttonOptions.setOnClickListener { onMenuClick(position, holder, task) } } 
    submitted by /u/Axeloe
    [link] [comments]

    I can't get my webview to record audio

    Posted: 25 Jan 2022 11:01 PM PST

    Good day. I have spent about a week on trying to figure out how to get my webview to record audio

    I included the following in my Manifest

    <uses-feature android:name="android.hardware.audio.pro"android:required="true"/><uses-feature android:name="android.hardware.microphone"android:required="true"/><uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" /><uses-permission android:name="android.permission.RECORD_AUDIO" />

    When looking at logcat it doesn't seem that the webview even realizes that the website is trying to record. Requests for permissions:

    // Check for permissions

    hasPermissions(MainActivity.this, permissions);

    if (!hasPermissions(MainActivity.this, permissions)) {ActivityCompat.requestPermissions(MainActivity.this, permissions, 1);} else {Toast.makeText(MainActivity.this, "All Permissions Granted", Toast.LENGTH_SHORT).show();}

    private boolean hasPermissions(Context context, String... permissions) {if (context != null && permissions != null) {for (String permission : permissions) {if (ActivityCompat.checkSelfPermission(context, permission) != PackageManager.PERMISSION_GRANTED) {return false;}}}return true;}u/Overridepublic void onRequestPermissionsResult(int requestCode, u/NonNull String[] permissions, u/NonNull int[] grantResults) {super.onRequestPermissionsResult(requestCode, permissions, grantResults);}

    Any help would be appreciated

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

    I want to create a fully-functioning instagram clone. Where do I begin?

    Posted: 25 Jan 2022 10:48 PM PST

    Currently only know very basic Python, but willing to invest a lot of time and effort into completing this project. I would really appreciate some advice and a jumping point for where to begin. Thanks!

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

    I'm a new developer I hava a quick question....

    Posted: 25 Jan 2022 12:05 PM PST

    I'm going to do a simple crypto-money application, and I have a question because I'm new to these things. After I have taken stock exchange data with API, I intend to do the rest of the visualization with UI design. What I'm wondering is, do I have to encode every image designed in UI? I want to put crypto-money images next to the crypto data, so I have to take all the images and encode them?

    In short: Were the beautifully designed applications we saw in these app stores done with drawable or encoded individually?

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

    How to show launch PDF from URL in default PDF app on Android 12?

    Posted: 25 Jan 2022 04:51 PM PST

    We used to be able to launch an Intent pointing to a pdf and let Android decide what application to open that with. That was as simple as:

    val urlStr = "https://www.gstatic.com/policies/terms/pdf/20220105/it7r24p9/google_terms_of_service_en.pdf" val intent = Intent(Intent.ACTION_VIEW, Uri.parse(urlStr)) try { startActivity(Intent.createChooser(intent, "PDF")) } catch (e: Exception) { e.printStackTrace() } 

    On previous Android versions the above would show a chooser to open the link with any installed PDF viewer app and the user can decide which one to open it with. Without the chooser, it would just automatically open in the approved application for this type. Most pdf viewers would handle the mime type "application/pdf" or register to handle "*.pdf" files, so they'd appear as the obvious choice.

    With Android 12 the web intent resolution has changed:

    Starting in Android 12 (API level 31), a generic web intent resolves to an activity in your app only if your app is approved for the specific domain contained in that web intent.

    Now this obviously does not work, because Android sees this as a web intent (because it starts with https) and not as a file (ending with *.pdf), and of course no pdf viewer is approved for the specific domain. So as a result, now this always starts Chrome and it does not show a chooser any more. Chrome asks to download the pdf file, because Chrome for some reason does not know how to render pdf files (how ridiculous, rather than open it in the app that is designed to handle pdf it is opened in the app that is explicitly not designed to handle pdf). Not that adding the mime type application/pdf to the intent causes no intent to be resolved and the intent launch fails. I wasn't able to form an Intent that would target a pdf app if the uri is a web uri.

    I found two silly workarounds:

    • [reimplement chooser] I can query activities for the intent myself and add a queries block to the Manifest to search for available pdf handlers myself. I can then attempt to build my own chooser and launch the activity directly, passing it the https:// URL.
    • [proxy the file through my app] I can download the file to storage, pass it to my FileProvider and launch an intent exactly as the above. Because the scheme is now content:// and not https:// the Android chooser shows again and the pdf app is launched, which will then "download" the file from my content provider.I thought about writing a ContentProvider that will just proxy to a web url, so that I can pass content:// Uris to the pdf app but I wouldn't have to store and own the pdf in my app. But that seems dumb and risky, and I don't want to be that lazy.
    • [reimplement pdf viewer] Try to pull in 20 dependencies to render the pdf within my app.

    My expectation is very simple:

    1. I have a pdf stored on a remote server
    2. I want the default/best/preferred/any pdf app to be launched that can download and show pdf documents.
    3. If no pdf app is installed, the fallback choice seems to be a web browser. This may then download or show the pdf.
    4. Ideally the user is presented a chooser.

    Is there a way to achieve this on Android 12 without reimplementing the wheel? Or is my use-case undesirable for security reasons?

    I'm a bit confused as it seems the "Default App" concept is broken now for any web urls and how this is improving security for users if this comes from an app. I understand that maybe a browser shouldn't just launch apps left right and centre, but when coming from an app I don't understand why there is a difference between https:// and file:// and content://.

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

    Butterfly - Helps you to build adaptive and responsive UIs for Android with Jetpack WindowManager.

    Posted: 25 Jan 2022 04:12 AM PST

    Bank Google Play Store App Reviews

    Posted: 25 Jan 2022 02:07 PM PST

    Looking to increase positive reviews for a client who is a bank. Besides having an app prompt to encourage users to leave a review - anyone have any other strategies? Not sure how all of these larger institutions are able to have such a consistent high influx of positive reviews… many seem like they leverage bots. TIA!

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

    Where do some people/programmers find an API for an app?

    Posted: 25 Jan 2022 05:15 AM PST

    For example there are many apps that show the Google play apps that are currently free or price has dropped. This is one examples, where the API is not public but some people have access to it. Where do they find it? Or do they pay for it?

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

    No comments:

    Post a Comment

    Fashion

    Beauty

    Travel