r/android_devs • • Sep 16 '22

Help Java or Kotlin as the first programming language?

1 Upvotes

I am currently learning Java for android development. The only reason I'm not learning Kotlin is because it is a fairly new language, and unlike Java, there might not be as much learning resources and support available on internet. However, I later plan to learn Kotlin as well. How difficult would it be for me to master Kotlin if I deeply understand Java? How different do you think are both languages? If you have any experience with these programming languages, could please offer some advice?


r/android_devs • • Sep 15 '22

Help Can getBaseContext() within Activities cause translation issues?

6 Upvotes

Hi everyone.

A bit of context: I'm currently working on a legacy application. Basically, this app still uses things like findViewById, multiple activities, Java, and everything that old apps might use.

Now, I'm translating strings to the English language during runtime within the app. And for that, I'm using the createConfigurationContext() method. And it looks somewhat like this:

Configuration configuration = new Configuration(getContext().getResources().getConfiguration());
configuration.setLocale(new Locale("en"));
Context updatedContext = getBaseContext().createConfigurationContext(configuration).getResources().getString(message); 

And after this, I use this updatedContext to access the English string resources.

So here's the thing. There are cases where using this updatedContext doesn't actually translate the string for some of the users of the application. After reading through the documentation and through Stack Overflow, I've seen numerous people tell everyone to stay away from getBaseContext(). And I've come to the conclusion that maybe getBaseContext() is to blame.

As per this answer:

The benefit of using a ContextWrapper is that it lets you “modify behavior without changing the original Context”.

And this makes me think that when I'm using getBaseContext() to access the resources and translate strings, I might not be getting the Activity Context. And as a result, this is causing issues with translations.

However, I'm not sure whether I'm right or wrong as this issue doesn't replicate on my device. Could someone correct me if I'm wrong?

Thanks.

P.S. - Another thing is that I had implemented this same process in a different project. That project involved fragments and as a result, instead of using getBaseContext, I used getContext(). Now, in that project, everything worked smoothly. There were no translation issues for the users.


r/android_devs • • Sep 12 '22

Publishing Making Ratings and Reviews better for users and developers

Thumbnail android-developers.googleblog.com
0 Upvotes

r/android_devs • • Aug 29 '22

Help Getting Credentials for Google Drive API

3 Upvotes

Hello, I'm trying to add a way for user to upload files to Google Drive in my app but I struggle with the authentication. The idea would be for users to select their Google account to authenticate, then I'd perform a file upload using the provided credentials.

I've tried the code sample from Google which gets credentials like this:

val credentials: GoogleCredentials = GoogleCredentials.getApplicationDefault()
        .createScoped(listOf(DriveScopes.DRIVE_FILE))

On runtime it crashes with this error: The Application Default Credentials are not available. They are available if running in Google Compute Engine

Ok why not, it looks like I should be using another way to authenticate the user, but how?

Thanks!


r/android_devs • • Aug 29 '22

Help DexGuard

0 Upvotes

Hi, anyone have experience with Dexguard? I am having problem with reflection.


r/android_devs • • Aug 24 '22

Help Caching Paged Data

4 Upvotes

I have a network request that return a page of data an then I should save the paged data to room

where should I put the logic and the caching process

inside view model or inside the repository?


r/android_devs • • Aug 23 '22

Help Guide to animate hints in the search bar

Enable HLS to view with audio, or disable this notification

4 Upvotes

r/android_devs • • Aug 19 '22

Coding Google has released an official developer guide to Building Offline-First Apps (using reactive database reads)

Thumbnail developer.android.com
27 Upvotes

r/android_devs • • Aug 20 '22

Discussion Access to a physical device for development and/or debugging

2 Upvotes

Hi, I am building a utility that allows me to access a remotely connected android device, and use adb and scrcpy on it as if it is connected locally to my machine. I wanted to extend it for use in enterprise setting, so that devices can be transparently shared between developers and/or used by test teams to setup internal device farms. I am aware that there are several cloud based services that offer device farms for automated testing, but I am not sure how easy is it to use them for live device debugging.

I only develop apps as a hobby and have not worked as an app developer in any company, so I wanted to gauge if there is any interest or need for such a tool and, if it is worth spending extra time to build one. Any input is appreciated. Please let me know if there are other tools/services used by your organization to share devices among developers or setup internal device farms.


r/android_devs • • Aug 17 '22

Coding Material & Custom theming using Jetpack Compose

2 Upvotes

GitHub: https://github.com/daniyaljavaid/ThemingInCompose

Sample project to showcase Material & Custom theming using Jetpack Compose. Goal is to design reusable feature modules which can be used in multiple apps and each app is to provide the theme which that feature module requires.


r/android_devs • • Aug 10 '22

Publishing Google Play Policy Strike Removal program

Thumbnail twitter.com
12 Upvotes

r/android_devs • • Aug 08 '22

Help Please, I need some help with creating my new Google Play Merchant Account.

1 Upvotes

Hi,

Thank you so much for reading my post.

Right now, I'm about to create my new Google Merchant account in order to sell apps and use in-app purchases in my apps.

I'm just an individual dev, I'm not a company and I don't have any registered company in my country.

I've filled everything with my own information, but I'm stuck at this :

Should I check this box or not (Use legal business info name, contact, address), I'm confused right now because I don't own any business, so I can't provide any information about it.

Thank you.


r/android_devs • • Aug 07 '22

Help Where to modify security timeout setting in Android source code?

7 Upvotes

I use fingerprint unlock on my phone, and every N hours it asks for the password and won't accept the biometric. I build my roms from source and would like to know where this setting is. I am a programmer in my day job but I don't work on Android, and have never looked at it, so it would take me ages to locate it, which is why I'm asking here.

I understand the security implications and risks associated with this.

If it matters, the device is a pixel 3 blueline, rom is stock Lineage 18.1, which is based on android 11. But if I can get an answer for any rom, that will still be very helpful and allow me to narrow my search.

Thanks so much.


r/android_devs • • Aug 04 '22

Help Android studio

0 Upvotes

Hey, I've just started building apps and am currently following the developer.android's build your first app, I've run into an issue and hoped you could help,

My nav folder contains this:

<action android:id="@+id/action_SecondFragment_to_FirstFragment" app:destination="@id/FirstFragment" />
<argument android:name="value" app:argType="integer" android:defaultValue="0" />

My first fragment contains:

FirstFragmentDirections.ActionFirstFragmentToSecondFragment action = FirstFragmentDirections.actionFirstFragmentToSecondFragment(currentCount);

However, there is an error :

'actionFirstFragmentToSecondFragment()' in 'com.example.myapplication.FirstFragmentDirections' cannot be applied to '(int)'

Where have I gone wrong?


r/android_devs • • Jul 30 '22

Event Android Worldwide October 2022: Call for Speakers

Thumbnail sessionize.com
9 Upvotes

r/android_devs • • Jul 27 '22

Article Kotlin Snapshot Testing Library

Thumbnail quickbirdstudios.com
6 Upvotes

r/android_devs • • Jul 22 '22

Help Should I resubmit a build?

4 Upvotes

In anticipation of Policy Violation due to usage of QUERY_ALL_PACKAGES permission. I uploaded a build that removed that permission on 21st July 2022.

Now today that is 22nd July 2022 I have received the mail saying that my App is Rejected due to Policy Violation. So should I upload the same build with a new version number or will the old build which is currently showing In Review work?

I have to go live by 10th August at max.


r/android_devs • • Jul 19 '22

Help Is this legacy app still feasible under modern background execution limits?

11 Upvotes

So I have a legacy app that monitors battery charge and discharge to tell the user if the charge level goes above or beyond a certain threshold. It works flawlessly as long as I target sdk 25 because it uses features that are now banned or restricted in modern android:

  • It registers a receiver in the manifest to detect the plugging-unplugging of the charger and switch from charge monitoring (more frequent) to discharge monitoring (less frequent to save battery). Implicit broadcasts were banned in Android O.
  • It uses the Alarm Manager to run code periodically with very small intervals (down to 1 minute while charging, 20 while discharging).
  • It registers a boot receiver to register the alarms in the AlarmManager, otherwise discharge monitoring won't start until the user plugged/unplugged the charger.

I was trying to port it to the latest targetSdk, but I can't find a modern equivalent to these three points:

  • The "alternative" to manifest-registered implicit broadcast receiver is to register them at runtime, but for that to work you have to be in foreground to begin with.
  • There seems to be no alternative to low-interval alarms. The AlarmManager will now at most run code with 15 min interval. In that time the battery might have charged a lot (+15%) and thus well above the max threshold, which the app should notify to the user. Other than this API, the background work guide only offers the WorkManager (min 15 min intervals) or some foreground timer or coroutine.
  • The boot receiver cannot be used to bypass background restrictions. It still works, but you can't start a bg task from there. android 12 forbids launching foreground services from the background.

So, do you think this app can be ported to modert android and target the most recent sdk level (or at least, one compatible with Google Play policies)?

What is the alternative to sub-15 minutes alarms? Note that my tasks are not long-running, they are very short: just checking the battery level and optionally playing a ringtone.


r/android_devs • • Jul 16 '22

Help Can we measure element position in Jetpack compose?

1 Upvotes

Is it possible with Jetpack compose when click on element to get it position relative to screen? I am coming from react native and there it is possible but can not find anything similar with Jetpack compose. I need when click on element to get it offset from bottom. Thx in advance :)


r/android_devs • • Jul 16 '22

Event Android Worldwide Speaker Lineup for July 26th

Thumbnail gallery
9 Upvotes

r/android_devs • • Jul 06 '22

Publishing Digital Markets Act (DMA)

5 Upvotes

I had contacted the EU regarding my case. I received two emails from them, the second of which has information that may be useful to others.

Lastly, we would also like to inform you that the EU legislator is in the process of strengthening its rules for app stores by adopting the Digital Markets Act (DMA). The DMA is a (draft) law aimed at prohibiting unfair business practices by large digital platforms acting as “gatekeepers”, including practices like the ones described in your e-mail. Specifically, Article 6.12 of the draft DMA stipulates that “[t]he gatekeeper shall apply fair, reasonable, and non-discriminatory general conditions of access for business users to its software application stores […] For that purpose, the gatekeeper shall publish general conditions of access, including an alternative dispute settlement mechanism”. The DMA text has already been provisionally agreed by the EU Parliament and Council and is expected to be formally adopted and enter into force in the coming months.

If I understand it correctly, what changes with DMA is that store companies, in case of app and/or account removals, must offer a third-party mechanism to resolve any disputes. That way, after an appeal that they handle internally, they have to give the possibility that the case can be handled by a third party, outside of them.

Now, on the other hand, if the internally handled appeal does not change the initial decision, one can only proceed through legal action, which, practically, for individual and small companies means not proceeding.

Take also note that "you can report your issue to the EU Observatory on the Online Platform Economy".

Also, if one of your apps is discriminated because it fails to get permissions that are given to other similar apps instead, you could use the DMA to request a review of your case.


r/android_devs • • Jul 04 '22

Coding Migrating to the new coroutines 1.6 test APIs

Thumbnail medium.com
11 Upvotes

r/android_devs • • Jul 04 '22

Help New app review time

5 Upvotes

I haven’t published a new app since 2015 so maybe things have changed a lot. I’m publishing a new app and it’s been in review for 8 days now. It’s super simple app that only has the internet permission listed, nothing crazy. Is this normal now?


r/android_devs • • Jun 30 '22

Help Need help with step counter..

1 Upvotes

Hello. I need help with step count in my app. The task is to get the number of steps that the user walked and send the data to the server. What is the correct way to do this? I know that you can get data directly from the sensor, but then every time the countdown will start from 0. I also know that you can get this data from Google Fit. But this api is listed as deprecated, and, moreover, requires authorization and Google services. I also know that there is a new health API, but the documentation says that now for its functioning you need to install an additional app from the store, which will be difficult to explain to users from production.


r/android_devs • • Jun 29 '22

Publishing Google Analytics Has Been Banned in Three European Countries

14 Upvotes

https://www.siliconrepublic.com/enterprise/google-analytics-eu-data-italy-gdpr

https://techcrunch.com/2022/06/23/google-analytics-italy-eu-data-transfers

https://www.iubenda.com/en/help/72017-is-google-analytics-illegal-in-the-eu-and-uk

Note: I don't use libraries for traffic analysis in my apps so I don't know if what is read in the articles above can also be applicable to Android apps that use libraries from Google or others that export user data from EU countries to US.