• Breaking News

    [Android][timeline][#f39c12]

    Tuesday, July 13, 2021

    Weekly Questions Thread - July 13, 2021 Android Dev

    Weekly Questions Thread - July 13, 2021 Android Dev


    Weekly Questions Thread - July 13, 2021

    Posted: 13 Jul 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]

    Recent versions of IntelliJ/AndroidStudio changed how "Search Everywhere" results are displayed; here's how to change it back

    Posted: 13 Jul 2021 10:50 AM PDT

    Heavy users of the shift-shift "Search Everywhere" popup may have noticed that results are displayed differently in recent AS versions. If you're like me and don't want to change years of muscle memory, you can revert to the old style via:

    1. Open the "Search Everywhere" popup
    2. Search for Experimental features...
    3. Un-check the item for search.everywhere.mixed.results
    submitted by /u/thevoiceless
    [link] [comments]

    Using ProGuard with AGP 7 - The ProGuard Gradle plugin

    Posted: 13 Jul 2021 06:09 AM PDT

    With the upcoming release of AGP 7, ProGuard needs a new way of integrating into Android projects. Therefore, as part of the latest ProGuard 7.1 release, we developed a Gradle plugin for ProGuard. With this plugin ProGuard integrates into your existing gradle process, so that you can keep using ProGuard with AGP 7. You can find the plugin in the ProGuard GitHub repository.

    We wrote a short blog post with some more details on how to obtain the plugin and how to use it in your Android project. https://www.guardsquare.com/blog/using-proguard-with-the-android-gradle-plugin

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

    RecyclerView getting way too complex! ♻️����

    Posted: 13 Jul 2021 10:33 AM PDT

    Hello everyone!

    So, I don't know if any of you has ever gone through the same situation but I've recently taken over an app and we have this RecyclerView on the main screen - because of an NDA I'll change a few things - that shows a list of apartments that you can rent - picture the AirBnB app - and if you tap on one of these apartment items you go to the apartment detail, where you have a bit more of functionality and features.

    The thing is that we have way too many moving parts on the apartment list. For example, on each apartment ViewHolder you can:

    - Use a checkmark to specify if you are going to bring any pets with you.

    - A few UI items to specify how long are you going to stay.

    - An EditText to set how may people are going to come.

    - A Rent button that turns itself into a spinner and sends an API call.

    - A More Options button that expands the ViewHolder, showing a LinearLayout with yet more UI.

    Picture something like this

    This is actually a simpler example of what I really have. Let me tell you that it looks as if each ViewHolder could be a Fragment because of all the functionality that we have on each.

    Now what's the problem here?

    Recycling issues. If you scroll off, and scroll back to the same position you are supposed to keep the same state that you had on that ViewHolder, right? If you had checked a CheckButton that's supposed to be check. If you had written something on an EditText, that's supposed to be there. If you had expanded the More Options section, that's supposed to be expanded. You see where I'm going at?

    What am I asking here?

    Well, about feedback for a possible solution or improvement. I know what most of you would tell me here - because it is the same thing I thought at first - just move all that functionality into the apartment detail, keep that list as simple as possible. But it is not as simple, we have a large user base who is already used to this UI. Changing things so abruptly is not an option.

    What do I have right now?

    In my RecyclerView adapter I keep a collection of "State" objects which I use to save/restore the ViewHolder states, but it is getting way too big and way too complex. This may sound crazy, but it is there such thing as having a RecyclerList of Fragments? I just don't want to worry/bother about keeping the states of these ViewHolder anymore.

    Any feedback is appreciated,

    Thanks!

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

    Samsung detected as game app

    Posted: 13 Jul 2021 03:47 AM PDT

    Samsung phones are detecting my app as a game app when we handle video hosting only. There's nothing in our app that i can think of which relates to being a game. On samsung the game icon comes up and it allows the user to take screenshot and other game settings. The problem comes when it constantly locks the screen while watching videos to annoy users.

    Do i need to reach out to Samsung on this one or is there something i can put into the app to resolve this?

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

    Is AdMob Mediation worth the setup trouble?

    Posted: 13 Jul 2021 10:31 AM PDT

    Hello everyone I am using AdMob for my apps and thinking about using Mediation.But is it actually worth the trouble of setting it up. Let's say i am earning $1000 monthly what would that number realistically will be if i integrate big names like Mopub,Fan,Applovin,Unity Ads. What was your experience like?

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

    Appium Tutorial for Beginners

    Posted: 13 Jul 2021 12:37 AM PDT

    How to access a field in a nested json response with retrofit

    Posted: 13 Jul 2021 03:41 PM PDT

    Hello, I'm using retrofit to parse a json response but I'm not sure how to access a field in the nested response. The response has a "results" field that leads to other fields (many, depending on the query, but I limited it to 10 in my case), that have their own nested fields I want to access, image_url in particular (this is the api: https://api.jikan.moe/v3/search/anime?q=free).

    I have written these classes to handle the response: ``` data class AnimeResponse( @SerializedName("results") val results: List<AnimeResultsResponse> )

    data class AnimeResultsResponse( @SerializedName("mal_id") var mal_id: String, @SerializedName("url") var url: String, @SerializedName("image_url") var image_url: String, @SerializedName("title") var title: String, @SerializedName("airing") var airing: Boolean, @SerializedName("synopsis") var synopsis: String, @SerializedName("type") var type: String, @SerializedName("episodes") var episodes: Int, @SerializedName("score") var score: Float, @SerializedName("start_date") var start_date: String, @SerializedName("end_date") var end_date: String, @SerializedName("member") var member: Int, @SerializedName("rated") var rated: String ) ``` The results field does lead to a list but the list then has these dictionaries so I'm confused as to how to deal with it, any advices on that would be appreciated.

    Then I manage the get request in another file: interface APIService { @GET suspend fun getAnimeByCategory(@Url url:String):Response<AnimeResponse> } And this is how I'm supposed to get the response to show with retrofit and a coroutine: ``` private fun getRetrofit():Retrofit{ return Retrofit.Builder() .baseUrl("https://api.jikan.moe/v3/search/anime?q=") .addConverterFactory(GsonConverterFactory.create()) .build() }

    private fun searchByName(query:String){ CoroutineScope(Dispatchers.IO).launch { val call = getRetrofit().create(APIService::class.java).getAnimeByCategory("$query&limit=10") val anime = call.body() runOnUiThread{ if(call.isSuccessful) { val images = anime?.results?.image_url ?: emptyList() animeImages.clear() animeImages.addAll(images) adapter.notifyDataSetChanged() }else{ showError() } } hideKeyboard() } } The problem is this line: val images = anime?.results?.image_url ?: emptyList() ``` I'm not sure how to get to "image_url", which is inside of the "results" field in the response and this way does not work. How can I access it?

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

    Background Service using Bluetooth LE requires background location permission. Anyway to get around it from a calling app using PendingIntent (or otherway)

    Posted: 13 Jul 2021 11:40 AM PDT

    Hi All.

    I have a service that runs in the background, and allows any app to bind to it, and use AIDL to perform 2 way communication. The service connects to a BLE device.

    This requires in the current implementation and SDK 30, the ACCESS_BACKGROUND_LOCATION permission, which creates a bit of a bad UX as this has to be granted from the settings.

    I would like to use the calling app's permissions, and from what I gathered, a pending intent allows that, but I don't see a way to bind in this manner.

    Anyone has any ideas on how to work around that? Is there a better approach to solve this issue?

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

    Help me understand why Google has suspended my app.

    Posted: 13 Jul 2021 04:29 AM PDT

    i have an app named Teleteens, it's a Telegram app for kids. you can download the apk here:

    teleteens.co

    this is the original URL:

    https://play.google.com/store/apps/details?id=ori.telegram.app

    TLDR:

    1. an 100% policy ok app in google play was suspended because a draft version of this app that was made 8 months ago and wasn't even released to production had an SDK that might allow self-update.
    2. after an appeal and waiting 18 days, google has accepted the appeal and requested draft version to be discarded. and for a new version to be updated to google play.
    3. 2 hours after the new version was up in google play. the app was suspended again. and for the same reason as (1.)
    4. after an appeal and waiting 12 days, google has said that app will remain suspended because one ''internal test'' of the app is having the same issue as (1.)
    5. the problem in (4.) is: i never did any internal testing in my life. so i have no clue what the hell google wants from me.

    longer version:

    this app is now suspended for no good reason. here is the original email:

    Your app contains content that doesn't comply with the Device and Network Abuse policy. We found your app is using a non-compliant version of Microsoft Appcenter SDK which contains code to download or install applications from unknown sources outside of Google Play.

    If necessary, you can consult your SDK provider(s) for further information.

    Affected Version(s):

    App Bundle:1964

    About the Device and Network Abuse policy

    An app distributed via Google Play may not modify, replace, or update itself using any method other than Google Play's update mechanism. Likewise, an app may not download executable code (e.g. dex, JAR, .so files) from a source other than Google Play. Please note that you are responsible for all aspects of your app; by using an SDK in your app, you are responsible for how that SDK behaves within your app.

    Publishing Status

    App status: Suspended

    Your app has been suspended and removed due to this policy issue.

    in that time they have suspended it, the app bundle in the store was 2266. and this bundle didn't even have this bad Microsoft SDK in the first place, so google has suspended me over something that was already solved a long time ago - 8 months ago.

    what google has told me was basically this: ''you have updated your app 80 times in the last year, from version 1 to version 80."

    " remember version number 20 ? remember that it had some bad sdk in it ? well, we are going to ban version number 80, that doesn't have this problem whatsoever and is currently live in google play store. just because 8 months ago you had one version with some sdk issue"

    i also want to point out, that the version in question wasn't even released to google play store.. it was a draft version...

    so i have made an appeal, that says this:

    my app uses the source code of Telegram app:

    https://play.google.com/store/apps/details?id=org.telegram.messenger

    so if Telegram app uses some SDK, i also use this SDK, which mean that if you block Teleteens, you should also block Telegram.

    also, Teleteens is merely accessing the servers of the Telegram company (the owner of the Telegram app), and is not involved at any content there. and i see you didn't block Telegram, which mean Telegram is ok for you, which means that everything in Teleteens should be ok for you as well.

    i also don't understand why you suspend my app so quickly before you even let me have a chance to defend myself and explain why any sdk exist in the first place, this is too harsh.

    so if you think there is an issue, at least open my app for download, and let's continue have a discussion about it.

    after 18 (!) days of waiting, google has accepted my appeal, with this message:

    Hi Developer

    Thanks for contacting the Google Play team.

    Status: App not available on Google Play, pending your action

    I'm happy to report that we have conditionally accepted your appeal. I've included details below about what additional steps you'll need to take to get your app back on Google Play.

    Step 1: Update your app

    During review, we found that your app, (ori.telegram.app), (APK Version Code: 1964), violates the Device and Network Abuse policy:

    * An app distributed via Google Play may not modify, replace, or update itself using any method other than Google Play's update mechanism. Likewise, an app may not

    download executable code (e.g. dex, JAR, .so files) from a source other than Google Play. Please note that you are responsible for all aspects of your app; by using an SDK in your app, you are responsible for how that SDK behaves within your app.

    * Apps and app listings on Google Play must not provide any means to activate or access functionality that violate these terms, such as linking to a non-compliant APK hosted outside Google Play.

    You can read through the Device and Network Abuse policy page for more details and examples of common violations.

    For example, we found your app is using a non-compliant version of MSFT AppCenter SDK which contains code to download or install applications from unknown sources outside of Google Play.

    Please update your app to fix this issue by removing the MSFT AppCenter SDK or contact SDK provider for the latest compliant version.

    You may also want to double check that your app complies with all other Developer Program Policies, as additional enforcement could occur if there are further policy violations.

    Step 2: Submit an update to your app

    To submit an update to your app's store listing information:

    1- Sign in to your Play Console.

    2- Select the app with the policy issue.

    3- Select Store presence > Main store listing.

    4- Make changes to bring your app into compliance.

    5- Click Save.

    To submit an updated app bundle or APK:

    1- Prepare your updates.

    2- Create a new release using the compliant app bundle or APK. Be sure to create the new release on the same track(s) as the non-compliant app bundle or APK, increment the version number, and set the release to 100% rollout.

    3- Follow the on-screen instructions to add APKs or app bundles, then review and roll out your release.

    If addressing the issue does not require a metadata or APK update and the submit button is grayed out, you can make a minor change to your store listing to activate the button. For example, add a space after your app title and then delete it. Once the button turns blue, you can submit your update.

    Please follow the given steps to deactivate non-compliant app bundles or APK, (APK Version Code: 1964):

    1- Go to your Play Console.

    2- Select the app.

    3- Go to App bundle explorer.

    4- Select the non-compliant APK/app bundle's App version at the top right dropdown menu, and make a note of which releases they are under.

    5- Go to the track with the policy issue. It will be one of these 4 pages: Internal / Closed / Open testing or Production.

    6- Near the top right of the page, click Create new release. (You may need to click Manage track first)

    * If the release with the violating APK is in a draft state, discard the release.

    7- Add the policy compliant version of app bundles or APKs.

    * Make sure the non-compliant version of app bundles or APKs is under the Not included section of this release. For further guidance, please see the "Not included (app bundles and APKs)" section in this Play Console Help article.

    8- To save any changes you make to your release, select Save.

    9- When you've finished preparing your release, select Review release.

    If the non-compliant APK is released to multiple tracks, repeat steps 5-9 in each track.

    in short , google told me: "ok, we accept your appeal, so please do the following: 1. update the app with a newer version, 2. remove the non compliance version from google as we instruct you to"

    so i did excactly what they have asked. and discarded the bad version as they have instructed me.

    after i uploaded a new version to google play, google play has approved my app, and the app was up in google play for 2 hours, until it was suspended, AGAIN. for the same reason:

    Issue with your app

    Your app contains content that doesn't comply with the Device and Network Abuse policy.

    We found your app is using a non-compliant version of Microsoft Appcenter SDK which contains code to download or install applications from unknown sources outside of Google Play.

    If necessary, you can consult your SDK provider(s) for further information.

    Affected Version(s):

    App Bundle:1964

    About the Device and Network Abuse policy

    An app distributed via Google Play may not modify, replace, or update itself using any method other than Google Play's update mechanism. Likewise, an app may not download executable code (e.g. dex, JAR, .so files) from a source other than Google Play. Please note that you are responsible for all aspects of your app; by using an SDK in your app, you are responsible for how that SDK behaves within your app.

    App status: Suspended

    Your app has been suspended and removed due to this policy issue.

    so google has basically banned me again for the original reason. even after i did everything they asked.

    so i filed another appeal again:

    1- you have suspended the app because of the 1964 bundle at the date 6.6.21. so i have filed an appeal immediately.

    2- at the date 24.6.21 (after 18 days of waiting), you have accepted my appeal and made the app status ''removed'' instead of ''suspended'' . you have also requested me to do the following in order to approve the app:

    A. release a new update that follow policy.

    B. discard the draft release with 1964 bundle. (deactivate the non-compliance version)

    1. i have done as you have asked: i discarded the draft release with 1964 bundle, and i have also released a new update at the date 30.6.21.

    2. you have approved the new update i have released at 30.6.21, and the app was up in Google play for 2 hours - only to be suspended again, for the original reason: because of the 1964 bundle ... but i already fixed the problem as you have asked me to do... so why do you suspend the app...

    so now i am filing an appeal again... i feel like i am in an endless loop... please help.

    i have been waiting for 12 (!) days for this appeal to get answered, and they have replied with the following:

    Hi developers at TossACoinToYourDeveloper,

    Thank you for your patience.

    Due to adjusted work schedules at this time, we are currently experiencing longer than usual process times and we appreciate your understanding.

    Status of app Teleteens (ori.telegram.app): Suspended from Google Play due to policy violation

    I've reviewed your appeal request and found that your app still violates Google Play Policy.

    During review, we found that your app "Internal Testing Version code #1964" violates the Device and Network Abuse policy:

    * An app distributed via Google Play may not modify, replace, or update itself using any method other than Google Play's update mechanism. Likewise, an app may not download executable code (e.g. dex, JAR, .so files) from a source other than Google Play. Please note that you are responsible for all aspects of your app; by using an SDK in your app, you are responsible for how that SDK behaves within your app.

    * Apps and app listings on Google Play must not provide any means to activate or access functionality that violate these terms, such as linking to a non-compliant APK hosted outside Google Play.

    You can read through the Device and Network Abuse policy page for more details and examples of common violations.

    For example, we found your app "Internal Testing Version code #1964" is using a non-compliant version of MSFT AppCenter SDK which contains code to download or install applications from unknown sources outside of Google Play. You may refer to the notification email for the specific version code.

    If your developer credentials are still in good standing with Google Play and if your app allows for it, you can publish a new compliant version of the app by following these steps:

    1- Make the necessary changes to your app to address the issue described above, if possible.

    2- Double check that your app complies with all other Developer Program Policies. Additional enforcement could occur if there are further policy violations.

    3- Sign in to your Play Console and upload a new app using a new package name and a new app name.

    Please let me know if you have any other questions. Thanks for your continued support of Google Play.

    Regards,

    Mika

    The Google Play Team

    Please visit the Google Play Developer Policy Center and Google Play's Academy for App Success to learn more about building policy compliant and high quality apps. You can also visit the Android Developers Blog for the latest Android and Google Play news for app and game developers.

    so what google said: well, your internal test version is still having non-compliance issues. so the app should remain suspended.

    there is only one small problem: i never did any internal tests, ever never.

    all my apps for testing was distributed using firebase app named app tester, and i never used google play to do any internal testing, i am 1000% confident of it. never ever did it.

    so what the hell this google support is taking about ? i have no clue.

    anyone can help here ?

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

    FAN : No more Chance to appeal Ad bundle. What should I do now? Can I create new Ad Bundle in same FAN account ?

    Posted: 13 Jul 2021 02:46 PM PDT

    Does using keep alive, Foreground Services, irremovable notification harm the device, if you keep it on constantly?

    Posted: 13 Jul 2021 10:33 AM PDT

    I'm building an app for personal use, it requires the keep alive feature, to keep functioning and I'm planning on to run the app 24/7 on my android device.

    Will it ruin my device's hardware?

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

    Can some one tell me a simple way to compress a video in Android Java?

    Posted: 13 Jul 2021 02:13 PM PDT

    Hey guys, I don't know if this is the place to ask, if its not I apologize then. I am new to Android, I usually code iOS, I have been trying to find a way to compress a video for the last 2 days. The only thing that worked for me was SiliCompressor but the quality was garbage, no audio, video was deformed. Other libraries don't have clear documentations and I have not learned android very well yet. Can someone please gide me to a solution? Thank you for your help in advance.

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

    Why in some case do we use <tag content/> and in some cases we use <tag>content<tag/>

    Posted: 13 Jul 2021 02:03 PM PDT

    Coming from web development for every <tag> there should be a closing <tag/>. May you please elaborate to me when to use which syntax.

    Examples


    • Case 1
      <TextView
      android:text="Hello World"
      >

    • Case 2
      <RelativeLayout>
      content
      <RelativeLayout/>
    submitted by /u/he_Said_On_Reddit
    [link] [comments]

    Kotlin Features Survey Webinar

    Posted: 13 Jul 2021 08:47 AM PDT

    High Frame Rate Development? Which Phones Compatible?

    Posted: 13 Jul 2021 10:00 AM PDT

    I am working on a simple app that will remotely trigger the start/stop of slow motion recording (240fps at 720 or 1080p).

    I'm using a Samsung Galaxy S9 as a testing device. All attempts have been thwarted, apparently because the manufacturer doesn't provide access to slow motion via anything other than the native Samsung camera app.

    Couple questions:

    1. Is there any way to get around this? All I want to do is start/stop slow motion recording remotely. In my current testing, any FPS setting used starts/stops as suspected, but only records 30fps.
    2. Is there another phone that hasn't blocked access to slow motion recording?
    3. If this cannot be done via programming, can I somehow trigger the start/stop of the native Samsung camera app? Maybe with Accessibility > Interaction and dexterity controls?

    Thanks for any suggestions you can offer!

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

    Android Game Development Extension for Visual Studio

    Posted: 12 Jul 2021 10:32 PM PDT

    Experience with bug bounty programs

    Posted: 13 Jul 2021 02:47 AM PDT

    I'm thinking of using some bug bounty type of services to speed up bugfixes and adding new features to my open source apps, anyone has experience with it? I mean services like https://www.bountysource.com/ , https://gitpay.me/ or https://issuehunt.io/

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

    Developing single app for different features for each countries?

    Posted: 13 Jul 2021 03:28 AM PDT

    Hi,

    I'm working on a Fintech app. Right now, app is developed for a single country with requirements & features unique to that country. Now the business is expanding to different countries. For each country, business offers different features that are unique to that country only, meaning app will have different unique features with its own backend & everything for each country. But business requirement is to have a single app on the playstore. A single app will be used for different countries. User will download a single app and will be able to use different features according to his/her country of choice.

    Right now, we have 8-10 modules in our app. But now, as we'll add more and more modulus for each different country, we'll have a lot more modules.

    We're considering using SuperApp concept to meet this requirement.

    But I want to know what is the best approach to meet this requirement?

    What are the things that we should watch out for that can cause problem for us in future?

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

    Why opening the android emulator gives my computer a stroke?

    Posted: 13 Jul 2021 05:13 AM PDT

    I've been using it for last 5 years, used in both windows and macOS high and computers, but always, whenever I turn it on, music stops playing in computer, sometimes macOS disables night mode and turns it back on again, why is that? I know it's a bit heavy, but it affects my speakers is odd

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

    Has there been any recent developer happiness polls on the ease of developing apps on Android compared to iOS?

    Posted: 13 Jul 2021 12:45 AM PDT

    Has there been any recent developer happiness polls of developing apps on Android compared to iOS?

    Or any recent user happiness polls of apps? Or the percentage of apps that has Landscape Mode?

    "A Basic Landscape Mode Should Be Required for All Droid" - https://www.reddit.com/r/Android/comments/oi6grp/a_basic_landscape_mode_should_be_required_for_all/

    Also why would Apple reduce profit cut first before Google? Is there a yearly and comprehensive summary anywhere of Droid dev vs iOS dev? https://www.reddit.com/r/androiddev/comments/jwdv29/apple_will_reduce_app_store_cut_to_15_percent_for/

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

    Finding the right community

    Posted: 13 Jul 2021 03:11 AM PDT

    Dear androiddev community,

    where can I find a community to post about app development and programming related questions ? I asked a programming specific question on Stack Overflow. Where can I find a community to ask questions related to problems that revolve around similar questions?

    https://stackoverflow.com/questions/68345786/rotating-tilebitmap-based-on-its-direction

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

    No comments:

    Post a Comment

    Fashion

    Beauty

    Travel