If you want to leverage the native passes' functionality, you only need to include the notificare_loyalty dependency and nothing else. We automatically delegate incoming push notification passes to the Google Pay / Wallet app.

However, there might be situations where you might want to obtain a pass object to, let's say, retrieve its contents. If you know the pass serial number, or barcode, you can use the methods below to retrieve a serialized model.

final pass = await NotificareLoyalty.fetchPassBySerial('');

// or

final pass = await NotificareLoyalty.fetchPassByBarcode('');

Additionally, if you need to present the fetched pass to the user, you can call the following method.

await NotificareLoyalty.present(pass: pass);

Legacy (Android)

If you are still using Loyalty v1 passes, there are a few more steps you will need to take care of. Let's dive deeper into how passes are handled in your Android app.

In order for our library to be able to open passes distributed via a push notification, a link in an email or in a website you need to declare an activity like the one below in your AndroidManifest.xml.

        <action android:name="android.intent.action.VIEW" />

        <category android:name="android.intent.category.DEFAULT" />
        <category android:name="android.intent.category.BROWSABLE" />

            android:scheme="https" />

Make sure you replace the ${notificareApplicationId} with your app's actual ID. You can find it in our dashboard as described here. Adding this entry to your AndroidManifest.xml is all it takes to start handling digital cards.

There are also a couple of options for passes. If you wish that a pass is constantly shown in the lock screen (even if the user dismisses it) while it is relevant, you should provide the following option.

        android:value="true" />

Please note that the relevance functionality is only available when the notificare_geo module is being used and the user has granted the appropriate permissions.

By default, the relevance notification will be shown in the default channel from the Push module. If you are not using it, or would like to define a custom channel for the relevance notification, you can use the following property.

        android:value="pass_notification_channel" />

You can also provide a default relevant text, which will be shown whenever a pass is relevant and a value for this field has not been included in the pass.

        android:value="A pass that is relevant for the current location is in the wallet." />

Finally, you can also override the pass' icon which is included in the pass and provide yourself a different resource. This icon will be shown in the lock screen whenever the pass is relevant or its values have changed.

        android:resource="@drawable/ic_baseline_style_24" />