Debugging my android for an issue with wifi - android

I am new to Android SDK. Maybe someone here can show me how to debug the following problem I have with my Android enabling and keeping the wifi switched on.
I have myself a Samsung Galaxy ACE s5830 which I got just few days back and had found this problem where the phone just displayed error while switching on wifi. I then restarted the phone and found that wifi was working fine. After this I began noticing that the phone occasionally (two or three times a day) got hung up with a blank screen while the keypad is locked (while charging and while idle). When I tried unlocking the keypad, the phone do not respond. I would then have to disconnect the battery or press and hold the power key for 10 seconds to bring my phone back to life. However, I can see that if I switch off wifi, the phone does not get hung up.
I have installed SDK and Dalvik Debug Monitor in my PC but I would like to know how I will be able to debug this issue with the phone connected. Thanks in advance.

If I understand correctly, this issue occurs when you are on a charger with wifi active and the device goes to sleep.
You might attempt to understand the issue by connecting the phone to your computer via usb and leaving "adb logcat" or its DDMS-window equivalent running, and see if anything interesting is shown if it dies. But you may just get buried in extraneous messages until you have some real familiarity with what is normal (lots of weird errors/warnings all the time) and what isn't. After a restart you can look at things like /proc/last_kmsg
Incidentally, if the problem happens on the mains charger but not when connected to the pc (just connected, SD card not mounted and DDMS not running), that could suggest the culprit is electrical noise from the charger.
Or you could attempt to work around it. Some devices have in their settings menu an option to stay "on" whenever connected to a charger.
I believe that you could also write an application which listens for ACTION_BATTERY_CHANGED intents, detects that you have gone on the charger, finds out if wifi is on, and if it is acquires a wakelock. You'd also look for going off the charger or disabling wifi, at which point you would release the wakelock.

Related

Android message “Allow <app name> to access <device-name>? (responded OK) continually repeating while app is in use over USB

We have an ultrasound scanner that connects to our app on Android devices via USB or a built-in WiFi mini-router.
When connected over USB, one of our customers randomly gets the message “Allow to access ? [set to OK). Also, an option to “Always open when is connected?” (shouldn’t be related, but tried both on and off). Brand new Samsung Galaxy Android S8 Ultra Tablet.
Unable to duplicate in our offices, even when using the same model ultrasound and same model tablet. As expected, the message only appears on a new Android or after a factory reset. It also runs fine at numerous other customer locations.
Tried (1) Android setting “Allow Notifications” off and on, (2) “Notification Categories” indicates “This app hasn’t sent you any notifications.” (3) WiFi and Bluetooth both off and on, (5) both Android and the app are current, (4) neither Samsung nor Google has had any other suggestions,
Not sure if/how this might factor in. When connecting via the built-in WiFi, any Android or iOS device quickly drops the signal while inside the building, but runs fine in the parking lot or elsewhere. Unfortunately, too many other companies in the building to start shutting off routers, and where this occurred at other locations, changing the WiFi channel in the app, turning off other routers, or resorting to the USB cable always solved it.
Any suggestions much appreciated. Thanks, David

How not to loose phone charge when connected with USB for prolonged period of time

I have a Android device which I keep connected with my Jenkins server(through USB) which basically run my automation every day at a specified time but every now and then I keep running into problems where device starts to loose charge overnight or when I am remotely accessing(Vysor) the device and run some automation tests on it , it starts to loose and eventually die down. I am looking for suggestion to keep my device up and running 24/7 without loosing charge when I am running my automation cases.
I had tried all of the options you mentioned. I am now using powered USB hub which keeps it charging on power 24/7.
There are some things that you can do to keep your Android device from going to sleep.
enable developer mode (I assume you have done that already since you
are running automatic tests).
on settings->developer menu turn USB
debugging on (again I assume this is already done)
on settings->developer menu turn on Stay Awake so that the display
never goes to sleep when the device is charging.
It may also be that the issue is with your device. In that case I suggest you try the same thing with some mainstream Android phone and see if the behavior differs.

Wake up device when program is run/debugged in Android Studio?

Most of my development devices have OLED displays, so they can't safely have "Stay Awake" enabled under "Developer Options" (I've ruined WAY too many devices using it in the past). But having to continuously keep picking up the device to hit the power button every time I re-launch something within Android Studio is driving me insane.
Is there any way to configure the devices and/or Android Studio to allow the screen to time out and turn off as usual, but automatically turn it back on again whenever I do something via ADB?
For what it's worth, I tried disabling lockscreen security, but launching a program or debugging session via shift-f9 or shift-f10 while the screen of the ADB-connected device is off still fails to turn it on.
Before starting the app, run
adb shell input keyevent KEYCODE_POWER
to wake up the device
write this code in Oncreate and before Setcontentview :
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
screen will never sleep with this code.

Locked Phone Without Internet connection

I recently locked my phone (Samsung Galaxy S2) and I cut my WiFi and data off before it became locked. There for I can not log in to my google account. Can someone help me find a easy way to unlock it without factory reset or just find a way to cut my WiFi or data on? I have tried pressing the home button a amount of times and calling my self and pulling down the notification bar or pressing the back button but none of these options work.
If you USB debugging mode is 'on', you can try unlocking it via adb shell. I found this guide on googling:
http://maxoberberger.net/blog/2013/08/unlock-android-device-using-adb/
None of the options like adb or entering null password or calling worked for my Galaxy Y. But I found this software to backup phone data like contacts,memos,schedules,etc to my pc.
http://www.samsung.com/us/kies/
Since factory reset doesnt affect your sd card, you can later transfer the backup from pc to your phone.

Auto Power on Android when the charger is Connected

I'm Developing an Android Application where it's constantly required to keep the App up an running at all time. with the phone connected to a power outlet at all time, Is it possible that if the phone's battery died to Auto-start up the app with no user intervention . *i.e to power up the phone automatically without hitting any power button and start up android since charger is connected. *
then start up my app with android.intent.action.BOOT_COMPLETED and RECEIVE_BOOT_COMPLETED permission
PS: I have tried android.intent.action.ACTION_POWER_CONNECTED but it only works if the phone is already powered up.
I have exactly same requirement as yours.
Can we plan a solution like this:
The Android device is always connected to charger's output.
Charger's power supply is connected to a custom made hardware device which controls power supply to charger.
This hardware device puts charger off until battery is getting low. i.e. 20% remaining.
Once battery is less than 20%, that device automatically switch on the charger.
The "custom made hardware" gets it input from android device itself via USB/WiFi/Bluetooth.
Just a thought. May not be practically possible.
No way doing it if you do not root your device and add reboot scripts to the programs running to show battery charging pictures when device is turned off and charging.for Samsung s2 here is an answer
Maybe you can make an additional app that waits for the BOOT_COMPLETED with its BroadcastReceiver and then check wether the power is connected and start as a new Intent your application?
Just a quick thought..
I have the same problem.
The solution that i will to implement:
1.- get out two(here is my doubt, ¿what two wires?, because i see three, i will use my multimeter for see continuity between wires when i push the button) wires from the power button phone.(when you push that button, it just connect two poles like a switch).
2.- When you have the two wires, so, we build a little circuit with a timer like a 555(integrated circuit). The purpose of the circuit will connect the two wires(from power button phone) by a 5 seconds period every 15minutes.
Obviously this circuit will be running always.

Categories

Resources