1

I want to use pubsub's pull subscription.

So far its been hard to figure out setting auth & fails in subscription or grpc. Also its not recommended to package client-secret.json in apk.

Havent found any leads to setup on android

Has anyone done this on android

On the Setup client library its mentioned

Note: Cloud Java client libraries do not currently support Android.

Following this link for Pull Subscriber

Any help would be appreciated

Phantômaxx
  • 37,901
  • 21
  • 84
  • 115
Sudhu
  • 172
  • 1
  • 1
  • 7

2 Answers2

1

Pub/sub to a mobile platform has some potential issues, depending on your use-case. For example, if a phone is off for a long time, pub/sub will queue a lot of messages which may be expensive. You also would need to create a topic for every user if you want to keep data for each user private.

You might find that Firebase Cloud Messaging is a better solution for pushing notifications to an android app.

David
  • 9,288
  • 1
  • 20
  • 52
  • Idea was to get all messages from queue, FCM cant be reliable if its critical flags. Purpose is to share critical change log and app will have a state machine which make some decisions on ui behavior & features. I can even opt for other PubSub clients, but google can easily scale when needed. FCM beyond 100 messages it will start discarding – Sudhu Sep 28 '18 at 06:34
  • 1
    Please keep in mind that Cloud Pub/Sub limits you to 10,000 topics and 10,000 subscriptions. Therefore, if you are trying to send the entire feed of messages to all end users, you will be limited to 10,000 users. Generally, Cloud Pub/Sub is not designed to reach end user devices in this way; Firebase Cloud Messaging is the better choice. See [my answer to a similar question](https://stackoverflow.com/questions/37733481/can-someone-explain-the-difference-between-gcm-and-google-pub-sub/37734582#37734582) for more details. – Kamal Aboul-Hosn Oct 04 '18 at 14:22
1

Although the com.google.cloud.pubsub library doesn't support Android, the com.google.api.services.pubsub library does. com.google.api.services.pubsub is auto-generated, so is harder to use and worse documented, but it should work on Android.

See client libraries explained for the difference between the libraries.

David
  • 9,288
  • 1
  • 20
  • 52