Giter Site home page Giter Site logo

moneya / azurechatrforandroid Goto Github PK

View Code? Open in Web Editor NEW

This project forked from activenick/azurechatrforandroid

0.0 2.0 0.0 864 KB

Android Client for a Cloud-based Cross-Platform Chat App for Smartphones and Tablets. Written in Java as a native app using Eclipse.

Java 100.00%

azurechatrforandroid's Introduction

AzureChatr for Android

Android Client for a Cloud-based Cross-Platform Chat App for smartphones and tablets. Written in Java as a native app using Eclipse.

WELCOME TO AZURECHATR!

AzureChatr is a cross-platform chat client used by Microsoft Senior Technical Evangelist Nick Landry to demonstrate mobile development techniques with a cloud backend using Microsoft Azure. While AzureChatr can be used to chat about anything, the intent of the app is to bring users together to talk about cloud development.

This is the prototype client of AzureChatr for Android and is not published yet. AzureChatr has already been published to the store on Windows Phone 8.1 and will soon be available on Windows 8.1, iOS and Android.

Visit www.AgeofMobility.com for more info on the current and upcoming features.

BEFORE YOU RUN THE APP FOR THE FIRST TIME

If you try to run the app as soon as you open it in Eclipse or Android Studio, you will notice that the app will fail due to missing Cloud services. You must create your own Azure account and configure the following Azure services to implement your own working version of AzureChatr:

  • Azure Mobile Services
  • Azure Notification Hubs

For more information on configuring the cloud services for AzureChatr, please visit my blog at www.AgeofMobility.com. All configured app keys and secrets are declared in the ChatActivity.java file.

EDIT THE INSERT SCRIPT OF YOUR MOBILE SERVICE TABLE

  • Create a Mobile Service in Azure with the name of your choice using a JavaScript backend.

  • Create a new table in that Mobile Service called "ChatItem" (no quotes).

  • Edit the ChatItem table Insert script and replace it with the following code:

      function insert(item, user, request) {
          var azure = require('azure');
          var hub = azure.createNotificationHubService('InsertYourNotificationHubNameHere', 
          'InsertYourNotificationHubFullAccessConnectionStringHere');
      
          // Execute the request and send notifications.
          request.execute({
              success: function() {
                  // Write the default response
                  request.respond();
      
                  // Send a notification to all users on all platforms. 
                  //hub.send(null, payload,  
                  //    function(error, outcome){
                  //        // Do something here with the outcome or error.
                  //    });
      
                  // Send a WNS notification.
                  hub.wns.sendToastText04(null, {
                      text1: item.username,
                      text2: item.text,
                      text3: ''
                  }, function(error, outcome){
                          // Do something here with the outcome or error.
                     });
                  
                  // Send a GCM notification.
                  var gcmpayload = '{"data":{"message":"' + item.text + '","username" : "' + item.username + '"}}';
                  hub.gcm.send(null, gcmpayload, 
                     function(error, outcome){
                          // Do something here with the outcome or error.
                     });
                  
                  // Send an APNS notification
                  var apnpayload = '{"aps":{"alert":"' + item.text + '"},"username" : "' + item.username + '"}';
                  hub.apns.send( null, apnpayload,
                      function (error) {
                          if (!error) {
                              // message sent successfully
                          }
                      });
              }
          });
      }
    

Make sure to insert your notification hub name and full access connection string in the placeholders above when calling createNotificationHubService. You only need to do this ONCE in Azure since the same INSERT script is used as the common backend for Windows, iOS and Android.

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.