AudioAnchor icon indicating copy to clipboard operation
AudioAnchor copied to clipboard

Fix deprecations, optimize code

Open PatrykMis opened this issue 3 years ago • 1 comments

Examples:

Loaders in activity, android.app, content, … deprecated

files:

  • app/src/main/java/com/prangesoftwaresolutions/audioanchor/activities/*.java

Loaders have been deprecated as of Android P (API 28). The recommended option for dealing with loading data while handling the Activity and Fragment lifecycles is to use a combination of ViewModels and LiveData.

How to replace it: https://developer.android.com/topic/libraries/architecture/viewmodel#loaders

If still there is need to use loaders, in app/build.gradle: implementation("androidx.loader:loader:1.1.0") …and make adjustments accordinly.

PhoneStateListener in android.telephony has been deprecated

files:

  • app/src/main/java/com/prangesoftwaresolutions/audioanchor/services/MediaPlayerService.java Required to target SDK 32.

This class was deprecated in API level 31. Use TelephonyCallback instead.

May be useful discussion: https://stackoverflow.com/questions/69571012/telephonymanager-deprecated-listen-call-state-ringing-on-android-12

PatrykMis avatar Apr 25 '22 17:04 PatrykMis

I agree and if I had more time, I would do it :) It's a good reminder though and thanks for the links.

flackbash avatar May 16 '22 15:05 flackbash