developermypos / myPOS-SDK-Android

myPOS SDK Android enabling to integrate Apps with myPOS Card Terminals for Card Payments processing
49 stars 22 forks source link

[Stable 1.0.2] Unusable with Android 11: Toast.getView() is deprecated #12

Closed JohannesHellocash closed 3 years ago

JohannesHellocash commented 3 years ago

With Android 11 (API Level 30) toast.getView() was deprecated ([see documentation](https://developer.android.com/reference/android/widget/Toast?hl=en#getView()))

This leads to a NullpointerException when calling POSHandler.getInstance() making the whole SDK unusable on Android 11.

java.lang.NullPointerException: Attempt to invoke virtual method 'android.view.View android.view.View.findViewById(int)' on a null object reference
        at com.mypos.slavesdk.POSHandler.setDefaultInfoListener(POSHandler.java:180)
        at com.mypos.slavesdk.POSHandler.<init>(POSHandler.java:170)
        at com.mypos.slavesdk.POSHandler.getInstance(POSHandler.java:147)
developermypos commented 3 years ago

Hi,

Please try our beta version. This and other issues are fixed there.

implementation 'com.mypos:slavesdk-beta:2.0.7'

JohannesHellocash commented 3 years ago

It works with the beta version, but I don't want to use a 2-year-old beta in a production environment.

Looking at the commit history, this bug was fixed in the beta version about 5 months ago. Why was this critical bug not fixed in the stable release?

developermypos commented 3 years ago

The 'beta' version is stable enough, so we are planning to merge it to the 'master' very soon.