Solved

Login user without configure on non-store platforms (like fireos apk)

  • 18 January 2024
  • 2 replies
  • 38 views

Badge +3

Hello,

I’ve a Flutter app available on several platforms, iOS/iPadOS/macOS and Android/AndroidTV.

Everything works well but I’m facing an issue on Amazon Firestick. I know revenuecat supports Amazon Store IAP but I can’t publish my app on this store and users install it via apk direct link.

So on this platform I disable IAP and just want to login user and check CustomerInfo to see if there is any subscription purchased on another platform.

I don’t know how to implement this, if I call the configure(configuration) method which Api Key should I use ? Can I use the android api key even if app is running of Amazon FireOS ?

I tried to just login user because the dart documentation says :

This function will logIn the current user with an appUserID.

Typically this would be used after logging in a user to identify them without

calling configure

 

But when I call Purchases.login(userId) :

kotlin.UninitializedPropertyAccessException: There is no singleton instance. Make sure you configure Purchases before trying to get the default instance

 

Is there a way to do this ? Even an API endpoint maybe without using the flutter sdk ?

I think this issue also apply to all platforms without supported store like Windows, Linux or Web.

 

Thanks for your help !

 

icon

Best answer by FrereBilly 28 January 2024, 12:42

View original

2 replies

Userlevel 4
Badge +8

Hi, the reason you are getting that error is because you need to configure() in order to create the Purchases singleton. You’ll need to use the Flutter SDK to configure() your app with your Amazon API key.

In order to share subscriptions cross platform, your Android and Amazon app must be in the same RevenueCat project and you must be authenticating your users. Once you do this, you can then configure with the custom id in Amazon so then you can view the products and entitlements that were unlocked via your Android app. We have a blog post here that has more details on making your apps cross platform: https://www.revenuecat.com/blog/engineering/cross-platform-subscriptions-ios-android-web/

Badge +3

Hi, the reason you are getting that error is because you need to configure() in order to create the Purchases singleton. You’ll need to use the Flutter SDK to configure() your app with your Amazon API key.

In order to share subscriptions cross platform, your Android and Amazon app must be in the same RevenueCat project and you must be authenticating your users. Once you do this, you can then configure with the custom id in Amazon so then you can view the products and entitlements that were unlocked via your Android app. We have a blog post here that has more details on making your apps cross platform: https://www.revenuecat.com/blog/engineering/cross-platform-subscriptions-ios-android-web/

Thanks for your answer, I know the reason of this error but I explained above why I don’t and can’t use configure() method. I also pointed out a contradiction between the actual behavior and the documentation of the Flutter login method.

 

I ended using configure() and login() methods in a try catch block and use Revenuecat’s Rest API with android ApiKey if error with sdk methods.

Reply