on 03-02-2012 12:03 PM
Hi,
I have downloaded the Sybase Unwired Platfom 2.1 ESD #1, with sample code. iam able to sync the android application to get the data from the MBO data source (DS). But whenever i close the application, the application throws an error and whenever i re-open the application second time it crashes with force close.
The following error/Exceptions i get when i close the
android application
02-22 18:54:33.655: E/ActivityThread(549): Activity com.sybase.sup.samples.objectapi.SUP101SampleActivity has leaked IntentReceiver com.sybase.mo.MessagingService$MoTelephonyListener$1@44fb19a8 that was originally registered here. Are you missing a call to unregisterReceiver()?
When i re-open the app again, the below exception is shown with force close
02-22 18:57:21.004: E/AndroidRuntime(549):
java.lang.RuntimeException: Unable to start activity ComponentInfo {com.sybase.sup.samples.objectapi/com.sybase.sup.samples.objectapi.SUP101SampleActivity}:
com.sybase.mobile.ApplicationRuntimeException: The value does not match the current set value. The application identifier cannot be changed once set.
Please let me know which API i need to use to unregister the application to ensure that the app does not crash. Also provide any appropriate working sample android code other than the one which is available in the Sybase infocenter site.
please i need some urgent help in this regard, please...
Thanks,
Ushasri
Hi Ushasri
Actually I'm facing the same problem concerning the sample code provided in the tutorials.
I already fixed the exception being thrown when re-opening the app by providing the application from setting the application identifier twice. Therefore I simply created a new boolean which is set to "true" after the initialization. The initialization-method is called in onCreate, but only if the boolean is still "false". As the application identifier is obviously restricted to be set once I guess this is the only possibility to manage this problem.
The IntentReceiver is a problem, it seems as if it is created when setting the application context (app.setApplicationContext(context)) so as a result the receiver is not callable in the specific activity and cannot be removed. I am really curious how it is possible to solve this problem - maybe you found a solution already, otherwise I would appreciate if someone else could leave a hint here. Thx in advance!
Best regards
Clyde
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you for the solution. I tried it, but it did not help me. I played with multiple solutions, but found the simplest one that works fine for me:
Since the problem occurs in the line:
app.setApplicationIdentifier(APPLICATION_ID);
I decided to change it a little:
if (app.getApplicationIdentifier() == null)
app.setApplicationIdentifier(APPLICATION_ID);
The solution is quite stupid, but it works when you rotate the screen. The application does not crash anymore.
update:
Ha-ha! To be honest, this is probably the most right solution. Because if you examine the Application.setApplicationIdentifier method, you will find following lines:
public void setApplicationIdentifier(String value) {
if (this.applicationIdentifier != null) {
throw new ApplicationRuntimeException("The value does not match the current set value. The application identifier can not be changed once set.");
}
Now you understood, why the exception was thrown
Kind regards,
Vlad
I was facing the similar issues of Second time app was getting crash and came to know that it is trying to register the application again hence
if(TextUtils.isEmpty(app.getApplicationIdentifier())) {
app.setApplicationIdentifier("SUP101");
}
I have added above line after
Application app = Application.getInstance(); in the SUP101SampleActivity.java file and
from AndroidManifest.xml file removed main and launcher intent for detail activity
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.