1

My application restarts shortly after I call BluetoothAdapter#cancelDiscovery(). In other words, my Application subclass's onCreate method is called. Device is using Android version 2.1.

I'm having difficulty identifying what specifically is causing this application restart.

Are there any tricks to help track down the cause of such a problem?

Many thanks for your time.

UPDATE

The restart is occurring when I interrupt a BluetoothSocket#connect() attempt to a device address previously stored but currently unavailable; this interruption is caused by the parent Activity being destroyed when I press Menu physical button to transition to custom menu.

Logcat shows that a thread I'm running ends as part of a communication cycle I have set up. A Handler gets sent a message at this point; it would be about to receive the message but the app then restarts and the handleMessage(msg) doesn't get called.

The Handler has received messages before this event happens, and I know the reference still exists non-null. I don't think this is the source of the problem.

Here is my manifest:

AndroidManifest.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.ndb.mindpad" android:versionCode="1" android:versionName="8.4">
    <application android:name=".MindPad" android:icon="@drawable/icon" android:label="@string/app_name">
        <activity android:name=".Main"
            android:label="@string/app_name"
            android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen"
            android:configChanges="orientation">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity android:name=".Preferences"
        android:label="@string/preferences_label"
        android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen"
        android:configChanges="orientation">
        </activity>
        <activity android:name="DeviceList"
            android:label="@string/communicator_label"
            android:configChanges="orientation">
        </activity>
        <service android:name="BluetoothService" />
        <service android:name="RecognizerService" />
    </application>
    <uses-permission android:name="android.permission.BLUETOOTH" />
    <uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
    <uses-permission android:name="android.permission.GET_TASKS"/>
    <uses-permission android:name="android.permission.VIBRATE" />
    <uses-permission android:name="android.permission.WAKE_LOCK" /> 
    <!-- Min Android SDK 2.1 -->
    <uses-sdk android:minSdkVersion="7" /> 
</manifest>

UPDATE 2

I've done as suggested by the top two answers found here, and no exception data is being printed locally (CustomExceptionHandler answer, modified with Log.d) or being reported to Google Form (ACRA answer). So this suggests there is no uncaught exception, since I've added the output mechanisms into each of my thread constructors.

So why would my application be recreated if there is no uncaught exception?

Community
  • 1
  • 1
KomodoDave
  • 7,239
  • 10
  • 60
  • 92
  • Do you have any configChanges tags in your Manifest? – Rotemmiz Feb 10 '12 at 22:09
  • @Rotemmiz - I've added my manifest to original post. – KomodoDave Feb 10 '12 at 22:32
  • @CaseyB - Logcat shows that a thread I'm running ends as part of a communication cycle I have set up, and a `Handler` gets sent a message which it doesn't receive before the app restarts. The Handler has received messages before this event happens though. The restart is occurring when I interrupt a `BluetoothSocket#connect()` attempt to a device address previously stored but currently unavailable. I'll add this latter info to my OP too. – KomodoDave Feb 10 '12 at 22:35
  • I've added a second update to my question. It appears the app is restarting yet no uncaught exception has been thrown. – KomodoDave Feb 11 '12 at 10:03

0 Answers0