• This repository has been archived on 25/Apr/2018
  • Stars
    star
    268
  • Rank 153,144 (Top 4 %)
  • Language
    CSS
  • License
    Apache License 2.0
  • Created about 9 years ago
  • Updated almost 8 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Project status

status: inactive

This project is no longer actively maintained, and remains here as an archive of this work.

GCM Playground

A reference implementation of a GCM Application Server in the form of a playground that developers can use to test the Google Cloud Messaging Service.

Introduction

GCM Playground can be used to experiment sending and receiving messages with the Google Cloud Messaging API. The playground can be used as a sample implementation of the GCM App Server, that you can use as a reference for your own app server implementation.

What's Included

  • App Server (server/): Written in Go (Golang) is a GCM Application Server.
  • Playground UI (web/): Made with Polymer, it is the main component that you will for sending downstream messages and receiving upstream messages.
  • Client apps (android/, chrome/, web/): These client apps are used in conjunction with the playground UI to test various features of the GCM API.

Pre-requisites

Getting Started

Configuration

Before you can start using the GCM Playground you need to configure a project and create credentials for access:

  1. Follow this link to get a configuration file to use GCM.
  • If you want to use the Android client, configure your app to use com.google.samples.apps.gcmplayground for the package name. You can use a different package name if you want, but then you have to adapt the source code of the Android client accordingly. At the end of the configuration flow, download the configuration file to the android/app folder.
  • If you want to use the iOS client, use the bundle ID of an app that has the Push Notifications feature enabled, and upload its Development SSL Certificate when requested to do so. At the end of the configuration flow, download the configuration file to your machine.
  • If you want to use the Chrome App, just configure the project to use an Android client.
  1. After you enable Cloud Messaging, the configuration flow shows you your values of Server API Key and SenderId. Replace the placeholders value in server/server.go with the value you obtained:

server/server.go

// API key from Cloud console
apiKey = ""

// GCM sender ID
senderId = ""

web/app/settings.json

You should only need to change the IP address here. Replace 192.168.99.100 with the IP address that docker-machine ls gives you.

"main": {
  "sendMessageEndpoint": "http://192.168.99.100:4260/message",
  "clientsEndpoint": "http://192.168.99.100:4260/clients",
  "socketEndpoint": "http://192.168.99.100:4260/"
},

Installation - App Server and Playground UI

If the last command fails, you might need to give execute permission to the script. Do $ chmod +x start.sh and retry.

Accessing services - App Server and Playground UI

If using docker machine, run docker-machine ls to find out the VM IP address.

The ports that are being used are:

  • 3000 - Playground Web UI
  • 4260 - App server

So if your IP is 192.168.99.100, load 192.168.99.100:3000 in the browser of the computer running docker to access the Playground UI.

If you want to access the Playground Web UI using a mobile client instead of the computer running docker, you need to tunnel the app server traffic so it's accessible via the public network. To do that, download ngrok and run $ ./ngrok http <IP ADDRESS>:4260. Alternatively, you could also deploy the playground on any public cloud and use the server's address.

Android App

Included in android/ is an Android app that can help you get started with the playground. The Android app lets you:

  • Register and unregister the client with the backend.
  • Receive messages sent through the playground.
  • Subscribe to topics using Pubsub.
  • Send upstream messages.

Getting Started

  • Open Android Studio.
  • Select File > Open, browse to where you cloned the gcm-playground repository, and open the android folder (if you are in the Android Studio start screen, you can select Open an existing Android Studio project and use this same path).
  • Make sure that the configuration file is in the right place. Check the Configuration section above for instructions.

Usage

  • Run the sample on your Android device.
  • Provide a string identifier for your device (e.g. "My Nexus5"), and click REGISTER.
  • Use the playground web UI to send a message to the registered device.
  • A notification containing the GCM message should be displayed on the device.

iOS App

Included in ios/ is an iOS app that can help you get started with the playground. The iOS app lets you:

  • Register and unregister the client with the backend.
  • Receive messages sent through the playground.
  • Subscribe to topics using Pubsub.
  • Send upstream messages.

Getting Started

  • If you don't have CocoaPods installed on your machine, follow the instructions and istall it.
  • Open a terminal window and navigate to the gcm-playground/ios folder and run pod install.
  • Run open GCM Playground.xcworkspace to open the project in xcode.
  • In xcode, replace the project bundle ID with the bundle ID that you have used in the configuration flow.
  • In xcode, add the configuration file previously downloaded to the GCM Playground target. Check the Configuration section above for instructions.

Usage

  • Run the sample on your iOS device.
  • Provide a string identifier for your device (e.g. "My iphone6"), and click Register.
  • Use the playground web UI to send a message to the registered device.
  • A notification containing the GCM message should be displayed on the device.

Note: You need Swift 2.0 to run the app.

Chrome App

Included in chrome/ is a Chrome app that can help you get started with the playground. The Chrome app lets you:

  • Register the client with the backend
  • Receive messages sent through the playground

Usage

  • Open Chrome and go to menu > Tools > Extensions.
  • Click Developer mode > Load unpacked extensions...
  • Browse to and Select the chrome/ folder.
  • On the Extensions page, Launch GCM Playground Receiver app.

Support

If you've found an error in this sample, please file an issue: https://github.com/googlesamples/gcm-playground/issues

Patches are encouraged, and may be submitted by forking this project and submitting a pull request through GitHub.

License

Copyright 2015 Google, Inc.

Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

More Repositories

1

code-prettify

An embeddable script that makes source-code snippets in HTML prettier.
JavaScript
5,768
star
2

chromedeveditor

Chrome Dev Editor is a developer tool for building apps on the Chrome platform - Chrome Apps and Web Apps, in JavaScript or Dart. (NO LONGER IN ACTIVE DEVELOPMENT)
Dart
2,924
star
3

android-Camera2Basic

Migrated:
Java
2,863
star
4

android-ConstraintLayoutExamples

Migrated:
Java
2,571
star
5

firebase-jobdispatcher-android

DEPRECATED please see the README.md below for details.
Java
1,796
star
6

vrview

Library for embedding immersive media into traditional websites.
JavaScript
1,709
star
7

tiger

Java
1,645
star
8

flipjs

A helper library for doing FLIP animations.
JavaScript
1,409
star
9

android-PictureInPicture

Migrated:
Java
1,393
star
10

android-FingerprintDialog

Migrated:
Java
1,375
star
11

observe-js

A library for observing Arrays, Objects and PathValues
JavaScript
1,357
star
12

PyDrive

Google Drive API Python wrapper library
Python
1,304
star
13

js-marker-clusterer

A marker clustering library for the Google Maps JavaScript API v3.
JavaScript
1,279
star
14

android-RuntimePermissions

This sample has been deprecated/archived. Check this repo for related samples:
Java
1,263
star
15

android-Camera2Video

Migrated:
Java
1,201
star
16

chromium-webview-samples

Useful examples for Developing apps with the Chromium based WebView
Java
1,173
star
17

androidtv-Leanback

Migrated:
Java
1,148
star
18

caja

Caja is a tool for safely embedding third party HTML, CSS and JavaScript in your website.
Java
1,126
star
19

android-ui-toolkit-demos

Migrated:
Java
1,118
star
20

android-ScreenCapture

Migrated:
Java
1,021
star
21

android-BluetoothChat

Migrated:
Java
986
star
22

android-BluetoothLeGatt

Migrated:
Java
911
star
23

sample-media-pwa

A sample video-on-demand media Progressive Web App
JavaScript
889
star
24

ChromeWebLab

The Chrome Web Lab for Makers, Hackers and everyone
JavaScript
877
star
25

big-rig

A proof-of-concept Performance Dashboard, CLI and Node module
CSS
857
star
26

android-instant-apps

Migrated:
Java
847
star
27

cloud-functions-emulator

A local emulator for deploying, running, and debugging Google Cloud Functions.
JavaScript
827
star
28

guitar-tuner

A web-based guitar tuner
JavaScript
822
star
29

android-JobScheduler

This sample has been deprecated/archived. Check this repo for related samples:
Java
773
star
30

flashlight

A pluggable integration with ElasticSearch to provide advanced content searches in Firebase.
JavaScript
757
star
31

friendlypix

FriendlyPix is a cross-platform Firebase example app
726
star
32

voice-memos

A Progressive Web App for recording and playing back voice memos.
JavaScript
724
star
33

android-audio-high-performance

We now recommend you use the Oboe libraries:
C++
715
star
34

android-EmojiCompat

Migrated:
Java
707
star
35

android-RecyclerView

Migrated:
Java
675
star
36

ios-swift-chat-example

FireChat implemented in Swift!
Objective-C
673
star
37

leanback-showcase

Migrated:
Java
639
star
38

android-transition-examples

Migrated:
581
star
39

geofire

Realtime location queries with Firebase
569
star
40

drive-music-player

Fully client side Music Player for Google Drive
JavaScript
566
star
41

android-viewpager2

Migrated:
552
star
42

science-journal-ios

Use the sensors in your mobile devices to perform science experiments. Science doesn’t just happen in the classroom or lab—tools like Science Journal let you see how the world works with just your phone.
Swift
532
star
43

topeka

quiz app
HTML
532
star
44

android-PdfRendererBasic

Migrated:
Java
522
star
45

science-journal

Use the sensors in your mobile devices to perform science experiments. Science doesn’t just happen in the classroom or lab—tools like Science Journal let you see how the world works with just your phone.
Java
508
star
46

tango-examples-java

Example projects for Project Tango [deprecated] Java API
Java
500
star
47

AndroidChat

Demonstrates using the Firebase Android SDK to back a ListView.
Java
499
star
48

android-nearby

Migrated:
Java
494
star
49

android-play-places

Deprecated:
Java
479
star
50

tango-examples-unity

Project Tango [deprecated] UnitySDK Example Projects
C#
475
star
51

easygoogle

Simple wrapper library for Google APIs
Java
471
star
52

firefeed

JavaScript
461
star
53

android-dynamic-features

Migrated:
Kotlin
460
star
54

android-MediaBrowserService

This sample is deprecated.
Java
457
star
55

graphd

The Metaweb graph repository server
C
445
star
56

drive-zipextractor

Extract (decompress) ZIP files into Google Drive using the Google Drive API
JavaScript
435
star
57

android-AutofillFramework

Migrated:
Java
432
star
58

webplatform-samples

HTML5 Samples/Demos
430
star
59

cloud-functions-go

Unofficial Native Go Runtime for Google Cloud Functions
Go
427
star
60

android-unsplash

Deprecated:
424
star
61

android-MultiWindowPlayground

Migrated:
Java
418
star
62

appengine-flask-skeleton

A skeleton for creating Python applications using the Flask framework on App Engine
Python
416
star
63

angularfire-seed

Seed project for AngularFire apps
JavaScript
412
star
64

node-big-rig

A CLI version of Big Rig
JavaScript
410
star
65

firebase-dart

Dart wrapper for Firebase
Dart
409
star
66

android-Camera2Raw

Migrated:
Java
386
star
67

js-store-locator

A library for easily building store-locator-type applications using the Google Maps JavaScript API v3
JavaScript
380
star
68

ADBPlugin

Google Chrome Extension with ADB Daemon
C++
372
star
69

android-fit

Migrated:
Java
372
star
70

android-NotificationChannels

This sample has been deprecated/archived. Check this repo for related samples:
Java
369
star
71

appengine-php-wordpress-starter-project

Starter project for running WordPress on Google Cloud Platform
PHP
368
star
72

android-ActivitySceneTransitionBasic

Migrated:
368
star
73

android-text

Migrated:
Kotlin
363
star
74

android-XYZTouristAttractions

Migrated:
356
star
75

firebase-angular-starter-pack

A Firebase + AngularJS Starter Pack
JavaScript
348
star
76

android-OurStreets

Migrated:
345
star
77

tango-examples-c

JNI example projects for Project Tango [deprecated] C-API
C++
334
star
78

simian

Simian is an enterprise-class Mac OS X software deployment solution. Google App Engine hosted server, with a client powered by the Munki open-source project.
Python
334
star
79

OpenInChrome

Open in Chrome
Objective-C
333
star
80

android-DownloadableFonts

Migrated:
Java
319
star
81

friendlypix-web

FriendlyPix is a cross-platform Firebase example app - This is the web version
JavaScript
312
star
82

pywebsocket

WebSocket server and extension for Apache HTTP Server for testing
Python
310
star
83

android-DarkTheme

migrated:
Java
302
star
84

firereader

Firereader: A feed reader built with Firebase and AngularJS
JavaScript
301
star
85

android-WatchFace

Migrated:
300
star
86

android-MediaRecorder

Migrated:
Java
299
star
87

backbonefire

Backbone bindings for Firebase
JavaScript
291
star
88

TemplateBinding

TemplateBinding Prolyfill
JavaScript
291
star
89

firebase-login-demo-android

Java
280
star
90

Firebase-Unity

Objective-C
279
star
91

seed-element

Polymer element boilerplate
HTML
278
star
92

firebase-util

An experimental toolset for Firebase
JavaScript
276
star
93

android-NavigationDrawer

This sample has been deprecated/archived. Check this repo for related samples:
Java
276
star
94

android-DisplayingBitmaps

Migrated:
Java
272
star
95

wReader-app

RSS Reader written using AngularJS
JavaScript
271
star
96

android-CardView

Migrated:
Java
265
star
97

soundstagevr

C#
263
star
98

ShadowDOM

ShadowDOM Polyfill
JavaScript
263
star
99

android-credentials

Migrated:
Java
260
star
100

gamebuilder

Game Builder is an application that allows users to create games with little or no coding experience.
C#
253
star