# Choosing CPID For Notifications

When sending a plan status notification to the user, the following factors must
be considered:

1. Has the CPID of the user been registered with GTAF? Until a CPID has been registered with GTAF, GTAF is unaware of the CPID and hence cannot send notifications pushed for the CPID.
2. Has the user granted consent for the DPA to share plan status information with GTAF?

As outlined in the [Register CPID](https://developers.google.com/mobile-data-plan/agent_api_specification#register_cpid)
section, GTAF only registers CPIDs on behalf of clients whose terms permit them
to do so. This means that the CPID has been registered in accordance with the
consent requirements of Mobile Data Plan module in Google Play Services.

When the DPA gets a trigger from the backend notifying it of a change in the
plan status of the user, it can use one of the following approaches to look up
the CPID to use for sending the notification:

1. Use latest registered CPID for the user.
2. Use latest registered CPID for the user if the user granted consent.
3. Use latest generated CPID.

## Registered CPID

The DPA looks up the latest registered CPID and uses that for sending a
notification. If the DPA chooses this method, then it MUST implement the
[Register CPID](https://developers.google.com/mobile-data-plan/agent_api_specification#register_cpid) API and store the
latest registered CPID for each user. Please note that GTAF will only register
CPIDs that comply with the terms of service of Mobile Data Plan module in Google
Play Services.

## Registered CPID of Consented Users

The DPA looks up the latest registered CPID and sends a notification only if the
user has granted consent. If the DPA chooses this method, then it MUST implement
[Register CPID](https://developers.google.com/mobile-data-plan/agent_api_specification#register_cpid) and
[Consent](https://developers.google.com/mobile-data-plan/agent_api_specification#consent) APIs and store the latest
registered CPID and the consent status for each user.

## Latest Generated CPID

The DPA can store the latest generated CPID for each user and use that for
sending a notification to the user. This is the least desirable method because
this would involve sending notifications for all users who may or may not have
agreed to the client terms and using CPIDs that may not have made it to GTAF.