Open hhromic opened 1 week ago
It's not quite that simple, it needs to be a runtime check, and you need to dynamically load the new function so that SDL continues to function on older devices. We also need some way of identifying what package is used for loading.
Feel free to submit a PR. :)
Doh, indeed it has to be a runtime check, not a compiler preprocessor one. Brain glitch! :) I also agree about the problem of having to determine what package name to use. I'm not really an Android developer, so I didn't know about also having to dynamically load one function or the other, but makes sense.
While I would love to contribute to fixing this deprecation warning, I'm probably not the right person given that I am not experienced enough in Android applications at the required level for these considerations.
I just checked the Deprecation Policy for Android 15, and looks like deprecated APIs are not expected to be removed:
Deprecation means that we've ended official support for the APIs, but they will continue to remain available to developers.
So at least fixing the deprecation has no immediate urgency.
Yep!
The SDL Sensor API in Android currently uses
ASensorManager_getInstance()
to initialize sensors. However, this function has been deprecated since API level 26 and replaced withASensorManager_getInstanceForPackage()
instead. More info here.This deprecation generates the following warning when building:
This is the only warning we can see about SDL (using version
2.30.9
, but the same code is used in SDL3) at the moment.Perhaps a pre-processor condition could be used to use the older function if API level < 26 and the new one otherwise?