-
Notifications
You must be signed in to change notification settings - Fork 19
feat: Android compatibility #22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
8312a13
to
7b1545e
Compare
Is this ready for review?
I opened #23, would be nice if the project source was formatted already. |
Yes, tested and works now in the described cases. |
@dignifiedquire Looks like |
@shellrow we had some discussion about whether it's worth switching to dlopen2 or not and were rather inconclusive. So it's up to you really, would you prefer us to switch over or leave it as is? |
@flub Sorry for the late reply. We should migrate to |
Cool, done.
Thanks! If you like we [0] would always be happy to help out maintaining as we'll be relying on this and keep having stakes on it working on lots of platforms. Of course I know that's a tall demand from people you've never known before... so don't worry if you'd rather decline. But also don't hesitate to ask whatever you'd like to see done. We can at least make it as simple as hitting the merge button on a bunch of PRs. [0] That would be the n0 and deltachat teams: https://github.com/n0-computer and https://github.com/deltachat |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Unfortunately the default ways are not as easily used on different Android versions.
This implements two different versions for doing this on Android, which should allow supporting Android back to NDK API version 16 (the one that I need currently) up to today.
The first approach is to use dlopen to load libc and use
getifaddrs
which should work on API 24 and up. The headers are unfortunately not exposed, which is why this workaround is needed.For all other versions where the symbols are not available, a backup using
netlink
is implemented.This is currently still being tested, which is why I am opening this as a draft, for feedback if this would be merged once it is confirmed to be working.
(Sorry for the whitespace changes, I ran
cargo fmt
on the files I was working on)