-
Notifications
You must be signed in to change notification settings - Fork 60
How to detect platform
Dayoung Kim edited this page Dec 13, 2016
·
6 revisions
This is a tip for using to not supported APIs by TOAST APIs.
When you need to realize by platform, You can use the following.
-
Make a new file. (ex. test.js)
-
Insert device apis as you want in self-invoking function.
(function (window) { var platform = cordova.require('cordova/platform'); switch(platform.id) { case 'sectv-orsay': var SEF = cordova.require('cordova/plugin/SEF'); var sefNetwork = SEF.get('Network'); window.getMACAddr = function () { return sefNetwork.Execute('GetMAC'); }; // Multi-App window.onPause = function (event) { console.log('Event type = ' + event.type); // deliver to 'onPause' }; window.onResume = function(event) { console.log('Event type = ' + event.type); // deliver to 'onResume' console.log('Parameter = ' + event.data); // deliver to same form as window.location.search }; break; case 'sectv-tizen': window.getMACAddr = function () { return webapis.network.getMac(); }; // Multi-App document.addEventListener('visibilitychange', function() { if(document.hidden) { webapis.avplay.suspend(); } else { webapis.avplay.restore(); } }); break; case 'tv-webos': break; } })(this);
-
Include the new file in index.html.
<script src='test.js'></script>
-
Use the API.
if(typeof window.getMACAddr === 'function') { TV_MAC = window.getMACAddr(); }
uuuu
Getting Started
Converting Tizen to Toast
- Prepare to convert
- Tizen API: AVPlay
- Tizen API: DrmInfo(Deprecated)
- Tizen API: Application
- Tizen API: TVInputDevice
- Tizen API: TVAudioControl
- Tizen API: TVWindow
- Tizen API: TVChannel
- Tizen API: IME
- Tizen API: ProductInfo
- Tizen API: Network
- How to detect platform
Converting Legacy to Toast
- Prepare to convert
- Legacy API: AVPlay
- Legacy API: TVInfo
- Legacy API: Common
- Legacy API: InputDevice
- Legacy API: AudioControl
- Legacy API: TVWindow
- Legacy API: TVChannel
- Legacy API: IME
- How to detect platform
API Reference
- supported cordova plugin
- toast.Media
- toast.MediaPlugin
- toast.drminfo(Deprecated)
- toast.application
- toast.inputdevice
- toast.tvaudiocontrol
- toast.tvwindow
- toast.tvchannel
- toast.billing
Supported platforms
Sample App
Contribution
Frequently Asked Questions