Android Sqlite Data lost when Application Hangs/Freeze and restarted - android

Recently my users are complaining that application hangs while using it and the data stored getting lost when the reboot the mobile.
Its not happening everytime too.
Can some one please tell me for what are all the reasons sqlite data will get lost.?
Also for what are the reasons android application freeze?
Background : My application perform sqlite operation from all the screens. The device
Model Number: Samsung GT-18160 , Android Version:2.3.6 , Kernel
Version:2.6.35.7-1219296 dpi#DELL210#2

You can assume no data should be lost. But you may want to nail down crash culprit first - luckily your user is on 2.x so tell him to use tools like aLogCat and grab the logs after your app crash. Then check what's there and fix. That should solve your "data lost" issue as whatever it is, it occurs after your app crashed. If it stop crashing then it should not trigger the snowball....

Related

Android Wear: getDataItems returns 0 items

Here is a big problem that i simply don't know whats going on...
I have an app that stores Data in data API. The mobile app is aroudn the play store for some time and I decided to make a app for wearable.
My problem is: when the user install the wearable app for the first time (via Google Play), it need to load the data from the DataApi. But it simple returns 0 itens!
DataItemBuffer dataItems = Wearable.DataApi.getDataItems(mGoogleApiClient).await();
Observations:
GoogleApiClient IS CONNECTED
The Wearable receives the onDataChanged from WearableListenerService and this part is working fine.
I've already tested with .setResultCallback but results still the same.
I have two copmuter for developments, one is one my work and another is on my home.
In my tests, I DELETE the emulator and create a new one, to simulate a "new device beeing connected for the first time".
DataAPI says that the data is synchronzed to all devices but is seems not be working like that. How to solves this? Any workaround? SOMEONE HELP =(
It seems i found the solution for this problem. As I mentioned i have two computers for development, so, 2 development keys.
My mobile app was installed using the "A" computer's key and the wearable was using the "B" one. So, to solve this problem, when start developing always remember to re-run the mobile and wearable app from the same computer to your devices.

The application has stopped unexpectedly when it loads SQLite database on a real phone

I have an application that uses an SQLite database that is stored in assets folder of my project, it works just fine when I test it on my emulator, but when it comes to a real phone (Galaxy S) it just crashes showing the message : The application ... has stopped unexpectedly. Please try again.
I really don't know what can cause such a problem !
IF your code is running in emulator and its not running on device then mostly you should be having old database in your phone and the data base is not upgraded, so the new table or field which you are trying may cause the app crash.
We can check by deleting the app or clear data and run your app. Still there is app crash. we need to check the logs....

Android application spontaneously crashes

I have an android application that I have recently finished. So I have successfully finished each function and ensured that no errors are encountered.
When I have exported it to an apk file. It runs smoothly. It uses httpRequests to communicate with a remote mySQL server. But there are times that it spontaneously crashes?
For example, I have an activity that would receive input from the user then communicate with the server. It runs smoothly and quickly. But on next run it would crash. And when I restart the application it would run smoothly again even on the second run. I'm just going crazy from this. Are there any explanations for these?
Use ACRA to collect crash reports from your app. You don't need your own server, just a Google Docs form. The integration is described here:
https://github.com/ACRA/acra/wiki/BasicSetup#wiki-Setting-up_your_project
The advantage of using a crash report tool vs. logcat is that you don't need physical access to the device. There are also chances that you see crashes that you or your testers didn't even notice.
The first step to debugging your problem is to get a stack trace. If you can reproduce this on your own device, then right after you see a crash, connect it to your dev pc and run this command:
adb logcat > crash.log
Open the log file, copy and paste its contents on http://pastebin.com/ or similar and add the link to your question. Once we have that, we can try to figure out what's going on.

Android application unknown host exception

I developed an application for android tablets. In that application, when I get into the app and after doing some actions I keep the application idle for half an hour or sometimes and again get back into the app to perform any action, it leads to application crash with UNKNOWNHOSTEXCEPTION.I don't know why it happens even after i gave INTERNET permission in Android manifest file.I have been searching solution for this problem for one week...still i could not able to find any solution.i used fragments in my application...please help me...
Likely the tablet temporary switching off the network to save energy. Add try/catch to your requests and probably do 2-3 tries in some interval before you will show error to user.
This type of exception happens when you try to switch networks , or the required Network isn't available.
Use try/catch block to prevent crashing of application.

How to show message like "the application has crashed, but a report is sent to the admin" in android

I am new to android and my application involves lot of internet access and many times when the data that needs to come from a web service is unavailable my application crashes.
I tried to avoid as many cases as possible, but i am not sure if my application is crash free.
I am using an application named "delight circle" and sometimes that application crashes and shows me this Toast:
"The application has crashed and a report is sent to the admin"
and takes me back to the previous activity or previous action, and from here i can use the application normally again.
I have 2 questions:
How to make the application work normally after it crashes once. In my application, if it crashes then it asks me for force close and when i click it, it takes me to the previous activity(or action) but nothing works there, if i try to do anything it asks for force close again, i eventually end up force closing the application from Settings --> Applications --> myApp --> foce close.
How to send a report about what actually caused the application to crash?? Right now i have a lot of logs in every activity so, now if it crashes i can find out the exact reason and solve. But when i release the application how can i do this?
Thank You
You have to use UnCaughtExceptionHandler for this.
Here is a example,
http://trivedihardik.wordpress.com/2011/08/20/how-to-avoid-force-close-error-in-android/
Once you override the Exception Handler, you will be provided with access to the Log and from where, either you can send the error log which you get the from the SatckTrace as an Email or use Apis to do it.
I can give an answer to your second question, that is "How to send a report about what actually caused the application to crash" Try Crittercism in your code. It will help you to find the exact cause of failing the application. Not only that, it has so many features, like Live Stats, Unresolved crashes, Crash alarms and more.

Categories

Resources