• Breaking News

    Tuesday, June 1, 2021

    Android Dev - Weekly Questions Thread - June 01, 2021

    Android Dev - Weekly Questions Thread - June 01, 2021


    Weekly Questions Thread - June 01, 2021

    Posted: 01 Jun 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]

    Got suspended for a sdk i dont have?!

    Posted: 01 Jun 2021 07:22 AM PDT

    Google Play Developer Helpline has started rolling out. A step in the right direction to support android developers?

    Posted: 31 May 2021 09:42 PM PDT

    What is your step by step process when making your apps?

    Posted: 01 Jun 2021 12:53 PM PDT

    I am working on a new app and want to approach it systematically like a to-do list or backlog.

    Do you personally, work on a singular fragment or activity to near completion or do you set up all the views first?

    Take me step by step through your personal approach!

    Thanks!

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

    Introducing HiltBinder: An annotation processing library that automatically generates Dagger Hilt's @Binds methods.

    Posted: 01 Jun 2021 12:37 PM PDT

    image picker from gallery for Jetpack compose - Android/Kotlin

    Posted: 01 Jun 2021 04:55 PM PDT

    I want to implement an image picker using Jetpack compose I was searching for solutions and I found some tutorials like this one link I used the code they explained and it worked fine but I have a problem!

    My app includes one activity "MainActivity" which start rendering compose components, one of my screens is a form with a field to select an image, and other fields, when I used the code below it opens the gallery and I select an image and when clicking OK, it goes to the MainActivity, but I need instead to stay in the same screen of the form so user could continue completing the form, I will list the code and I hope someone could help me with this

    val launcher = rememberLauncherForActivityResult(contract = ActivityResultContracts.GetContent()) { uri: Uri? -> imageUri = uri } Column() { Button(onClick = { launcher.launch("image/*") }) { Text(text = "Pick image") } Spacer(modifier = Modifier.height(12.dp)) imageUri?.let { if (Build.VERSION.SDK_INT < 28) { bitmap.value = MediaStore.Images .Media.getBitmap(context.contentResolver,it) } else { val source = ImageDecoder .createSource(context.contentResolver,it) bitmap.value = ImageDecoder.decodeBitmap(source) } bitmap.value?.let { btm -> Image(bitmap = btm.asImageBitmap(), contentDescription =null, modifier = Modifier.size(400.dp)) } } } 

    - my MainAcrivity, I have a lot of nested screens but let's say that I have a button on main screen that go to form screen like below

    class MainActivity : ComponentActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContent { Button( onClick = { navController.navigate(AppScreens.FormScreen.route) }, ) { Text(text = "Go to form screen" ) } } } } 

    - and here is my form screen include many fields, like text, number, date and image fields

    @Composable fun FormScreen() { var imageUri by remember { mutableStateOf<Uri?>(null) } val context = LocalContext.current var bitmap by remember { mutableStateOf<Bitmap?>(null) } val launcher = rememberLauncherForActivityResult(contract = ActivityResultContracts.GetContent()) { uri: Uri? -> imageUri = uri } Column { // some text field in the form // another number field in the form // select image filed in the form CustomInputFieldContainer( label = "select image" ) { Box(contentAlignment = Alignment.Center, modifier = Modifier.fillMaxSize()) { Column(horizontalAlignment = Alignment.CenterHorizontally) { imageUri?.let { if (Build.VERSION.SDK_INT < 28) { bitmap = MediaStore.Images .Media.getBitmap(context.contentResolver,it) } else { val source = ImageDecoder .createSource(context.contentResolver,it) bitmap = ImageDecoder.decodeBitmap(source) } bitmap.let { btm -> Image(bitmap = btm.asImageBitmap(), contentDescription =null, modifier = Modifier.size(400.dp)) } } Button( onClick = { launcher.launch("image/*") }, contentPadding = PaddingValues(), modifier = Modifier.background(Color.Yellow) ) { Row( modifier = Modifier .fillMaxWidth() .wrapContentSize(Alignment.BottomCenter) .padding(vertical = 10.dp), verticalAlignment = Alignment.CenterVertically ) { Icon(imageVector = Icons.Filled.AddAPhoto, contentDescription = null) Spacer(modifier = Modifier.width(8.dp)) Text(text = "Add Photo") } } } } } } }` 

    now I want to select an image from the gallery when clicking on select image button and back to my form to complete the rest of the fields, when I tried the above code I could select an image but it goes to the main activity which makes me lost the data

    any help for solving this problem?

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

    Get notified for every app purchase

    Posted: 01 Jun 2021 04:55 PM PDT

    Has anyone figured out a way to get a notification (or text or email) for every app purchase?

    If I were to build this out, how much would you pay for this service?

    • A) $5/month
    • B) $20/month
    • C) $50/month or more
    submitted by /u/honnetatamae
    [link] [comments]

    Anyone know of a non convoluted way to impliment Play Billing 4 for standard Android Studio apps?

    Posted: 01 Jun 2021 03:40 PM PDT

    Been looking for tutorials everywhere and there just doesn't seem to be any good ones out there for some reason. Most tutorials are using third party solutions which obviously are going to be banned soon and (I might just be dumb) but google's official documentation is pretty incomplete and the example apps seem pretty convoluted. It's just weird it's made so complicated to do - I would have thought google would have wanted to make it easy to milk us for that 15% revenue. Like I don't understand why there isn't a clean and simple way to do it, seems like it should take a couple methods and lines of code but no. Especially weird with how easy it seems to be for Unity apps etc.

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

    Is "nobody" the name of an android dev tool/app?

    Posted: 01 Jun 2021 11:50 AM PDT

    I use Tracker Control to block app trackers and the like, but it can also show system apps that don't show up in the settings app. I spotted an entry today called "nobody" that didnt appear in settings that I find a slight bit suspect. However I've recently been using developer debug tools, specifically the debug bridge wireless tools, entries for daemon tools act similar to this suspect app. Does anyone here know if "nobody" is the name of an android developer tool/process for debug or if it's unrelated? Thanks.

    submitted by /u/Le-Dook
    [link] [comments]

    Simple Compose runtime mental model

    Posted: 01 Jun 2021 11:11 AM PDT

    Simple Compose runtime mental model

    I've made this simple mental model to help anyone understand the agnostic part of Jetpack compose which is compose runtime that helps you build tree-structures of any type.

    it summarizes/simplifies this excellent thread by Jorge Castillo, check it out for some implementation details.

    One example that uses concepts described here is: https://github.com/arunkumar9t2/compose-dot

    https://preview.redd.it/q9ke9hxo1p271.png?width=1176&format=png&auto=webp&s=baa4a676460d782e32a36da0faee1998e137c8ce

    submitted by /u/M-R-3-YY
    [link] [comments]

    Polestar now offers an emulator for developers making Android Automotive apps

    Posted: 01 Jun 2021 01:43 AM PDT

    App update rejected (again), seems to be anti-PWA prejudice

    Posted: 01 Jun 2021 06:02 AM PDT

    I wrote a free (and no-ads) web app here: https://flashmath.cards. Then I used PWABuilder (https://pwabuilder.com) to package this PWA as an android app (Trusted Web Activity) to release on the Play store. The app has been on the store just fine for about 3-4 months, and I've successfully released about a dozen updates to it over that time.

    Here's the Play Store link: https://play.google.com/store/apps/details?id=com.flashmathcards.twa

    About 6 weeks ago, I was notified out of the blue that my app was taken down. The reason I was given is that my app was in violation of this policy:

    About the Webviews and Affiliate Spam policy

    We don't allow apps whose primary purpose is to drive affiliate traffic to a website or provide a webview of a website without permission from the website owner or administrator.

    This is absurd, of course, since it's MY website that I've packaged as a PWA. I have the proper assetlinks deployed on the site that are linked in the app, proving that I own the site (and thus removing the URL bar from being displayed when the PWA launches).

    I submitted my assetlinks file and an explanation about it as appeal, and after more than a week waiting, they reversed their ban of my app. Of course, their system is so poorly designed that, to get my app back on the store, I had to create another update to the app to submit (which was basically nothing changed). Very annoying, and that update took another 3 days to be approved. It took another week or so for my app's listing in the play store to climb back up the search results, etc. All told, my app's distribution was down for more than 2.5 weeks!

    I was really frustrated, but I assumed this was some fluke and hoped it was the last I would face it.


    A couple of days ago, I submitted an update to my store listing (not a new app update) to add additional countries to distribution and tweak a few more bits of metadata. I waiting for the for that automated review to complete normally.

    This morning, I received a notice that this update was rejected, and it was for the SAME REASON as the previous app take-down!! Furthermore, they warn that my app might be taken down, so I'm worried that I'm about to go through this whole thing again.

    About Families Policy Requirements

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

    Version(s) App Bundle:570

    Eligibility Issue Webviews

    We don't allow apps whose primary purpose is to provide a webview of a website, regardless of ownership, or to aggregate content that does not belong to the developer. To resolve this issue, please remove violating content and resubmit your app.

    Notice the "regardless of ownership" part!?!? (emphasis mine) What!?

    Anyone have any idea how to solve this? Are PWAs just doomed because Play Store bots don't know what to do with them?


    BTW, PWABuilder is a service built by Microsoft, but sponsored by Google, and using Google's own Bubblewrap tool that builds the Android TWA package. Google likes and supports PWAs, right!? So how come app developers can't get a consistent treatment from Google?

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

    Android Salary Sharing Thread - 2021 Edition

    Posted: 31 May 2021 08:42 PM PDT

    Please share the salary you currently making. This will help job seekers negotiate or help those currently employed gauge their value.

    Please use the template below.

    • Location:
    • Years of Experience:
    • Title:
    • Salary:
    submitted by /u/csthrowaway00912
    [link] [comments]

    How to compile/run a project using sdk 8-15

    Posted: 01 Jun 2021 06:17 AM PDT

    Hey guys, I got handed a legacy project by our company that needs a few UI changes.

    I don't have a lot of time, so rewriting the project is not really possible. The project manifest uses minSdk=8 and targetSdk=15, and as such does not run on gradle.

    I have the project open in Android Studio 4.2, but I cannot compile it.

    Any help is greatly appreciated! Tutorials or otherwise

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

    Mobile CRM rejected for read_call_log permission

    Posted: 01 Jun 2021 02:20 AM PDT

    hey folks. I have a mobile CRM app for enterprises and small businesses. I recently updated my app to include call logs with the following functionality a)display call log entries with the app b)get call duration c)create call activities in the app d)create task,reminders notes for call entries e)save call entries as a lead in the app

    My app was rejected with the following error "Unable to verify core functionality of app When you submitted your app, you specified your app's core functionality as follows: Enterprise archive, enterprise CRM, and / or enterprise device management. However, we couldn't find evidence that the app offers the declared core functionality during our review. Please submit an updated Permissions Declaration Form that includes instructions on how to verify your declared functionality, and include details such as test account information. If portions of your app are restricted, please share a link to a video of your app to help us verify the core functionalities you've declared."

    I have trouble understanding why they would reject an app when they explicitly include it in the allowed use cases.can anybody help me plan my approach for approval?

    thanks

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

    Needed help for using X.509 Cert for wi-fi enterprise configuration.

    Posted: 01 Jun 2021 05:43 AM PDT

    For EAP-TLS configuration I require both ca-cert and user-cert.
    I have certificated installed in my phone but I cannot find a method by which I can use their installed names as alias or get those certs from user credentials and then while reading about WifiEnterpriseConfig class I came across setCaCertificate() method which requires X.509 cert as a parameter.
    Am not sure where and how to I get that certificate from.
    Thank you for the help.

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

    Open app with vocal command

    Posted: 01 Jun 2021 04:50 AM PDT

    Hi all! Is it possible to open an app with a vocal command?
    I develop apps using cordova or capacitor, but I can create a plugin or write native code.

    I would like to open an app saying an exact phrase.

    Thanks

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

    Ageism in Android?

    Posted: 31 May 2021 09:16 PM PDT

    As I grow older in tech, I'm curious about others thoughts/experiences on ageism in native development.

    Would it make sense to move away from Android development in mid 30s to help secure a stronger future in our careers?

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

    Installs after app update

    Posted: 01 Jun 2021 04:44 AM PDT

    Did you have that situation after app updated that installs really grow up? I had opposite experience. EVERY update no matter how cool/big/small changes it was, caused drops down of installs for few days. Also changes in descriptions etc always caused bad influence on installs. It is annoying because i really want to develop my app

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

    Root detection on modern Android (and other compromises)

    Posted: 01 Jun 2021 03:49 AM PDT

    Looking for some creative ways to identify a compromized Android environment. Since Android 9, the usual methods that discovered `su` binary in known places, or known installed `su` packages, or suspicious processes in **ps**, such as described in [this Meduim article](https://medium.com/@deekshithmoolyakavoor/root-detection-in-android-device-9144b7c2ae07) are void.

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

    How this is possible this game has 300+ reviews but only 1 install

    Posted: 01 Jun 2021 02:12 AM PDT

    This is the game link.

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

    Google billing

    Posted: 01 Jun 2021 01:39 AM PDT

    Hi I'm trying the subscriptions in Google billing it's shows offer purchases etc when downloading the app so my question is since there is no options on what to select does it just do it itself after the 4 days trial do you get notification that you now need to buy a sub or do I have to set some kind of activities ? Thanks

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

    Navigation of Category Ranking lists have been changed in Playstore this month

    Posted: 31 May 2021 09:54 PM PDT

    Navigation of Category Ranking lists have been changed in Playstore this month. They shifted the category rankings in Top Charts, where you will further add a filter of category within Top Charts. I liked the previous navigation far more helpful than this but google has to copy Apple even it's doing better.

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

    My thoughts and experience on edge to edge displaying apps. (as a comment)

    Posted: 31 May 2021 05:39 PM PDT

    No comments:

    Post a Comment