Question

Andriod app crash on configuration changes

  • 22 January 2024
  • 1 reply
  • 13 views

Badge +5

Hello,

I have a single activity Andriod  app trying to implement Revenue Cat.

I experience app crashes when an configuration change, i.e. screen rotation, occur during the call to  

Purchases.sharedInstance.restorePurchasesWith…. The method is called from a Fragment and work as intended unless an configuration change occur before Purchases.sharedInstance.restorePurchasesWith… returns the call.

Do anyone have any suggestions how to handle configuration changes, should I move calls to the Revenenue Cat SDK to a viewmodel?

 

Best Regards, Tomas


1 reply

Badge +5

Hi,

I replay on my own question. This has nothing to do with the Revenue cat SDK. I realized I got the context in a stupid way, requirecontext() that throws instead of getContext that can be null checked.

 

Best Regards Tomas 

Reply