Coder Social home page Coder Social logo

johnofkorea / django-ios-push Goto Github PK

View Code? Open in Web Editor NEW

This project forked from tadeck/django-ios-push

0.0 1.0 0.0 70 KB

A Django Application for contacting the Apple Push Service and maintaining a list of iOS devices

Home Page: http://appsome.co

Python 100.00%

django-ios-push's Introduction

django-ios-push

A Django Application for contacting the Apple Push Service and maintaining a list of iOS devices.

Based on Lee Packham's django-iphone-push but it's not compatibile!

Changes from original:

  • Cleaner names
  • It works with iPhones, iPods Touch and iPads, so all "iPhone" references were changed to "Device" or "iOS"
  • Filtering in admin
  • iOS 5 Newsstand notifications support

Usage

First of all, you need to create certificates. A great tutorial is available here: http://www.macoscoders.com/2009/05/17/iphone-apple-push-notification-service-apns/

Then you have to add iospush to INSTALLED_APPS and add some configuration to settings.py:

# Full path to the APN Certificate / Private Key .pem
APN_SANDBOX_PUSH_CERT = os.path.join(PROJECT_ROOT, "iphone_ck.pem")
APN_LIVE_PUSH_CERT = os.path.join(PROJECT_ROOT, "iphone_live.pem")

# Set this to the hostname for the outgoing push server
APN_SANDBOX_HOST = 'gateway.sandbox.push.apple.com'markdown
APN_LIVE_HOST = 'gateway.push.apple.com'

# Set this to the hostname for the feedback server
APN_SANDBOX_FEEDBACK_HOST = 'feedback.sandbox.push.apple.com'
APN_LIVE_FEEDBACK_HOST = 'feedback.push.apple.com'

Now is time to manage.py syncdb and add some devices to database (if you're running in sandbox, set is_test_device = True to send data to the right place). Try to send some notifications:

from iospush import models

device = models.Device.objects.all()[:1]
# Simple notification
device.send_message(alert='My hovercraft is full of eels')
# Notification with badge number
device.send_message(alert='Answer to everything!', badge=42)
# Notification with custom sound
device.send_message(alert='My sound', sound='mysound')
# Newsstand content availability notification
device.send_message(alert='New issue', content_available=True)

Sending mass notification is also simple:

models.sendMessageToPhoneGroup(models.Device.objects.all(), alert='Greetings to you all!', sandbox=True)

In case of need to communicate with different iOS applications, which requires using different certificates, you can specify it when sending notification:

device.send_message(alert='Test', custom_cert=os.path.join(settings.PROJECT_PATH, 'custom_cert.pem'))

Todo

  • Feedback support

LICENCE

Copyright (C) 2012 Wojtek Siudzinski [email protected], Appsome

Licensed under the Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0

django-ios-push's People

Contributors

suda avatar mchiadmi avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.