How to find device os and version in ionic

后端 未结 4 406
半阙折子戏
半阙折子戏 2021-01-24 09:27

I have worked on few tutorials and at last found something regarding this in ionic framework.....

They gave some codes that use ionic native and i did the same by embedd

4条回答
  •  借酒劲吻你
    2021-01-24 10:02

    You can get the device os and version in ionic

    import { Device } from '@ionic-native/device';
    import { Platform } from 'ionic-angular';
    
    constructor(private device: Device,public platform: Platform) { 
    
       console.log('Device UUID is: ' + this.device.uuid);
    
       if (this.platform.is('ios')) {
        // This will only print when on iOS
         console.log('I am an iOS device!');
       }
       if (this.platform.is('android')) {
        // This will only print when on Android
         console.log('I am an android device!');
       }
    }
    

提交回复
热议问题