I have an interesting use cases where I would like to use an ionic native plugin namely, bluetooth-serial only on one platform out of two. So I would like to use it on Android but not on iOS. Is there a way to add a dependency just to one platform ?
0
votes
1 Answers
0
votes
Yes, you can use Platform Api to Detect platform and write your platform specific code.
in your .ts file:
import { Platform } from '@ionic/angular';
export class YourPage implements OnInit {
constructor(private platform: Platform){
}
if (this.platform.is('android')) {
// Write your Android Specific code
} else {
console.log('Other Platform')
}
}