Search code examples
c#fluttergoogle-cloud-platformandroid-billing

create google cloud pub/sub for android subscriptions notifications


I am totally lost in this point I have finished my subscriptions payment from android application and I need to listen for any subscription on my own backend server to give subscriber the service, but I don't know how to make this happen in proper way, if any one had experience in this point please help .

I haven't find any thing useful in google documentation or YouTube .

thanks

I need step by step to make it work.


Solution

    1. You need to enable PUB/SUB API in your project; check this quick guide and also ensure that you have selected Android Management API is enabled.
    2. Once you have enabled the API you need to create a topic which can publish notifications. You can do it manually in GCP console and by using Pub/Sub topic method
    3. Now you need to create a subscription which captures the stream of messages published. check create subscription method.
    4. Grant Android device policy and you cand do them manually from console or by Pub/Sub; check this.
    5. You need to call enterprises.patch to specify the below parameters

    pubsubTopic: projects/{project}/topics{topic}. enableNotificationTypes: ENROLLMENT, STATUS_REPORT and COMMAND.

    1. You can use Pub/Sub API to get notifications.