Skip to content
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

Fix Deprecated API Usage in Vibration Plugin for Android #111

Open
sourav-kundu443 opened this issue Oct 16, 2024 · 0 comments
Open

Fix Deprecated API Usage in Vibration Plugin for Android #111

sourav-kundu443 opened this issue Oct 16, 2024 · 0 comments

Comments

@sourav-kundu443
Copy link

The VibrationPlugin.java file in the vibration plugin (version 2.0.1) is using or overriding deprecated APIs in Android, which triggers warnings during build. The plugin needs to be updated to use modern APIs, specifically handling Android API levels that have deprecated the older vibration methods (e.g., Vibrator.vibrate(long)).

The proposed fix is to replace the deprecated methods with newer equivalents, such as VibrationEffect.createOneShot() introduced in API level 26 (Android 8.0), while maintaining backward compatibility with older Android versions.

What to fix:

Replace deprecated Vibrator.vibrate(long) with VibrationEffect.createOneShot(long duration, int amplitude) for Android 8.0 and above.

Implement conditional logic to ensure backward compatibility for devices running Android versions below API 26.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant