Android standalone apk installation problem - android

I am trying to install an application as a standalone apk (not in Android Market place) by placing the signed apk package on the SD card and then clicking it to install it.
The application installs fine and I start it however it will always crash unless the PC cable is connected to the phone in which case it works fine!
It is frustrating for me, I know it must be trying to save or access something on the PC or have a setting on the phone that needs changing.
I am sorry if this is a rather simple question, but I just do not know what I am doing wrong.
Any help with this would be much appreciated.
EDIT (More Information):
The application is a messaging application using a specific message protocol that has a background service that has a socket that listens for messages arriving and the application UI will listen to message events raised and also send messages by connecting to this service running.
The application does save details about the person who is logged in and the messages that have been received and uses GPS for navigation.
Specifically the application will always crash whenever the usb cable is NOT CONNECTED to the phone. I cannot get past the login screen which would start the background service and save the person who is logging in.
As for logcat output, well this is a release application and it works fine when I have been previously been debugging it from eclipse.
However now I am trying to create a release build to give to clients.
This is a snippet that I know will execute when I try and login however without the cable attached the application just crashes.
// Start the background connection to the server now the user is logged in
startService(new Intent(this, ConnectorBackgroundService.class));
// If there is a user that has been logged in otherwise load from settings
if (user == null) {
user = loadUserFromSettings();
}
// Write the login to file to allow automatic login if the application is restarted
repository.saveLoggedInUser(user);

Have you removed dobug mode from manifest?

Thanks anyone who spent time looking at this problem.
It was because I had an event which watched for the device being unplugged and plugged in because it stopped GPS the application was using when on battery to conserve battery.
As I was always testing the device when it was plugged in via USB, I never noticed that it was calling bad code when I unplugged the lead causing a null reference exception.
I guess I was always thinking that it was trying to communicate with the debugger or something which was why it was not working properly.
This site will finally allow me to put my own answer in.

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!

Android Studio: LogCat doesn't show some Logs anymore after reconnection of the device

currently I am developing an App, which needs a USB-Connection to another device. So my only USB-Port on the Tablet is blocked while testing. So far everything worked fine with the Logcat. I disconnected the Tablet from my PC, tested the app, reconnected it and had the saved logcat from the device. So my debugging happened via Logcat.
Recently that method does not work anymore. Some of the Logs are showing up, some don't. I know that there should be some Logs, because the action of the device that I am testing with, indicates that the process has passed some Log-Outputs. But most of the Log-Outputs simply don't show up. I recognized, that it depends on the class. So if (for example) one Log of the Main-Activity is showing up. The rest of the Logs withhin this Activity doing so as well. But all Logs of other Activities or Services aren't.
Has anybody an idea how to get this working again, or at least how to debug my app with an other device connected to the tablet (OTG-Adapter won't work because the connected device, as well as my PC wan't to be Master).
Thanks for any help,
Daniel

Android app internet issues

A few weeks ago I developped an Android app for my company. The app can be downloaded by our customers on the company's website.
It's an offline app, but the user needs to download all the datas at first use.
Me and my team went through a few tests on the office's wifi, with different devices (Samsung, Huawei, ...) running on different Android version (4.3 to 5.0)
At first use, the user logs in and a loading screen appears, saying that the datas for first use are being downloaded, and it could take time. However, this information is false as it only takes a few seconds
I have a lot of negative feedback from our customers saying that they are blocked at this "first use" loading screen. They can login but the download of the datas for the first use doesn't work. However, they were able to download the app easily, so their internet connection is working. Also, the login function also needs an internet connection, and it works.
I had one of the customer on the phone, I told him to reinstall the app. He did it a few times and it finally worked.
An other customer gave me his device after trying to reinstall the app a few times. I installed the app from my office and it worked perfectly.
It seems like the app doesn't work on some wifi.
I'm using Volley to make the request to download the datas, a message should be displayed if the device is not connected to the internet, but it doesn't show (it does if I stop the device's wifi). It seems like the app detects the network but has no internet connection, and only in a few cases (as it works in our office)
Could someone help me ?
What could possibly be wrong in my app ? How can I debug the situation ?

Debug application over internet using eclipse

I have the following problem:
My phones USB port is broken and I have no way of running app on the phone other than sending it over bluetooth and install it every time I make changes to the code. So every time I make changes, I gotta spend min+ to see them in action. I don't want to use emulator.
Is there a way I can make eclipse run my app on the phone over the internet when I build/run the app the same way it does over USB? Thanks!

Starting and stopping an Android app remotely through PC or another smartphone

I have an Android Data collection App which collects sensors data. First, I enter the activity name in this app and then press the start button. After the recording is completed, I press the stop button and exit the app. For another activity, I restart the app again.
In my experiments, now I am using 5 smartphones on a participants's body while performing an activity so its bit difficult to start and stop this app for each activity manually as each activity is for 3-4 minutes and is a bit annoying.
I want to control this app remotely, either through another smartphone or PC. For example, like Airdroid:
http://airdroid.com/
However, Airdroid doesn't have the ability to start and stop (plus enter any data) at this point.
Is it possible to enter a name in this app, start it and stop it on multiple smartphones at the same time remotely ? May be using Bluetooth, local WIFI, or internet.
To summarize, I want to the following actions on an app remotely:
1) Start an App
2) Enter a name in its field (it can be worked around too so its optional)
3) Press start button
4) Press stop button when needed.
I looked it up online but most work has been done on controlling PC though smartphone and not the other way around.
Thanks
Zubkan
Integrate a HTTP server into your app, then you can control it easily using a web browser. A very nice option for Android is NanoHttpd, which comes as a java class.
Edit: Some additional notes:
This probably requires the phone to be connected via WiFi, because carriers might not allow this. And if the phone isn't rooted, you cannot run the server on Port 80, but Port 8000 or so will do.

Categories

Resources