I hope this is not common, but I am developing an application for Sony SmartWatch. When ever I make a mistake, for example, excluding the null pointer exception. I cannot get my application to restart. As if he is in a broken state forever. To make matters worse, I also stopped receiving messages through Logcat related to the application. When I uninstall and reinstall the application, it is not listed in the SmartWatch application on the phone. As if he is not registering. This is difficult to fix, because at the moment I am not receiving log messages. The only thing I can do is uninstall the application. Reboot my phone. Then reinstall the application. At this point, he returns to normal, and I can start writing code again. Therefore, I am interested in my questions. Is there a better way to re-register a control? Will this happen to end users? If they need to uninstall, restart and install for recovery if the application crashes?
Some information (names have been changed to protect inappropriate):
I created a Broadcast repeater and installed it in my mainfest to listen to these broadcasts.
<receiver android:name=".MyExtensionReceiver" > <intent-filter> <action android:name="com.sonyericsson.extras.liveware.aef.registration.EXTENSION_REGISTER_REQUEST" /> <action android:name="com.sonyericsson.extras.liveware.aef.registration.ACCESSORY_CONNECTION" /> <action android:name="com.sonyericsson.extras.aef.control.START" /> <action android:name="com.sonyericsson.extras.aef.control.STOP" /> <action android:name="com.sonyericsson.extras.aef.control.PAUSE" /> <action android:name="com.sonyericsson.extras.aef.control.RESUME" /> <action android:name="com.sonyericsson.extras.aef.control.ERROR" /> <action android:name="com.sonyericsson.extras.aef.control.TOUCH_EVENT" /> <action android:name="com.sonyericsson.extras.aef.control.SWIPE_EVENT" /> </intent-filter>
Code for MyExtensionReceiver:
public class MyExtensionReceiver extends BroadcastReceiver { public MyExtensionReceiver() { super(); Log.d("mytag", "MyExtensionReceiver Loaded"); Dbg.setLogTag("mytag"); } @Override public void onReceive(Context context, Intent intent) { Log.d("mytag", "onReceive: " + intent.getAction()); intent.setClass(context, MyExtensionReceiver.class); context.startService(intent); }
}
Even if my application crashes, I still need to get a log message when onReceive is called. This is similar to passing EXTENSION_REGISTER_REQUEST, which is never sent. I just keep deleting the reboot and reinstall again and again. Ultimately, the application finds the SmartConnect application.
source share