Is there a way to use GCM in Android without a dedicated server?

I am conceptualizing an Android app that sends data from one device to another (like a picture message), but because I do not have a server, I am looking into other ways of messaging. Google Cloud Messaging (GCM) seems like a good choice, since its made for Android, and is free to use, but it still requires a server to use. Is there a way around this requirement- such as running the GCM server on the app itself? Or is there a better approach to serverless messaging on Android?


I think that will be hard to do what you want effectively without a server but you can check out Parse's SDK. It is free to try and free up to a certain monthly limit.

The docs. You may want to read "Sending Pushes to Channels" and "Using Advanced Targeting".


Yes you can - it's possible to send the same messages from a device that would be sent from a server. However, this has the following problems:

  • You're putting your API key in your app, so somebody could decompile your APK to get it.
  • Your users would need some way to share their GCM registration IDs with each other. If two users had both their IDs expire at the same time, there would be no way to share them again.
  • Really, building your app and hosting it on AppEngine would take about an hour to write, and cost less than $10 a month, even for a ton of users.

    For a dead-simple messaging server example written in Java, check out the server backing one of my apps:

    https://github.com/charlesmunger/touch-to-text-server.git

    链接地址: http://www.djcxy.com/p/66488.html

    上一篇: 反序列化版本冲突

    下一篇: 有没有一种方法可以在没有专用服务器的情况下使用GCM?