ParseInstaller.getCurrentInstallation().saveInBackground() is freezing my application - android

I am finding that about 1/5 of my tests are freezing, and after some searching for the problem I have narrowed it down to the line:
ParseInstallation.getCurrentInstallation().saveInBackground();
I am using Parse 1.5.1, and an Android 4.4.2 device. My application class looks like:
public class InitApplication extends Application {
#Override
public void onCreate() {
super.onCreate();
Parse.initialize(this, "my_App_ID", "my_Client_Key");
PushService.setDefaultPushCallback(this, MainActivity.class);
System.out.println("execution DOES reach here");
ParseInstallation.getCurrentInstallation().saveInBackground();
System.out.println("execution DOES NOT reach here");
}
}
The behaviour on my device is that I will first see a blank white screen for about 5 seconds, and then the screen goes black. I am not sure how long the screen stays black, as I usually force close. I've let it sit for about 10 minutes once with no change. I am unable to press the back button and any touch on the screen does nothing. I am forced to use my home button, then force the application to close. Upon reopening the application, it behaves and functions normally.
Further research led me to find this post: https://www.parse.com/questions/android-saveinbackground-lock-the-main-thread
But still, I have been unable to find a solution. One suggestion in the above post is to simply move the location of this code. I have tried this to some point after my main activity's onCreate() method (not to be confused with the application's onCreate() method). Behaviour appeared to be normal up until I got to the point where the getCurrentInstallation.saveInBackground() code is called, where my application froze and failed to respond until I forced it closed.
Are there any solutions to this problem?

I encountered the same problem as well using Parse SDK 1.5.1.
And I just downloaded the latest SDK 1.6.0 and problem solved.
Link to download the latest SDK.

You can track reported issue here:
Parse installation save causing app freeze
I already provided (confidentially) thread dump traces from my app. However at time of writing this post there is no useful feedback from Parse guys.
My humble opinion after looking into traces is a deadlock causing this issue after some trouble with server interaction. But it's just guessing.
Link updated

I do have the same issue and more.
The blank or black screen however happen not to all my test phones. It happens only to one of them (Android 2.3).
SaveEventually also does not work to the problematic phone above (all the other phones I have are working fine). It does not send data through successfully to the server. So I suspect that phone configuration of saving data on the phone itself before passing to the server when network is back on may be the issue.

Related

Remove the Unfortunately the app has stopped message in android(Not its cause, but message itself)

Is there any way I can get rid of this message despite the app being stopped due to any exception?
My app(background service) is designed in such a way that it always restarts itself within 1 mins in case it gets killed. So even if it gets stopped, it would be restarted again, with no negative impact. Hence that message would unnecessarily annoy/worry the users.
As the app works fine on my device, but on other's device, its giving that message once or twice a day. I have no way to read the logs and check whats going on. I have placed the try/catch block everywhere. And the code is too complex to dig into again and check whats wrong. In short, I don't want to get rid of the "cause" off the message. But the "message" itself. Is it at all possible?
So How do I get rid of android OS showing that message even if it has "stopped"?
So even if it gets stopped, it would be restarted again, with no negative impact
There is no way to know whether or not there is a "negative impact" until the source of the problem is found.
I have no way to read the logs and check whats going on. I
Use crash logging frameworks like ACRA to collect stack traces from production apps.
And the code is too complex to dig into again and check whats wrong.
Use the crash logs from crash logging frameworks like ACRA to identify the source of the problem.
Is it at all possible?
Read the documentation for your chosen crash logging framework and see what the options are for user notification regarding such crashes. Some, like ACRA, will offer a "silent" mode where the crash is logged but without informing the users of that crash.
Theoretically, you could set up your own Thread.setDefaultUncaughtExceptionHandler

Android Phonegap - Load URL Error Message

Myself and a few others have been testing my Android application for a couple weeks now and have not experienced any major issues yet. Recently, I was in a location that has no wi-fi and my phone has very poor service. Two times, back-to-back, when I launched the application, after set timeout for the splashscreen expired, it threw the error message "There was a network error. (file:///android_asset/www/index.html)". Other than those two times I have not been able to reproduce the issue, nor have any of the other testers. I've tried reproducing it in areas with little to no service and by turning my data off but I can't seem to make it happen again. The app does get the users location but even when I turn off my data and/or location services it still loads fine.
My main question is, after I sign and release the application to Google Play, is it possible for an end user to see this same error message and if so, how/where is it best to handle a situation such as this?
MainActivity.java
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
super.setIntegerProperty("splashscreen", R.drawable.splash);
super.loadUrl("file:///android_asset/www/index.html", 5000);
}
Is there anything else I should be doing in my java file or anything specific in my index.html file? Is it good practice to load a different .html file, which just redirects to index.html?
I only have the scripts included that I am using and only the necessary permission in my manifest file.
Although this has only happened a couple of times and I have not been unable to reproduce it, if an end user can get the same error, I would prefer it to be one that is much more user friendly. On the other hand, if after signing and releasing it on Google Play the error gets handled differently, (possibly what I have seen when an app doesn't respond and you are given the option of reporting it to the developer) that would be great!
My reasoning for the statement above, regarding it being handled differently after releasing it to Google Play, is because I have been installing it on the phones from Eclipse. Not sure if that could be why but thought it might be good to include that detail.

Just Published 1st App. It works fine on my Nexus 4 Running 4.2, but friend says it crashes on shake on her Electrify M Motorola running 4.1

I have a question and would really appreciate any help.
My friend says the app crashes onshake. My first app is a simple magic 8 ball app, that gives a random answer when the user shakes it. She says after she opens the app, and shakes the app instead of receiving a random answer like I do on my nexus 4, the app simply shutsdown and takes her back to her home screen.
Here's the code that I think may be causing it. I added the "Finish(); to shut down the activity after a user hits the homescreen, so it would clear out the randomly generated answer instead of storing it for days.
#Override
public void onPause() {
super.onPause();
mSensorManager.unregisterListener(mShakeDetector);
finish();
Try to get a crash log, including the complete stack trace. The easiest way to do that is asking your friend to send a crash report when Android asks him. Otherwise plug his phone into your computer, crash the app and copy the output of adb logcat. The crash log should help you pinpoint which line in your code causes the crash.
If you are really sure the problem is in the onPause method, check how you initialize mSensorManager. Is there a way it might be null (not initialized) on your friend's phone? (As that would cause a NullPointerException.)

Android Sqlite Data lost when Application Hangs/Freeze and restarted

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....

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