Capture RRC state log in android - android

I am trying to capture RRC state logs which change time to time in mobile devices based on network usage .As of now the only way possible is to run special codes E.g "*#0011#" from dialer which is an inbuilt feature of device and cannot be run as a service in background.
Assuming i know the code to turn RCC state capture on, how can i log this in background in a file ?
Also is there anyway to capture and store logs that come up in adb logcat even when device is not connected to a computer ? assuming device keeps generating similar logs even when not connected to android adb shell.

Related

How to use the USB_DEVICE_ATTACHED intent-filter in Android for a USB device that is always connected

I have a scenario where I want an app to open when it detects that it's connected to a USB device. I have used an approach similar to this (it is using a USB_DEVICE_ATTACHED intent-filter and I have the ID's defined in an xml) and it is working for the most part. The problem I'm having is that when the Android Tablet powers on, the tablet will already be connected to the USB device, so the app doesn't get the USB_DEVICE_ATTACHED event. This then requires me to start the app manually after power up, which leads to me getting this unwanted dialog screen each time:
Allow App to access USB?
[ ] Always open App when USB is connected
Cancel OK
It makes no difference if I check the "Always open" box. It still shows up each time. I have tried using a broadcast receiver to open the app when the app powers on, and I still get the dialog window.
So I'm wondering:
Is there is a way to see get a USB_DEVICE_ATTACHED event when I first power on?
Or is there a way to not display the unwanted dialog screen each time I open the app manually?
I would really appreciate any suggestions. Thanks!

Can I launch a specific app when android device get physically connected to a specific usb device?

Can I "register" a (already installed) specific app to be launched when android device get physically connected to a specific usb device ?
Eg.
I connect a keyboard (of a certain brand or with a special USBid/class) and it automatically launch a text editor app
I connect an USB soundcard and it launches an audio app.
And "better", is there an autolaunch on Android ? I plug a keyboard+storage device to my smartphone and Android will ask me if I want to install the apk from the storage (or download it from predefined url)
Obviously for security reasons I understand installing the app from the storage will need confirmation by user. But, once the app has been "registered" would it be possible to launch the app automatically without having a confirmation screen ?
I know I could get USB info with android.hardware.usb.usbdevice. My question is more about how I can tell Android to launch this app rather than another when usb device is connected.
I think you could register your app to receive a system broadcast like USB_ACCESSORY_ATTACHED and make the logic to launch your app when this happens.
Check https://developer.android.com/guide/components/broadcasts
https://developer.android.com/reference/android/hardware/usb/UsbManager.html#ACTION_USB_DEVICE_ATTACHED

Android app to send and receive a file automatically when get connected via bluetooth

I am new to android world.I want to design an android app in which all connections will be through bluetooth. It will works as follows
as I click some button like start it will connect to one of the paired devices(mobile) and get a file, store it somewhere and eventually disconnect with that device.Then it will connect to the second device, get a file, store it and then disconnect with that device and so on. It will repeat the same procedure for all the paired devices.
And later on I will replace those paired mobiles with sensors and will collect the the data.The whole process should be automatic without user's intervention.
Guys please help me. Is it possible for a mobile to send a file automatically as it connects to a particular mobile.

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.

capturing another activity's screen in android

is it possible to have a service (A) which will launch an activity (B) and then periodically capture B's screen?
also, is it possible to send onTouch events from A to B?
basically, i'd like to make a bot which would use an application so i don't have to.
i guess it's not possible but had to ask.
You can't do that across Activitys but you could create a view that held the Activity that you want to automate. Then periodically you can grab the ViewDecorator and do some processing on it and then inject touch events.
Screen captures of apps which are not the current app are prevented in Android devices due to security considerations.
As far as I know up until Android 4.3 you can only do this in these scenarios:
Your device is rooted
Your app is signed with the same signature of the system (Google apps)
With adb (debug environment): your device is connected via USB to a PC which is running adb shell commands, or either the USB is disconnected but you have started the native adb service in your device after each device reboot.
Some useful links:
How to programmatically take a screenshot in Android?
How to make a capture screen app on Android
http://code.google.com/p/android-screenshot-library/wiki/UserGuide

Categories

Resources