I have followed these steps:
- Go to Google Cloud Console and create/select a project.
 - On the header, click to open the menu and select ‘Pub/Sub’, or click https://console.cloud.google.com/cloudpubsub/topic/list
 - Create/select a topic.
 - Add the service account google-play-developer-notifications@system.gserviceaccount.com, and grant it the role of Pub/Sub Publisher.
 - Create a subscription. There are 2 types of subscription:
- Pull: we need to configure our server to pull for new messages.
 - Push: Similar to ios, the notification is send to the endpoint we configure.
 
 - Go to Google Play Console and select your app.
 - Click on ‘Development tools’, then ‘Service & APIs’.
 - On Real-time developer notifications type the topic name.
 - You can send a test notification to test that all is connected.
 
But When I send test notification I get this error:
An error occurred with the test publish on topic projects/project_id/topics/topic_name. Ensure that the topic is correctly created and configured, and the required permissions are set. Refer to the Real-time Developer Notification's Pub/Sub Guide to learn more.
But
- I have given pub/sub publisher permission to my service account.
 - topic name is correct too.
 - I am able to send test message from this topic in google developer console and I am receiving that response on my server.
 
any help is appreciated.