1

Glassfy automatically tries to identify the subscriber based on information on the purchases received by the SDK.

The permissions object has two parameters that help to uniquely identify the subscriber:

subscriberId : identifies the subscriber and is connected with the purchases from the store. If a user reinstalls an app the subscriberId remains the same. Due to the way app stores work it is not possible to disassociate a subscriber from their AppStore / PlayStore account so this identifier will remain the same. The subscriberId may change if a user without a purchase removes and reinstalls the app.

installationId: identifies the current installation of the application and is regenerated every time the app is reinstalled or installed on a different device.

it keeps starting from the purchase page even though i restart the run even though i have a subscription

final isPremium = context.watch<GlassfyProvider>().isPremium;

return Scaffold(
  body: Column(
    children: [
      Container(
        alignment: Alignment.center,
        padding: const EdgeInsets.all(32),
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            const SizedBox(height: 8),
            buildEntitlement(isPremium),
            const SizedBox(height: 30),
            ElevatedButton(
              onPressed: fetchOffers,
              child: const Text('Plans'),
            ),
          ],
        ),
      ),
    ],
  ),
);


Widget buildEntitlement(bool isPremium) => isPremium
      ? buildEntitlementIcon(
          text: 'You are on Paid plan',
          icon: Icons.paid,
          color: Colors.green,
        )
      : buildEntitlementIcon(
          text: 'You are on Free plan',
          icon: Icons.lock,
          color: Colors.red,
        );
Widget buildEntitlementIcon({
    required String text,
    required IconData icon,
    required Color color,
}) =>
      Column(
        children: [
          Icon(icon, color: color, size: 100),
          const SizedBox(height: 8),
          Text(text),
        ],
      );
Mike Szyndel
  • 10,461
  • 10
  • 47
  • 63

0 Answers0