Pushing data from Django app to Android app

2020-07-24 06:44发布

问题:

I have a Django webapp that is collecting all sorts of information. As soon as it gets something I want it to be able to push it to the Android device. For this use case, the Android device will ALWAYS have the app running. I could do this by having the Android poll the Django app. I was wondering though if there is a way for Django app to push to the Android?

回答1:

Important: C2DM has been officially deprecated as of June 26, 2012. This means that C2DM has stopped accepting new users and quota requests. No new features will be added to C2DM. However, apps using C2DM will continue to work. Existing C2DM developers are encouraged to migrate to the new version of C2DM, called Google Cloud Messaging for Android (GCM). See the C2DM-to-GCM Migration document for more information. Developers must use GCM for new development.

Use Google Cloud Messaging for Android.



回答2:

You could check out the Android Cloud to Device Messaging Framework

Here is a django prototype utilizing the framework: https://github.com/patrickbaumann/c2dmprototype