logback-android icon indicating copy to clipboard operation
logback-android copied to clipboard

feat: Allow users to provide Android context instance to AndroidContextUtil instance

Open lgoldstein opened this issue 1 year ago • 1 comments

Description

In order to support various special properties the code requires access to an Android context instance. By default, the framework uses a workaround based on reflection that seems to work for the time being. However, in view of Google's restrictions on non-SDK interfaces this code might not work anymore. Therefore, the framework should provide a special API that enables the application to provide an Android context instance that will be used instead of the workaround. See the README file for description as to how this feature would be used if necessary.

Linked Issues

None

Additional context

Note:

  • The usage of Context instead of ContextWrapper (also related to next issue)
  • The usage of application context instead of the original context - as it is durable and does not cause possible memory leaks.
  • The fix to package version code retrieval according to current API level
  • Raised min. Java level to 7 and API version to 21 since getting Java 6 level no longer supported. This should not be an issue as it is highly unlikely that the code will run on (extremely) old versions. However, if backward compatibility to Java 6 is still required, this setting can be reverted (though still need to fix the compilation error).

lgoldstein avatar Sep 21 '23 04:09 lgoldstein

Reverted min. API level to 9, but left Java JDK at 7

lgoldstein avatar Sep 21 '23 05:09 lgoldstein