[SalesForce] Navigate from Lightning Component in Record Page to Lightning App

I have an issue that I can't seem to see how you navigate from a Lightning Record Page to a Lightning app without a new pop-up opening.

I have a Lightning Component with just a ui:button that executes the following:

var urlEvent = $A.get("e.force:navigateToURL");
urlEvent.setParams({
    "url": "/c/MyApp.app?id=xxx"
});
urlEvent.fire();

This component sits within the Lightning record page for an object. The problem is that this opens the App in a new window, not within the Salesforce Lightning experience. I want the click of this button within the record page to navigate to the app – and keep this within Lightning experience so the user can navigate back and still have the sidebar navigation available.

If I attempt to block pop-ups I get the following message:

This page isn't available in Salesforce Lightning Experience or Salesforce1.

The app is marked with the implements="force:appHostable" interface

I can't find anything in the documentation that demonstrates how to navigate from a record page to a custom app.

Any help would be appreciated!

Best Answer

The one.app is the lightning app that has the sidebars and all the standard salesforce features.

When you create a custom app, you will notice your app has name like myApp.app. This app doesn't get any of the functionalities of the one.app. If you need a sidebar in this app, you would have to implement it yourself.

If you want to have the sidebar, may be you should navigate to a lightning component tab instead of a lightning app?

Of course this only works if the contents of your app can also be contained within a lightning component and added to a lightning component tab.

---EDIT--- Following this example, Here's how you would do it:

var urlEvent = $A.get("e.force:navigateToURL");
     urlEvent.setParams({
      "url": "https://lightningtest-dev-ed.lightning.force.com/one/one.app?source=aloha#eyJjb21wb25lbnREZWYiOiJvbmyI6ImxpZ2h0bmluZ2twcjpuZXN0ZWRDb21wb25lbnRzIn19LCJ0IjoxNDY3MzkwNDY0NzQwfQ%3D%3D"
    });
    urlEvent.fire();