User avatar
willwach
Posts: 20
Joined: Fri Jul 06, 2012 8:21 am
Location: Fürstenwalde/Spree near Berlin - Germany
Contact: Website

Android App to shutdown, reboot, ping

Wed Aug 01, 2012 2:04 pm

Someone interested in a little Android App that can
- shutdown
- reboot
- ping (check if RPi is available in net)
the RaspberryPi

I started to create one, but need some tester.
Other ideas or wishes for the app?

godFather89
Posts: 150
Joined: Fri May 18, 2012 9:40 am
Location: Timisoara, RO

Re: Android App to shutdown, reboot, ping

Wed Aug 01, 2012 2:12 pm

Why not use an android ssh client?

User avatar
willwach
Posts: 20
Joined: Fri Jul 06, 2012 8:21 am
Location: Fürstenwalde/Spree near Berlin - Germany
Contact: Website

Re: Android App to shutdown, reboot, ping

Wed Aug 01, 2012 2:19 pm

godFather89 wrote:Why not use an android ssh client?
I like to have a simple solution where I install and insert the credentials once and then controll the RPi by buttons.

Don't like to bind per ssh client and enter the commands by my own.
And it also works for people that are not interested in linux.

For information, the app uses ssh to connect and send the commands.

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

Re: Android App to shutdown, reboot, ping

Wed Aug 01, 2012 2:45 pm

Mod Edit: Moved to Automation subforum as this is a little more advanced than basic setup/usage ;-)
Dear forum: Play nice ;-)

User avatar
willwach
Posts: 20
Joined: Fri Jul 06, 2012 8:21 am
Location: Fürstenwalde/Spree near Berlin - Germany
Contact: Website

Re: Android App to shutdown, reboot, ping

Thu Aug 02, 2012 6:01 am

abishur wrote:Mod Edit: Moved to Automation subforum as this is a little more advanced than basic setup/usage ;-)
Ok, but the shutdown question is a newby question and so it would be interesting to put an info in the basics forum.

What do you think?

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

Re: Android App to shutdown, reboot, ping

Thu Aug 02, 2012 2:59 pm

willwach wrote:
abishur wrote:Mod Edit: Moved to Automation subforum as this is a little more advanced than basic setup/usage ;-)
Ok, but the shutdown question is a newby question and so it would be interesting to put an info in the basics forum.

What do you think?

Asking how to shutdown a Linux box from the CLI is a basic newbie question. Asking how to shutdown a linux box by creating an Android app? That's a much more advanced question and beyond the scope of basic setup/usage
Dear forum: Play nice ;-)

fabi280
Posts: 17
Joined: Wed May 30, 2012 5:36 am

Re: Android App to shutdown, reboot, ping

Thu Aug 02, 2012 7:38 pm

You could setup a http server with php (like nginx with php-fcgi, cause its more leightweight than apache)

Then build up a page with php and jqueryMobile
I built one for you:

Code: Select all

<?php
	switch($_GET['cmd']){
		case "shutdown":
			shell_exec("shutdown -h now");
			break;
		case "reboot":
			shell_exec("reboot");
			break;
	}
?>
	
<html> 
	<head> 
		<title>Home</title> 
		<meta name="viewport" content="width=device-width, initial-scale=1"> 
		<link rel="stylesheet" href="http://code.jquery.com/mobile/1.1.1/jquery.mobile-1.1.1.min.css" />
		<script src="http://code.jquery.com/jquery-1.7.1.min.js"></script>
		<script src="http://code.jquery.com/mobile/1.1.1/jquery.mobile-1.1.1.min.js"></script>
	</head> 
	<body>
		<div data-role="page" id="home" data-theme="a" data-title="RPi Control">
			<div data-role="header">
				<h1>RPi Control</h1>
			</div>
			<div data-role="content">	
				<a href="#confirmation" onclick="$.get(document.URL, { cmd: shutdown });" data-rel="dialog" data-role="button">Shutdown</a>
				<br />
				<a href="#confirmation" onclick="$.get(document.URL, { cmd: reboot });" data-rel="dialog" data-role="button">Reboot/a>
			</div>
			<div data-role="footer" data-position="fixed">	
				<h4></h4>		
			</div>
		</div> 
		<div data-role="dialog" id ="confirmation" data-theme="a" data-title="Confirmation">
			<div data-role="header" data-theme="a">
				<h1>Action performed</h1>
			</div>
			<div data-role="content" data-theme="c">
				<h1>The Action has been performed</h1>
				<a href="#" data-role="button" data-rel="back" data-theme="c">Okay</a>
			</div>
		</div>
	</body>
</html>
Then go to AppsGeyser and create a mobile App for this site. You can also link to Internal IP Adresses.

Ahh dont forget to add the www-data user to your sudoers file, to do this from shell type "sudo visudo" and add on the last time this: "www-data ALL=(ALL) NOPASSWD: ALL"

User avatar
willwach
Posts: 20
Joined: Fri Jul 06, 2012 8:21 am
Location: Fürstenwalde/Spree near Berlin - Germany
Contact: Website

Re: Android App to shutdown, reboot, ping

Fri Aug 03, 2012 6:14 am

hi Fabi280,

nice solution, but I don't like have to install and configure things on the RPi.
For my solution, you only have to start ssh server. On my Raspian it is started automatically.

And than you you have to install the app on your phone, enter the RPi-Host-IP, the username and password and if you have implemented the sudo-pass.
And than it should work.

The intention of this post was to find some interested testers for this beta app and to get more ideas of what can be controlled by the app.
But i found no testers, so i will put it into GooglePlay as Beta and maybe some people like it.
For me it works.

Thanks for your ideas.
fabi280 wrote:You could setup a http server with php (like nginx with php-fcgi, cause its more leightweight than apache)

Then build up a page with php and jqueryMobile
I built one for you:

Code: Select all

<?php
	switch($_GET['cmd']){
		case "shutdown":
			shell_exec("shutdown -h now");
			break;
		case "reboot":
			shell_exec("reboot");
			break;
	}
?>
	
<html> 
	<head> 
		<title>Home</title> 
		<meta name="viewport" content="width=device-width, initial-scale=1"> 
		<link rel="stylesheet" href="http://code.jquery.com/mobile/1.1.1/jquery.mobile-1.1.1.min.css" />
		<script src="http://code.jquery.com/jquery-1.7.1.min.js"></script>
		<script src="http://code.jquery.com/mobile/1.1.1/jquery.mobile-1.1.1.min.js"></script>
	</head> 
	<body>
		<div data-role="page" id="home" data-theme="a" data-title="RPi Control">
			<div data-role="header">
				<h1>RPi Control</h1>
			</div>
			<div data-role="content">	
				<a href="#confirmation" onclick="$.get(document.URL, { cmd: shutdown });" data-rel="dialog" data-role="button">Shutdown</a>
				<br />
				<a href="#confirmation" onclick="$.get(document.URL, { cmd: reboot });" data-rel="dialog" data-role="button">Reboot/a>
			</div>
			<div data-role="footer" data-position="fixed">	
				<h4></h4>		
			</div>
		</div> 
		<div data-role="dialog" id ="confirmation" data-theme="a" data-title="Confirmation">
			<div data-role="header" data-theme="a">
				<h1>Action performed</h1>
			</div>
			<div data-role="content" data-theme="c">
				<h1>The Action has been performed</h1>
				<a href="#" data-role="button" data-rel="back" data-theme="c">Okay</a>
			</div>
		</div>
	</body>
</html>
Then go to AppsGeyser and create a mobile App for this site. You can also link to Internal IP Adresses.

Ahh dont forget to add the www-data user to your sudoers file, to do this from shell type "sudo visudo" and add on the last time this: "www-data ALL=(ALL) NOPASSWD: ALL"

minimattapps
Posts: 49
Joined: Thu Aug 02, 2012 9:04 am

Re: Android App to shutdown, reboot, ping

Fri Aug 03, 2012 7:30 am

I'm happy to make the app for you and others in the community.

It could just work via ssh

mcscruff
Posts: 34
Joined: Thu Sep 22, 2011 5:41 pm

Re: Android App to shutdown, reboot, ping

Sat Aug 04, 2012 7:06 pm

i will test your app. This isn't of use to me at the moment but i will test for you :)

User avatar
willwach
Posts: 20
Joined: Fri Jul 06, 2012 8:21 am
Location: Fürstenwalde/Spree near Berlin - Germany
Contact: Website

Re: Android App to shutdown, reboot, ping

Mon Aug 06, 2012 8:13 am

I put the app in the playstore as beta.

https://play.google.com/store/apps/deta ... Controller

So, feel free to test it and give feedback.
Thanks

mcscruff
Posts: 34
Joined: Thu Sep 22, 2011 5:41 pm

Re: Android App to shutdown, reboot, ping

Mon Aug 06, 2012 8:48 pm

seems to work well. i tested on openelec and will test on raspbian tomorrow

castalla
Posts: 558
Joined: Thu Jul 19, 2012 3:46 pm

Re: Android App to shutdown, reboot, ping

Fri Aug 10, 2012 8:20 pm

Can't get it working on ICS - never gets past the data entry screens.

User avatar
willwach
Posts: 20
Joined: Fri Jul 06, 2012 8:21 am
Location: Fürstenwalde/Spree near Berlin - Germany
Contact: Website

Re: Android App to shutdown, reboot, ping

Mon Aug 13, 2012 7:49 am

Hm, did you insert the settings data like host, user and password.

The app makes no sense without these data inserted. It controlls the RPi over SSH and needs the data to connect. So without these data, the user never reaches the other screens.
castalla wrote:Can't get it working on ICS - never gets past the data entry screens.

castalla
Posts: 558
Joined: Thu Jul 19, 2012 3:46 pm

Re: Android App to shutdown, reboot, ping

Mon Aug 13, 2012 8:00 am

willwach wrote:Hm, did you insert the settings data like host, user and password.

The app makes no sense without these data inserted. It controlls the RPi over SSH and needs the data to connect. So without these data, the user never reaches the other screens.
castalla wrote:Can't get it working on ICS - never gets past the data entry screens.
Yes - entering the data as required but nothing happens.

User avatar
willwach
Posts: 20
Joined: Fri Jul 06, 2012 8:21 am
Location: Fürstenwalde/Spree near Berlin - Germany
Contact: Website

Re: Android App to shutdown, reboot, ping

Mon Aug 13, 2012 9:15 am

Did you try the back-button?
once or twice?
Or stop the app (by app manager. don't delete data.) and start again.
If settings inserted correct, it will start with the startscreen.
But it should be enough to use back button, if all settings are inserted.

I am using it on ICS and Jelly Bean and it works fine.
castalla wrote:
willwach wrote:Hm, did you insert the settings data like host, user and password.

The app makes no sense without these data inserted. It controlls the RPi over SSH and needs the data to connect. So without these data, the user never reaches the other screens.
castalla wrote:Can't get it working on ICS - never gets past the data entry screens.
Yes - entering the data as required but nothing happens.

castalla
Posts: 558
Joined: Thu Jul 19, 2012 3:46 pm

Re: Android App to shutdown, reboot, ping

Mon Aug 13, 2012 9:29 am

okay - hitting back got it working!

Hate the adverts!

User avatar
willwach
Posts: 20
Joined: Fri Jul 06, 2012 8:21 am
Location: Fürstenwalde/Spree near Berlin - Germany
Contact: Website

Re: Android App to shutdown, reboot, ping

Mon Aug 13, 2012 9:48 am

castalla wrote:okay - hitting back got it working!
Fine!
castalla wrote:Hate the adverts!
You like to pay for the app and support?

castalla
Posts: 558
Joined: Thu Jul 19, 2012 3:46 pm

Re: Android App to shutdown, reboot, ping

Mon Aug 13, 2012 10:33 am

There's no need for ads ... unless you are trying to make money.

Either make it free or charge for it.

As it stands, I'd give it a miss.

doobedoobedo
Posts: 36
Joined: Sun Aug 28, 2011 11:03 pm

Re: Android App to shutdown, reboot, ping

Mon Aug 13, 2012 11:58 am

Lol -
willwach wrote:need some tester.
Translation: please help me!
willwach wrote:
castalla wrote:Hate the adverts!
You like to pay for the app and support?
Translation: You helped for free - SUCKER! That €0.03 in ad revenue I will get over the life of this app means more to me than anything.

vinodmadhu6
Posts: 12
Joined: Tue Dec 04, 2012 5:49 am

Re: Android App to shutdown, reboot, ping

Wed Jul 24, 2013 11:44 am

Can i look at your source code of the android app ?

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

Re: Android App to shutdown, reboot, ping

Thu Jul 25, 2013 10:39 pm

Worked for me
Should add a button to install vnc or have a status page for ports like ssh ftp www.

Even add push button install well used programs or do update
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


Return to “Automation, sensing and robotics”