Sending input from a HTML website to an Android application - android

So i'm working on a summer project to create my first android app. Here's the basic idea: It's a workout app where a user goes to a website and submit's a text form of a workout. This app will then parse the text file format it onto an android app they can take to the gym.
So far I just have some classes written in java to hold the workouts and an html website. How would I go about sending the text from the website to the app? If you could point me in the right direction or give me some examples of how this is done that would be great.

You could use the GREAT Google Cloud Messaging System as the backbone for your applications.
Google Cloud Messaging (GCM) is a free service that enables developers
to send downstream messages (from servers to GCM-enabled client apps),
and upstream messages (from the GCM-enabled client apps to servers).
This could be a lightweight message telling the client app that there
is new data to be fetched from the server (for instance, a "new email"
notification informing the app that it is out of sync with the back
end), or it could be a message containing up to 4kb of payload data
(so apps like instant messaging can consume the message directly). The
GCM service handles all aspects of queueing of messages and delivery
to and from the target client app.
Work flow of the GCM
Check this example

Related

How do Asp.net backend and Web API web service hosted on Azure send push notification to mobile app?

I am building a mobile app, for both Android and iPhone. I outsourced the mobile end to an app company, while I myself develop the back end and web service part with asp.net and hosted them on Azure. The web service is developed with Web API 2.0, and it is deployed to Azure as a web site. The back-end is developed with asp.net web forms and deployed in to Azure as a web site.
There are 2 cases when a mobile user will receive some messages:
(1) When some mobile users post some messages, other mobile users will receive them.
(2) In the back end, if an administrator publishes a message, all mobile users will receive it.
Currently in my back end and web service, when mobile user post message or an administrator publishes a message, I just update database table to save that message. I thought the mobile end will keep pulling database table and get the latest message - until today. Today the app company told me I need to PUSH those messages to phones. He suggested some third party service to achieve this.
I then checked Azure documents, it seems they have built-in push function in their service so that I don't need go for a third party service. But I am confused, I saw there is "Cloud Services", there is "Mobile Services", and there is "Service Bus-Notification Hub". Which one should I use to make my back end and web service be able to send push notification to mobile devices? How should I modify my existing back end and web service projects in Visual Studio Express 2013? Do I still deploy them to Azure as web sites?
by message, I don't mean SMS, I mean some text data.
Given that you've already invested some reasonable development time in both the Android Application and your back-end services, it sounds like you're looking for Notification Hubs. Notification Hubs are designed specifically for sending push notifications to both individual users and groups of users across one or more mobile platforms.
As suggested in my comment, Cloud Services is a means of hosting your application on Azure (for your purposes it would offer a heavier-weight alternative to Azure Websites with an improved SLA), and Mobile Services provides a set of libraries and APIs to abstract interacting with your application's server-side data.
To use a Notification Hub to send push notifications you'll need to do a few things (described in detail in the linked documentation):
Go to the portal and create yourself a new Notification Hub
Create a Google Cloud Messaging Project via the Google Cloud Console (Azure will use this to transport your message to the relevant Android devices)
Update your back-end service to use Notification Hub to send messages
Modify your android application to use the the associated Azure messaging libraries to receive your push notifications
I hate to link directly to documentation, but the best way to get started with this functionality is via the following tutorial from the Azure documentation:
http://azure.microsoft.com/en-us/documentation/articles/notification-hubs-android-get-started/. This covers the basic changes you'll need to make to both your Android application to handle push notifications, and to your back-end service in order to send them.
You'll still be able to deploy your server-side components to Azure Websites.
Note that sending messages via Notification Hub comes with a price tag, though there is a free tier that limits you to 500 devices and 100,000 push notifications per month, as described in http://azure.microsoft.com/en-us/pricing/details/notification-hubs/.
EDIT: Here's an example of using Notification Hub to send messages to individual users:
http://azure.microsoft.com/en-us/documentation/articles/notification-hubs-aspnet-notify-users/

how to create push notification in android?

I am developing android application that would receive data from server any time.i have searched in google to get some information.
1)android cloud to device messaging(C2DM).
2)persistent TCP/IP connection.
how to implement C2DM function and other one how to register C2DM?.please explain detail and send me sample application
C2DM is deprecated and you can use GCM for your requirement
Google Cloud Messaging for Android (GCM) is a service that helps developers send data from servers to their Android applications on Android devices. This could be a lightweight message telling the Android application that there is new data to be fetched from the server (for instance, a movie uploaded by a friend), or it could be a message containing up to 4kb of payload data (so apps like instant messaging can consume the message directly). The GCM service handles all aspects of queueing of messages and delivery to the target Android application running on the target device
This document describes how to write an Android application and the server-side logic, using the helper libraries (client and server) provided by GCM.
Check these links,
http://developer.android.com/guide/google/gcm/gs.html
http://developer.android.com/guide/google/gcm/demo.html
http://www.basic4ppc.com/forum/basic4android-getting-started-tutorials/19226-android-push-notification-gcm-framework-tutorial.html
http://fundroiding.wordpress.com/2012/06/29/google-cloud-messaging-for-android-gcm-simple-tutorial/
for client side app you can find the code here
https://github.com/marknutter/GCM-Cordova
c2dm is deprecated.
https://developers.google.com/android/c2dm
Maybe you'd better start with GCM
best regards

Set Push Notification in android

I have an Api. Suppose this api http://api.androidhive.info/contacts/ has this contact which I'm displaying in list view. I want to set a push notification in our application, such that when ever a new contact is added in the api then there should be a notification in our application that a new contact has been uploaded. This Notification should be displayed even if the application is not open or launched.
For example: It should function like "Time of INDIA" android app. When news updates come then it shows a Notification.
I am new in android. Please help me. hHw i will do this? Please send me example sources or post me related blog or tell me logic. How i will do this i have server access also.
Thanx
You can use GCM for this,
Google Cloud Messaging for Android (GCM) is a service that helps developers send data from servers to their Android applications on Android devices. This could be a lightweight message telling the Android application that there is new data to be fetched from the server (for instance, a movie uploaded by a friend), or it could be a message containing up to 4kb of payload data (so apps like instant messaging can consume the message directly). The GCM service handles all aspects of queueing of messages and delivery to the target Android application running on the target device
This document describes how to write an Android application and the server-side logic, using the helper libraries (client and server) provided by GCM.
Check these links,
http://developer.android.com/guide/google/gcm/gs.html
http://developer.android.com/guide/google/gcm/demo.html
http://www.basic4ppc.com/forum/basic4android-getting-started-tutorials/19226-android-push-notification-gcm-framework-tutorial.html
http://fundroiding.wordpress.com/2012/06/29/google-cloud-messaging-for-android-gcm-simple-tutorial/
for client side app you can find the code here
https://github.com/marknutter/GCM-Cordova

How to upgrade app?

I've built an phone gap application for android which is now on my website. From time to time, I make updates to it, and I'll like to make users know that a new version is available.
How can I send notification update to the users of the app? I also want as user accept the notification new version start downloading.
Does anyone have any advise?
Google Cloud Messaging for Android (GCM) is a service that helps developers send data from servers to their Android applications on Android devices. This could be a lightweight message telling the Android application that there is new data to be fetched from the server (for instance, a movie uploaded by a friend), or it could be a message containing up to 4kb of payload data (so apps like instant messaging can consume the message directly). The GCM service handles all aspects of queueing of messages and delivery to the target Android application running on the target device
This document describes how to write an Android application and the server-side logic, using the helper libraries (client and server) provided by GCM.
Check this link,
http://developer.android.com/guide/google/gcm/gs.html
for client side app you can find the code here
https://github.com/marknutter/GCM-Cordova

Instant Messaging on Android with Google Cloud Messaging

I was just looking at the new Google Cloud Messaging (GCM) and I was wondering if it is possible to use GCM for Instant Messaging on your Android application?
I saw you can send data, like a message, from a server, but is it also possible to send from one device to another one?
And how would this work?
Some example code would be really helpful..
Tnx!
The official docs on Google Cloud Messaging for Android does mention that GCM can be used to develop an instant messaging app.
...or it could be a message containing up to 4kb of payload data (so
apps like instant messaging can consume the message directly).
So we went ahead and created an instant messaging app using GCM. The server-side is powered by Google App Engine. You can read the complete tutorial here. Create an Instant Messaging app using Google Cloud Messaging (GCM)
So it is possible to use GCM for Instant Messaging on Android, to answer your question. However, reliability of GCM compared to XMPP for IM is another topic.
Just my two cents:
I think you should not use GCM for delivering IM. You should have a dedicated server where your Android IM apps will connect to, using a persistent socket connection. Your server will know who is online or not and therefore can present an 'online list' to all the apps.
GCM can come into play, while users are offline or not running your app. A GCM message can be sent to them to indicate 'XXXX wants to chat'. They can then launch your app and automatically connects to a chat session.
Google has said that the delivery of GCM messages are not guaranteed. This reason alone is not a good idea to rely on them for Instant Messaging.
Try pub nub - it is pretty easy to implement - send Im from one mobile to another - simply fire up the web page (see link) in the browser , and chat between pc, mobile - and works - with 'no server'. Code is for javascript but they also have java. Chat app using jquerymobile web app framework
You might want to check out how a server sends a message to the GCM Service. It is possible to use php on Server side so it should be possible to adapt that to a POST request directly out of your application. However, to communicate you need the registered ids of the devices you want to send data to. Means you will need something to store and get them. Best solution would be your own (web) server which stores all ids and handles the Message sending.

Categories

Resources