Does GoogleCloudMessaging work in China now that e

2019-08-05 17:07发布

I need to write an Android app for a Chinese company and it needs to support some form of push notifications. (This is for their internal use and not aimed at the general public)

I'm not too clear on how exactly GCM operates as I've never used it before. Firstly it seems to require Google Play services, which most Chinese phones don't have installed (is that correct?).

And maybe my main question: Does a GCM implementation ever require a connection to a server with the *.google.com domain? It seems that you need to implement your own server, but then there is still somehow a Google component involved?

If there are Google servers involved, then this most likely wouldn't work in China as everything Google is blocked since June 2014 (and since December even mailservers).

Can something GCM-based work in China these days?

And bonus question: If not (which I expect), what could I use instead? I've been looking into XMPP/Jabber and the nice Smack library which since version 4.1 also runs natively on Android, but XMPP also seems to have problems on mobile devices and messages can get lost.

2条回答
Ridiculous、
2楼-- · 2019-08-05 17:57

If you say everything from Google is blocked, I really doubt you will be able to use GCM either. You need your own server, this server is meant to implement any logic with your clients and messages, but in order to use GCM you have to send a request to https://android.googleapis.com/gcm/send which presumably will be blocked too. A workaround could be hosting this server outside China (I don't know if this is legally possible, some countries have laws that force servers to be hosted in their country), but your clients will have to connect to the GCM site either way, so that wouldn't help much.

As an alternative, depending on what you want to achieve, you might try using Redis or even RabbitMQ, although there will be probably some additional work to do on the server part, but the positive part is that you'll be independent from any third-party messaging server as you'll have to host it by yourself and implement the way it will work.

查看更多
成全新的幸福
3楼-- · 2019-08-05 18:06

In China, please use other push service, like: pushy

Google push does not work in Chinese mobiles.

查看更多
登录 后发表回答