Yahoo QA reported a defect for my widget related to default view ID. Here is my use case (currently I'm handling it using the code posted above by Vivek).
I have two views, pre-registration-view (home view before the widget is registered with the back end web application) and post-registration-view (home view after the widget is registered with the back end web application).
Basically after the widget is installed and before it is registered using the Register option, I want to display the default view as pre-registration-view. And after it is registered I always want to have the post-registration-view as the default view. Currently I'm handling it in the snippet activate event by checking if it is registered or not and load the appropriate view. This works fine for the normal flow of opening the side bar view from the snippet and appropriate view is displayed.
The issue is when the back button (F10 on simulator) is pressed, irrespective of whether it is registered or not (obviously) whatever default view I had set in the init.js is displayed. For example if I had set the pre-registration-view as the default view, then after registration while on the post-registration-view if I press the back button it displays the pre-registration-view since it is the default view. And if I set the post-registration-view as the default view then before registration if I'm on the pre-registration-view back button will display the post-registration-view which is functionally incorrect.
How can I handle this situation. As I understand from the above post, there is no API to change the default view. Do I need to listen for an event on the back button and load the appropriate view based on the registration status, if that is the case , is there any documentation on how to implement the same.