Go Back   Android Forums > Android Development > Application Development
Application Development Dev Lounge for the Coder Folks
Gamers - Check out our new sister sites!
Nintendo Wii U!    |    OUYA - $99 Android System!

test: Reply
 
LinkBack Thread Tools
Old February 7th, 2012, 01:23 AM   #1 (permalink)
Junior Member
Thread Author (OP)
 
Join Date: Feb 2012
Posts: 20
 
Device(s):
Carrier: Not Provided

Thanks: 0
Thanked 1 Time in 1 Post
Default How can I send commands to my desktop?

I have ConnectBot and right now I'm manually typing commands which I would like to run on my desktop machine remotely. I'd like to create an Android application with a user interface where I can just tap a button and had it run an associated command. I'm assuming I would need to continue doing this via SSH so is there a SSH library for Android which I can use to connect to my desktop? Is there a simpler way of doing this?

Deemar is offline  
Reply With Quote
Sponsors
Old February 7th, 2012, 08:57 PM   #2 (permalink)
Junior Member
Thread Author (OP)
 
Join Date: Feb 2012
Posts: 20
 
Device(s):
Carrier: Not Provided

Thanks: 0
Thanked 1 Time in 1 Post
Default

Am I asking this question properly? All I'm looking for is some simple example code for how to connect using SSH in Android. I can't seem to find any working code anywhere.
Deemar is offline  
Reply With Quote
Old February 8th, 2012, 03:45 PM   #3 (permalink)
New Member
 
Join Date: Feb 2012
Posts: 3
 
Device(s):
Carrier: Not Provided

Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi,

It isn't exactly what you need but you could take a look at this OS project:
premotedroid - PRemoteDroid - Google Project Hosting.

Among other things it allows you to browse files on PC from your Android phone. With little modification it could be executing commands. It is not using ssh though but plain unsecure sockets. It's just a good starting point if you need some working example.
crimsonpine is offline  
Reply With Quote
Old February 11th, 2012, 09:50 PM   #4 (permalink)
Junior Member
Thread Author (OP)
 
Join Date: Feb 2012
Posts: 20
 
Device(s):
Carrier: Not Provided

Thanks: 0
Thanked 1 Time in 1 Post
Default

That's pretty cool, thanks for posting that I'm looking for something much simpler though, there are a pile of SSH classes out there compatible with Android and there are tutorials/examples included yet I just can't get neither of them to work, they all crash on my emulator and won't run on my phone's version. I've been programming for years and I know Java well, I just can't seem to get these classes to work properly.
Deemar is offline  
Reply With Quote
Old February 12th, 2012, 03:34 PM   #5 (permalink)
Member
 
Join Date: Oct 2011
Location: Sydney, Australia
Posts: 193
 
Device(s): Galaxy Nexus GSM
Carrier: Not Provided

Thanks: 2
Thanked 37 Times in 33 Posts
Default

Quote:
Originally Posted by Deemar View Post
I've been programming for years and I know Java well, I just can't seem to get these classes to work properly.
So tell us exactly what you've tried and what you were able to diagnose when your tries didn't work. We should be able to kick off from there.
jiminaus is offline  
Reply With Quote
Old February 12th, 2012, 07:08 PM   #6 (permalink)
Junior Member
Thread Author (OP)
 
Join Date: Feb 2012
Posts: 20
 
Device(s):
Carrier: Not Provided

Thanks: 0
Thanked 1 Time in 1 Post
Default

Quote:
Originally Posted by jiminaus View Post
So tell us exactly what you've tried and what you were able to diagnose when your tries didn't work. We should be able to kick off from there.
I downloaded the Chilkat library and tried running the example found here. After changing it a bit to work with my package names and import the required libraries I got it to run. However when the emulator starts up and runs the program, it just crashes on the emulated device causing it to force a close.

I downloaded Dropbear and Ganymed but both of those seem to be straight Java implementations, not Android specific. The libraries used in them aren't part of the Android libraries. Same with Jaramiko.

I also tried SSHJ but that also had the same issue with just crashing and forcing closes. Plus I read somewhere it's not supported in Android 4.

I tried JSCH, same issue with forcing closes.

Lastly I tried Trilead but couldn't find any sort of documentation on how to use it.

Anything I can get to compile and run as an example simply forces a close when I run it, nothing else happens. I'm using the correct port on my internal network (192.168.0.194) and the proper username/password written directly into the code. Whenever I use that username/password/IP in a terminal, I can connect via SSH no problem. I can also connect using ConnectBot from my phone and those credentials.
Deemar is offline  
Reply With Quote
Old February 13th, 2012, 04:20 AM   #7 (permalink)
Member
 
Join Date: Oct 2011
Location: Sydney, Australia
Posts: 193
 
Device(s): Galaxy Nexus GSM
Carrier: Not Provided

Thanks: 2
Thanked 37 Times in 33 Posts
Default

I'm confused about your experience with Chilkat. You say you got it to run, but then you say it crashed on startup. Do you just mean you got it to build?

If an application force closes, it's because of an unhandled exception. This exception will be logged into logcat. As you know from being an experienced Java developer, the details of an exception will give you a clue as to what's gone wrong.
jiminaus is offline  
Reply With Quote
Old May 26th, 2012, 08:41 PM   #8 (permalink)
Junior Member
Thread Author (OP)
 
Join Date: Feb 2012
Posts: 20
 
Device(s):
Carrier: Not Provided

Thanks: 0
Thanked 1 Time in 1 Post
Default

After long hours spent working on this and code which doesn't work, I'm willing to pay someone to write some simple lines of code that send commands to a desktop via SSH. Very simple. Anyone interested?
Deemar is offline  
Reply With Quote
Reply


Go Back   Android Forums > Android Development > Application Development
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -5. The time now is 03:00 PM.
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2013, vBulletin Solutions, Inc.