Creating an app and a widget with the same code base

Former Member
Former Member
Hi there,

I am thinking of publishing a watch app that does exactly the same as a widget I have written. I want it to have the same functionality as my widget and if I change my code I want to be able to easily release an update to both widget and app. I think that the only thing that I need to change is the manifest file and maybe the resource file. The manifest needs a new ID a new type and my resource file needs a new AppName. If that really is all I have to change, I'd rather not have two projects.

What is the best way to achieve this?

Thanks,
R.
  • Yes. Provided that you are not calling Ui.popView() to exit the app, you should be able to use the same code base. If I were in your shoes, I'd write a build script to copy the appropriate manifest.xml into place and then do a build.

    Travis
  • Former Member
    Former Member over 9 years ago
    Thx

    Yes. Provided that you are not calling Ui.popView() to exit the app, you should be able to use the same code base. If I were in your shoes, I'd write a build script to copy the appropriate manifest.xml into place and then do a build.

    Travis


    Thanks Travis,

    Why can't you use popView()?

    R
  • You can use popView(), you just shouldn't use it when your top-level widget view is active.

    I'm not sure what happens. We were told that you aren't supposed to pop the top level view of a widget. The easiest thing to do is to return false from the key handler (or just not handle the back/escape button press) in the top-level delegate. The system will do the right thing.