Closed tiyberius closed 10 months ago
Hi @tiyberius!
Adapty SDK is indeed pulling profile updates every 60 seconds, and if there are some changes in the user profile, didUpdateProfileStream
should emit an event. It should also emit every time the SDK receives the new profile (successful purchase, restore, etc.), but it won't emit anything until the profile is updated.
I am trying to understand if these scenarios work for you, or if you are not receiving updates even when you change a user's profile by making a purchase or by updating the profile within the dashboard?
Thanks for the prompt response, @x401om! I am not receiving updates when a user's profile changes, for instance when they make a purchase. I'm on the free plan at the moment, so I am unable to update the profile through the dashboard, but I guess I could call the API to update the user profile and test it that way. However, like I said I am never seeing the result of "debugPrint('hello from profile stream listener');" in the logs, and so it seems like the listener isn't working for me. I am testing it by making a purchase.
Is there a particular place one needs to put this snippet? Maybe I don't have it in the right place. I am calling it from the main() method.
Adapty().didUpdateProfileStream.listen((profile) {
// handle any changes to subscription state
});
The documentation makes reference to "additional configuration (depends on your platform)", but doesn't specify any "additional configuration" for a Flutter app or any other type of app for that matter.
@tiyberius, thank you! Now I understand. I will investigate the issue and get back to you soon.
Hey, @tiyberius! I've just checked the behavior of didUpdateProfileStream
using our example app, and it looks like everything works as expected. I did receive an event during the startup and after making the purchase as well. Could you please check this behavior on our example app using your API key and bundle ID?
Here is the line.
Okay! Thanks @x401om for confirming. I will try the example app with my credentials and see if the behavior persists. If I run into trouble I'll re-open this case. Thanks!
I have the same situation. Updating flutter adapty to 2.10.1 didn't help. Tried updating xCode to 15.3 - didn't help. Also updated some libraries (firebase core) and increased the target IOS version to 12.2.
When I make a purchase, I don't see any profile updates after a successful purchase. @tiyberius Have you solved your problem or not?
I too had this problem on the same version: 2.6.3
Hey @IliaKhuzhakhmetov, unfortunately I never got the code snippet working. I'm resorting to polling every few minutes or so to update the subscription status
Thanks @tiyberius for the reply. What helped me is that I switched to RevenueCat and RevenueCat works well in the same situation. Also, if the user has successfully subscribed, the profile that comes back after the purchase call does not contain any active subscriptions. After another refusal from Apple to publish my app with Adapty, they have appruved a version with RevenueCat
I am using Riverpod package and a "subscription status" provider to store the state of a user's subscription for my app. I've got subscriptions working to the extent that after making a purchase I can update the state of the provider, but I'm trying to figure out the best way to keep the state of the user's subscription updated (in particular, when said subscription might have expired).
I tried following the setup instructions https://docs.adapty.io/docs/subscription-status#listening-for-subscription-status-updates, but I could not get the code I put in the listener to fire. I tried calling
in the initialization code for my app, but could not get it to execute, I never saw 'hello from profile stream listener' in the logs.
As a workaround, I could set up this code
on a 60 second or 10 minute timer, but that's a hack and I wanted to see if there was a better way, and not send any more traffic to the Adapty API's than you're already getting.
I noticed in my app logs that Adapty is polling for profile updates every 60 seconds. With log level verbose I am seeing the following in my logs:
And I'd like to hook into that! The documentation on https://docs.adapty.io/docs/subscription-status#listening-for-subscription-status-updates states that
"Whenever the user's subscription changes, Adapty will fire an event. In order to receive messages from Adapty, you need to make some additional configuration (depends on your platform):"
but makes no mention of what additional configuration is necessary.