User avatar
abishur
Posts: 4477
Joined: Thu Jul 28, 2011 4:10 am
Location: USA
Contact: Website

Direct notification to Android?

Tue Sep 10, 2013 1:41 am

Does anyone know of a method for directly sending a text or notification to an android device on the same wifi network without going through a cloud service such as NotifyMyAndroid or TextBelt? I thought it would be fun to message an android device on GPIO status but I don't want a cloud service prying into my business :lol: , Plus a lot of those services require you to limit yourself to a very small number of notifications/texts a day (they are free at least)
Dear forum: Play nice ;-)

User avatar
abishur
Posts: 4477
Joined: Thu Jul 28, 2011 4:10 am
Location: USA
Contact: Website

Re: Direct notification to Android?

Tue Sep 10, 2013 1:13 pm

To answer my own question it would appear, from the first response in this link

http://stackoverflow.com/questions/1742 ... net-connec

that the answer is no. I'm a little sad that I can't directly notify an android app on the GPIO changes of my pi, but I guess phone people aren't considering closed network applications on a globally connected device :roll:
Dear forum: Play nice ;-)

mindmasta
Posts: 58
Joined: Tue Feb 12, 2013 8:29 pm

Re: Direct notification to Android?

Tue Sep 10, 2013 4:48 pm

Is sendmail not an option? (Sorry if I'm misunderstanding your question)

You can sudo-apt install it and then send a text that way.... your cell # should have an email address & you can communicate that way....

For example, 8005551234@vtext.com to send an SMS message

Here is a list of gateways:
http://en.wikipedia.org/wiki/List_of_SMS_gateways

You won't need one of the services you've mentioned below, but I think a valid email to act as the sender.

You could always encrypt your message (or use status codes) as an added level of privacy ;)


The only other way I can think of at the moment is to build an interface (maybe some web pages hosted on the Pi) that your mobile device has access to on the home-network.

User avatar
abishur
Posts: 4477
Joined: Thu Jul 28, 2011 4:10 am
Location: USA
Contact: Website

Re: Direct notification to Android?

Tue Sep 10, 2013 5:16 pm

No it's technically an option. What I was really hoping for though is something more along the lines of

1) I install a program on my pi and tell it IP of Android
2) Android phone is told IP address of Pi
3) Pi pushes notification to Android

All contained in a nice no Internet required network.

Alternatively it would be nice if there was a program that listened to a specific port and any time that port got a ping a customizable notification was displayed.

Ultimately my main goal was for it to be simple and for it to be able to work without Internet access. Fortunately, the pi and android both do have internet access if nothing else can work, it's just what I was hoping for :-)
Dear forum: Play nice ;-)

mindmasta
Posts: 58
Joined: Tue Feb 12, 2013 8:29 pm

Re: Direct notification to Android?

Tue Sep 10, 2013 6:42 pm

Ah, Ok.... I think I understand your requirements better now.

Unfortunately I don't have an Android device so I can't say for sure how you would accomplish connectivity to the Pi / network in that fashion. I have my Pi setup as a web/PHP server and created some pages that are accessible from any device on my home network (doesn't have to travel through Internet). The pages allow me to tap the Pi on the shoulder to have it run some commands (e.g. I push a button on the page and Pi takes a picture).

If I were to set the page up to refresh itself every few seconds, I suppose I could then fetch and display a result from the Pi back to the web page, which could essentially accomplish the same thing as a text notification, while not sending out an actual text message. (Currently, it'll send me a text msg) I'd need to think about it more in order to get into the finer details.

I think everything you're looking for could be accomplished w/ some coding & a small custom interface between the Android and Pi. I'm not aware of software like this that already exists, but I could be wrong.

You may not be looking to code it yourself, so maybe someone else will see this post and offer a more feasible solution. (sendmail is probably an easier solution to implement than what I've just described, but as discussed already, sendmail would require Internet)

Good luck!

User avatar
abishur
Posts: 4477
Joined: Thu Jul 28, 2011 4:10 am
Location: USA
Contact: Website

Re: Direct notification to Android?

Tue Sep 10, 2013 7:11 pm

Ah yeah, I've actually set up something else using php/sql/ etc. This is about getting a notification on the phone. That way I don't have to be constantly monitoring the webpage, I just get notified on a change.
Dear forum: Play nice ;-)

stubright
Posts: 123
Joined: Sat Dec 24, 2011 11:12 pm

Re: Direct notification to Android?

Tue Sep 10, 2013 11:48 pm

Could you use an ejabberd server on your pi and then use an xmpp app on your phone, something like Xabber, configured to point to your Pi's local IP address. On your pi you should be able to use sendxmpp to send messages via a script.

I have half dabbled with this using wifi only, the only bit I haven't done yet is successfully sent a sendxmpp message, it's a config issue I haven't had time to looked at. There are also perl scripts available to do the same job.

ejabberd and sendxmpp are in the repositories.
Here's some help pages for each.
http://www.ourace.com/61-installing-ejabberd-on-ubuntu
http://manpages.ubuntu.com/manpages/har ... ctl.8.html
http://manpages.ubuntu.com/manpages/jau ... mpp.1.html
xabber is in google play.

Stu

User avatar
abishur
Posts: 4477
Joined: Thu Jul 28, 2011 4:10 am
Location: USA
Contact: Website

Re: Direct notification to Android?

Wed Sep 11, 2013 12:48 am

My only concern about XMPP is that it will dramatically reduce the battery life of the phone as you have to have a constant connection to the server. That why I specifically asked about sending a text or a notification in the OP, both of those work off the push concept.
Dear forum: Play nice ;-)

txt3rob
Posts: 365
Joined: Sat Aug 11, 2012 3:45 pm
Contact: Website

Re: Direct notification to Android?

Fri Sep 13, 2013 9:55 am

i use textlocal to send texts when my pi boots for external ip and internal ip.

i also use streetunity.org as well to send them :)
The Raspberry Pi Hell Guy - Random Ramblings to assist me and others.
http://raspberrypihell.blogspot.com
My Github - http:/www.github.com/random-robbie/
http://www.smspi.co.uk - send free uk sms via your raspberry pi from here

dian1970
Posts: 1
Joined: Tue Oct 14, 2014 4:21 pm

Re: Direct notification to Android?

Tue Oct 14, 2014 4:24 pm

abishur wrote:My only concern about XMPP is that it will dramatically reduce the battery life of the phone as you have to have a constant connection to the server. That why I specifically asked about sending a text or a notification in the OP, both of those work off the push concept.
can you give me a short explenation how you did it.
because I'm also searching for something like that but I don't know how to start.

User avatar
abishur
Posts: 4477
Joined: Thu Jul 28, 2011 4:10 am
Location: USA
Contact: Website

Re: Direct notification to Android?

Tue Oct 14, 2014 6:25 pm

unfortunately, the long and short I got was you can't do this. You have to go through official routes to send a text to a phone. One thing I thought of, but never got a chance to pursue, was something along the lines of broadcasting a dummy packet on a specific port of the network (something random and unused), the pi program could listen for that and based on what port it was display a message.

Of course, that would probably also make a dent to battery life as the program would be always on and listening. Let me know if you ever work anything out on this.
Dear forum: Play nice ;-)

Return to “General discussion”