[Q] Script to send files - Android Q&A, Help & Troubleshooting

Hello!
I am a complete newbie into Android scripting; I'll need help all the experts here.
I am asked to make a script that will run in the background and send any particular file over the email to me. Is it possible to do it with batch scripting or I'll have to code an app in java for that purpose?
If it can be done, can you experts help me out with it?
Thanks!

You cannot run batch scripts on android phones.You could inky run shell scripts.But you cannot use it to send emails automatically because it is run only once at the time of boot though you could loop the scrilr back after a pause making it never ending,its not adviced.Also you cannot attach a attachment to a email client with shell.
I would recommend writing an app.But that too has restrictions like not able to add atachment from locked partition like data without root.And finally code and use it responsibly.Donot code it to steal user data like apps,contact info etc...
Sent from my GT-N7000 using xda app-developers app

Related

[HOWTO] Use WinSCP for Android

Coming from the world of apple iphone I am learning everything new here. One thing I loved about iphone was the ability to use WinSCP to modify root files. I understand that this can be done on the phone with in andriod but I have big hands and find it easier to use Winscp and mouse to navigate files on the phone.
Note: Mod if this in wrong section please help move
*Prerequisites: ROOT
*Tools required: SSHDROID (from market place it is free). Winscp
Install SSHDROID
Install WInscp (your pc will restart after install)
Connect your phone to your local wifi
open sshdroid, allow SUPER USER
in winscp type in ip address of phone (can be found by going to with in sshdriod screen)
Default User name is "root"
Default Password is "admin"
recommend changing... both user name and password
USer name can be change when first logging in winscp, password can be change with in SSHDROID in setting.
there you go you can now explor root files with in winscp with mouse and keyboard.
update : pictures of it working
nice, i never really bothered with this before, but its a good idea and probably worth the short amount of time required for setup, i'll try this later.
Yeah, Thanks... I remember when I came over from icrap, I was looking for a way to SSH, but gave up and just used rootexplorer for everything, and adb. This will definitely help though, especially since I like to edit the build prop on the pc.
**Edit**
Works great... so much easier to browse now. IMO
does this work to show system files? I use Samba Filesharing from the market to view my files through integrated windows networking (samba), but the system files don't show, just the sdcard.
stvmac11 said:
does this work to show system files? I use Samba Network Fileshare from the market to view my files through integrated windows networking (samba), but the system files don't show, just the sdcard.
Click to expand...
Click to collapse
Yes, he says it displays root files, and system files fall under that. I haven't tested myself so I can't personally testify but I'd be inclined to trust the OP on that.
Sent from my MB860 using XDA Premium App
raybond25 said:
Yes, he says it displays root files, and system files fall under that. I haven't tested myself so I can't personally testify but I'd be inclined to trust the OP on that.
Sent from my MB860 using XDA Premium App
Click to expand...
Click to collapse
thanks for the reassurance, i guess i overlooked it.
i also came from an iphone too, so accessing the whole system is important.
thanks OP
upload picture =P
Working verry good i was looking for a way to acces my HD2 the same i acces my Iphone 4 10x
Screens:
I am getting errors when attempting to copy files to the device. For example, I am attempting to add a font to /system/fonts but get this message
General failure (server should provide error description).
Error code: 4
Error message from server: Failure
Request code: 3
Thinking it has to do with permissions, I just don't know what. Any help would be appreciated!
mrloserpunk said:
I am getting errors when attempting to copy files to the device. For example, I am attempting to add a font to /system/fonts but get this message
General failure (server should provide error description).
Error code: 4
Error message from server: Failure
Request code: 3
Thinking it has to do with permissions, I just don't know what. Any help would be appreciated!
Click to expand...
Click to collapse
same problems here...I think it has to do with sshdroid dropping comms...
edit: looks like device full...
Thanks! Worked flawlessly! I was looking for this since i moved over from iphone..Very handy and quick!
I can confirm that using SSHDroid in combination with WinSCP, will preserve the file time stamp (modified date) when copying files from Windows to Android 2.3.5 or Android 4.4.2. Most copy methods will update the file time stamp. (I don't think it makes any difference but both of the devices were rooted.)
Markanski said:
I can confirm that using SSHDroid in combination with WinSCP, will preserve the file time stamp (modified date) when copying files from Windows to Android 2.3.5 or Android 4.4.2. Most copy methods will update the file time stamp. (I don't think it makes any difference but both of the devices were rooted.)
Click to expand...
Click to collapse
I can confirm that you resurrected a thread thats been dead for 2 years on a device that has not seen the 4.4.2 update.
Sent from my MB860 using xda app-developers app

Need help with basic java!

Hi Everyone,
I am trying to code my first android app, which is an app that will copy some files from the app's asset folder to /system/app, adjust permissions and let the user know the process has been finished. I am a systems person, not a programmer, so know all of the details as to what has to get done. I create some scripts in /assets, and have the files I want to copy in /assets as well.
How do I go about programming this? Is this the right method I'm looking at doing?
danifunker said:
Hi Everyone,
I am trying to code my first android app, which is an app that will copy some files from the app's asset folder to /system/app, adjust permissions and let the user know the process has been finished. I am a systems person, not a programmer, so know all of the details as to what has to get done. I create some scripts in /assets, and have the files I want to copy in /assets as well.
How do I go about programming this? Is this the right method I'm looking at doing?
Click to expand...
Click to collapse
Can I have the files? I'll try to do this for you
Sent from my Galaxy Nexus using Tapatalk
Better to help him instead of doing it for him, that way he learns more and gets his hands dirty. =p
Hehe, thanks for the response guys!
Anyways, tycoon177, thanks for signing up to help me!
I have zipped up everything I have related to the project, it is pretty simple, I just want to copy some files from the progrsm into /system/app, I have created an install and an uninstall script (although I haven't tested them just yet, not sure how I would do that right now) and have placed those scripts in the /assets/scripts folder. The goal is to copy the files into the proper locations, in order for the Kobo Vox to get access to the Android market. I have devised some instructions and posted them in the following forum page ( http://www.mobileread.com/forums/showthread.php?t=160948&page=1 ), but a lot of users seem to be messing up their system (they aren't a technical bunch) so I figured I should try and learn java and build an app for all of this...
Unfortunately this is a little beyond my abilities, but my intro to Java course starts tonight hehe.
Anyways, the project name is called OogleVox, it won't need to be going onto the Android Market, and will probabably just be an apk download from one site or another.
The link to the source code is here:
http://www.multiupload.com/ASI47S2BM4
Thanks again for your help!
danifunker said:
Hehe, thanks for the response guys!
Anyways, tycoon177, thanks for signing up to help me!
I have zipped up everything I have related to the project, it is pretty simple, I just want to copy some files from the progrsm into /system/app, I have created an install and an uninstall script (although I haven't tested them just yet, not sure how I would do that right now) and have placed those scripts in the /assets/scripts folder. The goal is to copy the files into the proper locations, in order for the Kobo Vox to get access to the Android market. I have devised some instructions and posted them in the following forum page ( http://www.mobileread.com/forums/showthread.php?t=160948&page=1 ), but a lot of users seem to be messing up their system (they aren't a technical bunch) so I figured I should try and learn java and build an app for all of this...
Unfortunately this is a little beyond my abilities, but my intro to Java course starts tonight hehe.
Anyways, the project name is called OogleVox, it won't need to be going onto the Android Market, and will probabably just be an apk download from one site or another.
The link to the source code is here:
http://www.multiupload.com/ASI47S2BM4
Thanks again for your help!
Click to expand...
Click to collapse
I don't know what Kobo Vox is, but for android, in general, the /system partition is read only, and on most devices the MMC or eMMC is locked so that it can't even be remounted read/write. Also, any user app won't be able to gain the required permissions to write to /system/app even if the partition was unlocked and mounted read/write. If you are rooted and security allows you write access to the MMC/eMMC, then you'd need su to gain the required permissions from the OS.
Gene Poole said:
I don't know what Kobo Vox is, but for android, in general, the /system partition is read only, and on most devices the MMC or eMMC is locked so that it can't even be remounted read/write. Also, any user app won't be able to gain the required permissions to write to /system/app even if the partition was unlocked and mounted read/write. If you are rooted and security allows you write access to the MMC/eMMC, then you'd need su to gain the required permissions from the OS.
Click to expand...
Click to collapse
Thanks Gene Poole, I know this app will require root permissions, which will require a run as su. That's going to be a requirement for the app
Questions or Problems Should Not Be Posted in the Development Forum
Please Post in the Correct Forums
Moving to Q&A
Sorry, I did not figure this out..
Sent from my Galaxy Nexus using Tapatalk
tycoon177 said:
Sorry, I did not figure this out..
Sent from my Galaxy Nexus using Tapatalk
Click to expand...
Click to collapse
Thanks for trying! I'm taking a Java course at school now, maybe I'll be able to figure this one out in due time.
If you want to write app before learning java you could use basic4android. You could use its phone library to execute the commands direct and as you can also issue adb commands etc with it you could also have your app more interactive whereby it could check for things you know cause problems and react accordingly.
The site is basic4ppc.com I think, it would allow you to quickly and easily code an app and as with eclipse and other ide's it produces native standalone apk files signed and ready for use.
Dave
Sent from my LG P920 using Tapatalk

Help writing Recovery Style C++ app

Hi all.
I searched this site for examples of how to create an app that would pause during the boot process and allow the user to interact with the system then continue. I want to modify my custom ROM's normal boot process. If I could get a shell script to display on the console that would be great!
Anyway this is what I want to do...
For example:
- Power on
- Load Kernel
- init -> init.rc -> runs "myApplication"
- Boot process halts and waits for the user to enter some data.
- "myApplication" exits and the boot process continues.
It seems simple but I cant seem to figure out how to create a screen that would display. I tried to read the recovery.c (from the ASOP source code) application for assistance but since I'm not a seasoned C++ programmer its very slow moving. Plus recovery.c is doing too much and I can see/or figure out what I need to do first.
If someone knows of a website or have a sample app I could start from that would be great.
All I need to know how to do is;
Create an app that interacts with the screen during boot phase. I just need an example of how to take over the screen and print simple text to the screen like "Hello World". I want to build something similar to the recovery.c application.
I think I can figure out how to use the buttons later. ( maybe)
I think I may need the following files in the ASOP_SOURCE/bootable/recovery/ directory ; minui/*, screen_ui.c and ui.c
Thanks
C
CooLC1 said:
Hi all.
I searched this site for examples of how to create an app that would pause during the boot process and allow the user to interact with the system then continue. I want to modify my custom ROM's normal boot process. If I could get a shell script to display on the console that would be great!
Anyway this is what I want to do...
For example:
- Power on
- Load Kernel
- init -> init.rc -> runs "myApplication"
- Boot process halts and waits for the user to enter some data.
- "myApplication" exits and the boot process continues.
It seems simple but I cant seem to figure out how to create a screen that would display. I tried to read the recovery.c (from the ASOP source code) application for assistance but since I'm not a seasoned C++ programmer its very slow moving. Plus recovery.c is doing too much and I can see/or figure out what I need to do first.
If someone knows of a website or have a sample app I could start from that would be great.
All I need to know how to do is;
Create an app that interacts with the screen during boot phase. I just need an example of how to take over the screen and print simple text to the screen like "Hello World". I want to build something similar to the recovery.c application.
I think I can figure out how to use the buttons later. ( maybe)
I think I may need the following files in the ASOP_SOURCE/bootable/recovery/ directory ; minui/*, screen_ui.c and ui.c
Thanks
C
Click to expand...
Click to collapse
Man you can ask to Hashcode of Droid Razr forum or Dorimanx on S2 forum, they make similar thing
Sent from my HTC One X using xda app-developers app

[Q] Compiling help a noob.

Im writing a Network Scanner currently in Python/Kivy for Android. I could do everything i wanted if i could execute a Python module called Scapy from the shell(Obviously this is a rooted app), but unfortunately its not possible. Atleast not with alot of work and when the App is finished i dont want my users to have to go through installing countless dependencies to get it working!
I've stumbled along a little unix program called Arp-Scan but i cant find a port for Android. I'm not sure how to port this to Android so i can execute it from a shell.
I have no experience with compiling and needless to say this is frustrating the hell out of me! . This one little stumbling block has been plaguing me for 2 weeks. The rest i will be able to do in pure Python, namely PortScanning and such.
The way the Android OS works is that an APK is unable to use raw sockets. But you are allowed to run a shell as root.
I have the option to use Nmap but if there was ever to be a paid version of my app i would have to buy a license and i simply cant afford it.
All i need is to execute a program from shell: like Arp-Scan to obtain an IP and MAC from the LAN.
Any help will be greatly appreciated.
Thanks in advance.

Is it possible to install an app directly without pm?

Hello,
I am starting to get involved in some android internals and was curious as to how the application installation process works (the nitty gritty). I know you can use tools like /system/bin/pm to install an apk, but what exactly is that doing?
Can you 'mimic' pm's behavior to get an app installed. I assume you'd have to spoof some messages to installd?
I don't fully understand the chain of events that happen when an apk is installed via the command line. Any one out there able to shed some light?
Thanks!!

Categories

Resources