How to configure LOCATION functionality in your NextGen Application
The location-based content functionality has now been extended in the latest 1.8.0 release. This allows location specific content to be served EITHER at application level (for example - channel logo, main menu) OR at widget level (for example – image, video or HTML iframe application).
Location Specific Content at Main Application Level
Below is an example snippet of how the application’s main menu and channel logo can be served based on location. This is configured in appsList.Json file:
For main menu:
"menu": "<https://your-specific-url.php?zipcode=<location>",>
For channel logo:
"header": {"type": "channel", "title": {"en": "MY CHANNEL", "es": "MY CHANNEL"}, "id": "MY-ID", "name": "ID-1", "logo": "/market_name/station_name/common-app/img/home-menu/channel-<location>.png"},
Location Specific Content at Widget level
Below is an example of how location-based content can be served within a widget. Here we use the Weather widget feed to demonstrate location-based content. The content could be a static image file, video or 3rd party HTML application.
{"type": "widget", "app": "info-widget", "feed": "/market_name/station_name/common-app/dynamic/weather-feed-<location>.json", "timer": 5000, "title": {"en": "Weather", "es": "Clima"}},
Passing Location information to your Application
There are two ways of passing the location information to your custom application.
-
Passing Location information from Framework to (say) your HTML application:
Use javascript function call like below:
fmw.location.get(console.log);
2. Passing Location information based on URL
Here, you can add the location in your appsList.json and then call it in your application’s index.html file.
a) In the appLists.json file, add something like:
"appEntry": "/index.html?location=<location>",
Then:
b) Call the javascript function in your index.html file as:
new URLSearchParams(window.location.search).get("location")
We recommend that the location should be correctly set at the Main Application level. This should then be used a reference point for any feeds or external / custom applications.
Although <zipcode> tag is also supported in the framework, we recommend that only <location> tag is used in order to avoid any privacy related issues