Retrieve adb logcat files from a client's device - android

I'm making an app for a client, and they are experiencing bugs that no one else can reproduce. They are not close to us, so I can't physically go to them and hook their device up to my laptop.
Is there a way that they can get hold of their logcat files without having to install adb on a machine first, i.e. can they email them straight from their device? I'm not sure how tech-savvy they are, and ideally I don't want to spend too much time telling them how to install adb if I can get the files some other way.
Obviously I'm looking to do it with their permission (and I'm expecting that installing adb is going to be the only way).
Edit: I should add that I'm using Corona SDK, so will not be able to access the logs from directly inside the app. Also, all devices are 4.1+ so the various log collector apps have not worked.

You can redirect the logcat to a file and send it by email using your app.
Check here how to save the logcat into a file.

Related

How to block specific urls in Android

I am developing a parental kind of App in which there is a requirement to block specific urls from all the browsers in the Device. I think this is an old question but couldn't find any solution yet on stack.
Do you have any working solutions. Assumption - The device is rooted.
Regards,
sha
I have two resources for you:
Since the device is rooted you can work directly with iptables. iptables will give you very precise control over all coming and going data packets. Check out open source projects like AFWall+ on GitHub for iptables in action.
If you want to be able to run your app on unrooted devices look into creating a fake VPN. You don't send any data to an actual VPN server, you simply use the VPN API to filter all the information coming and going. Check out Disconnect (whenever they actually share their open source code...) or OpenVPN which is what Disconnect builds on.

Fake incoming call

I am looking for a way how to automate incoming calls for testing with MonkeyTalk. That means I can run some external scripts. In our Continuous Integration tool I need something capable of running in the headless mode.
WHAT I TRIED
DDMS
Telnet
ADB
DDMS from Eclipse is not the way to go as it supports only GUI.
Telnet seemed like a good choice but it's a pain in the ass to write some command line scripts for it. In Windows I didn't make it. There exists some ways in Linux though.
ADB offers only outgoing calls by using the famous
adb shell am start -a android.intent.action.CALL tel:1112223333
With ADB I also tried to invoke a broadcast with extra state ringing but NO...
QUESTION
How can I fake an incoming call to an emulator using a script? I need to set my own number, of course.
On google's android studio I think it gives you access to internet & google accounts. You could just log in, install "hangouts dialer" from the play store, then (on another phone, with a different google account) call the previously used google account. I haven't tested this though, and I don't know if the phone handles this as an actual call or just opens hangouts.
Alternatively, you could just set up two emulator instances and dial the console port number, in the window title "Android Emulator #####", as said in this question.

How do I gain access to the application logs on an Android TV device?

I want to be able to access logcat for an app running on an Android TV device, but the TV only has a USB plug not micro-USB.
The Android TV device is
Running a custom Android 4.2.1 ROM (from manufacturer)
Doesn't provide access to device settings
Only has USB plugs
Environment#getStorageState() is always MEDIA_REMOVED
How can I get access to the application log?
You refer to
access logcat for an app
If "an app" is one that you are developing, then although Android now restricts installed apps from seeing the global logcat output, it still allows you to access data that your own process sends to logcat (whether from your own code, or from framework code that runs within your process). It's a simple matter of getting your app to run the logcat command on the device to send the data to a file, and then uploading that file to a webserver somewhere so you can read it.
(Read logcat programmatically within application gives the general principle, which is to exec the logcat program, and then read its output).
If however you are trying to get the logcat output from all the apps on the device, then getting adb working in some form is your only viable choice.
I assume you can install apps on the device, by placing them on an external website and downloading them using the device's webbrowser, then opening the downloaded file.
Thus you may be able to install a settings app extracted from a 4.2 phone, which might allow you to turn on adb debugging (though as you point out, the physical cabling is unusual).
For those facing a similar issue, the solution I have chosen is as follows:
Created a replacement for Android log that decorates Android log but also logs to a log4j RollingFileAppender. This was necessary because the circular logcat buffer on some of the devices was so small that it only contains 5 minutes of log.
Added a menu action that posted all the log4j log files to a web
server
Added a Servlet to my web server to capture client log files and
write them somewhere meaningful.
This seems to work reasonably well.
Aside from item 1 it is pretty the same as zmarties suggestion.

How can I send messages back and forth between ADB shell and an Android app?

I've been looking for an answer or the past 3 days, and haven't yet found one that works. I'm trying to write an Android app that can be controlled from ADB with custom commands. Is there anyway I can send strings back an forth between an app and an ADB shell?
Thanks in advance, and sorry for my noob qustion.
Sure, there are several ways to do this.
You could use a unix domain socket, and open it from both the android app and from a command line executable you would build by abusing the ndk, push to a version-dependent location on the device (/data/local, /sqlite_stmt_journals, etc) and run. Edit: in more recent android versions there may not be such writable/executable directories. You may have to have the app itself write the executable out to its private directory and set global read and execute permissions on it. Further Edit: adb can forward unix sockets, too.
Same thing with an internet socket, only now you have the option of setting up an adb port forward (provided the android app is the 'server' end) so as to communicate from a process running on your development machine directly with the android app, without passing data through the adb shell. Unless declaring internet permission is objectionable (it should be less of a concern than letting your PC-side app "drive" adb) this is probably the method that would stick closest to "official" capabilities and have the least android version dependence. It also can be trivially adapted to communicating over wifi.
You could use a pair of fifos and write and read them with shell commands (for portability, create them in the app's private storage but make them world readable/writeable)
you may be able to play some games with a pty
you could I suppose use files as mailboxes
you can use the 'am' command to send Intents (useful at least to start up the android app, if a bit inefficient for the communication)

How to know what data an Android app is sending out

How would you find out what kind of information an Android app is sending back to the "mothership"? For example, if an app is sending your ID, gender, etc. to advertisers.
Is there a way to do this in an Android app? Or would it have to be done via a packet sniffer over Wi-Fi?
Root your device.
Find a copy of tcpdump for Android
Launch tcpdump, capture a dump file.
Analyze offline with something like Wireshark.
You might check Android packet sniffer.
Unfortunatelly, you have to be root on your phone, and have the "su" command installed.
The TaintDroid project does exactly this. Installing it isn't as simple as just installing an app (of course), but they provide pretty detailed instructions. This tool has been used for exactly the purpose of detecting what kind of information an app is accessing and sending to some external source. They also provide the source code if you want to modify it for particular purposes.
The permissions tell you what data it is accessing, for example "Phone State" means getting the phones ID, Coarse or Fine Location is a permission to, so for network or gps location you need to be made aware.
Other data is behind other permissions. So if they aren't cheating you can somewhat figure out what they are using.

Categories

Resources