Android app that alerts other android devices nearby - android

So I am trying to develop an idea that has two core apps -
The user
The "alerter"
Basically, the alerter sends out a message that is received by all the phones with the app made for the users, but within a specific radius and not all. Any old programs I can look up into? or any tips, ideas? I'm literally new to the android coding world.
Your help is highly appreciated. Thanks :)

There are numerous ways that could be done, including:
Bluetooth detection
this is not feasible until Android supports becoming a Bluetooth Low Energy transmitter
WiFi detection
the devices must be on same access point to have network connectivity with each other
Server-side
All devices update a common server with their location
Devices can then query server for (reported) nearby devices
Server can also push new devices using GCM or Push IO
You could maybe start by looking for apps that do this sort of thing already. One is the instant-messaging app WeChat, and there are also some dating apps that allow users to make contact with nearby potentials.
Also read Find nearby users of an app (iPhone and Android)

I think you should start with Google Cloud Messaging:
Google Cloud Messaging for Android (GCM) is a service that allows you
to send data from your server to your users' Android-powered device,
and also to receive messages from devices on the same connection. The
GCM service handles all aspects of queueing of messages and delivery
to the target Android application running on the target device. GCM is
completely free no matter how big your messaging needs are, and there
are no quotas.

Related

Send Xiaomi thermometer data to server endpoint

I would like to connect to my Xiaomi bluetooth thermometer, read it's data periodically and send it to some API endpoint over the network.
First solution that came to my mind was native mobile app development (Android OS) which would the job but requires quite some work and I am also unsure if it's possible to connect to this particular device. Another idea was to look for general purpose app designed for connecting to bluetooth device and reading it's data yet I did not find one on Google Play store.
Is there any way to share thermometer readings over the internet without spending money on arduino for instance or any other additional components? Maybe Xamarin is a way to go to speed up mobile app development for this purpose?

Android send notification message to device without client app installed on the device

I would like to know is there any way to send notification from a server to an Android device without a client app installed on the device. Does android OS has such functionality. Based on the answer here Does Android support near real time push notification? Google Cloud Messaging do similar things, but it seems the client app need to be installed on user mobile.
Basically what I want do when an android device comes in range of an iBeacon
I need to send the notification messages to the user mobile.
Is there any way to achieve it. Any possible solution?
Edit:
The real scenario is like,
I have the beacon placed in somewhere, when the a device comes in range of the beacon, some how I have to detect the device(if the device Bluetooth is on) and get some id of the device send notification from cloud server. Where as the device(Android phone) don't know the beacon is there, or there is no app installed on the device to detect the beacon.
I am not sure whether it's possible to achieve the above goal in such a scenario.
Please let me know your valuable feedback.
Chrome 42 or higher for Android supports push notifications from websites, which allows you to send notifications without installing an app.
If you're specifically looking to start notifications from a beacon, Chrome 49 added support for beacons

What technology does GCM (Google Cloud Messaging) use?

Does it work by polling the servers periodically ?
Does it work using long-held http request , like comet ?
Or theres some new technology they are using ?
Here is a good overview: http://developer.android.com/google/gcm/gcm.html
Somewhere it explains that GCM is preferred to the app polling because the Android OS is doing the polling through a long-held OS connection to the GCM server. So even though they call it "push" technology it is really being polled/pulled by the device. The OS then tells the app there is a message and the app retrieves it. Google is just doing the work for all apps through one channel that the OS already uses to check for updates so the device won't be constantly polling as all apps check back to their servers if GCM wasn't used.
There are IDs that help the OS know which app needs which message and the developer needs to set up and maintain a server that helps "push" the messages to device(s). There can be broadcast type messages or messages targeting individual devices. Google outlines a couple of different types of communication mechanisms - HTTP and XMPP.
No real new technology - Google is just providing a platform/interface/architecture for developers.
This info just touches the surface - there is much more detail in the documentation.

Push service implementetion on Android devices

First of all, I know GCM service and I have questions about it too.
If I want to implement a push service, is this the right way; Server waits for connections, Android client connects server and waits for data all the time. So server can send data anytime. Connection is always open with keep alive messages.
About GCM;
Is GCM uses this logic?
Is GCM works on all Android devices? I mean is it guaranteed that if a device using Android OS, it also supports this Google service?
If GCM is not a guaranteed service on Android, how should I handle the case that there is no GCM support on device. Or is this a negligible case?
Is GCM uses this logic?
Generally yes, though bear in mind that there are a lot more details.
is it guaranteed that if a device using Android OS, it also supports this Google service?
No. It is only going to be on devices that legitimately have the Play Store and the rest of Google's proprietary app suite. It will not be on the Kindle Fire, the OUYA, or other devices that are using Android purely from the open source project.
how should I handle the case that there is no GCM support on device
Amazon has a GCM equivalent for the Kindle Fire series, IIRC.
Beyond that, since GCM is not a guaranteed delivery service, you need a fallback plan even for "normal" Android devices.
For example, let's suppose that you are writing an app to show news headlines to the user. In the absence of any push notification, you poll for new headlines every four hours, or when the user presses a "refresh" button in the UI. With GCM, your server can push down headlines as they arrive, which your app can pick up. This gives users on "normal" devices fresher data, but still covers cases where you miss some GCM messages or for devices that do not support GCM.
Adding to what CommonsWare mentions about GCM, you may want to look at MQTT as another pub/sub mechanism; It works on any device that can run Java. Here is a link where I try to explain how it works.
That links applies to LAN messaging but it works over the internet as well. It is the mechanism that the Facebook chat app uses. On that link you will find another link to a git where I show MQTT in use on a simple home automation project. If you have any questions, I can try to answer them.

How does a push notification system works like on Y! Mail app?

I installed today from Market, the Yahoo Mail application and I was reading it offers push message notification technique. Indeed it works, as I got exactly the same moment the alert on my desktop computer and my mobile mail client.
How is it accomplished?
There already is another question discussing how to implement push notification without the cloud to device messaging in older system.
There are several frameworks that give you push abillity. They all require a running a small background thread that is polling a server at a very short interval(Bad for data rate and battery) or keep an open connection to a server that is kept alive somehow and the client is notified every time a new message is waiting on the server.
Have a look at the question and maybe choose on of the mentioned frameworks, the frameworks will reuse the same service for all applications that are installed on the phone using the same framework and therefore save battery and general system usage.
Soon, you will be able to use the Cloud-to-Device Messaging (C2DM) system, though it will require Android 2.2 or higher. You might also want to watch the Google I|O 2010 conference presentation on it, which gives a few clues as to how they implemented it.
Without installing the app, setting up my router to capture packets, and doing some packet inspection I can't tell you exactly how they do it. At the lowest level it's as simple as keeping an open TCP connect to a remote server and having the server sending the client a packet when it needs to do something. My educated guess on the specific way they are doing it is either with IMAP IDLE, or XMPP.

Categories

Resources