cordova.platformId 在 android 上返回为“浏览器”

问题描述 投票:0回答:1

我正在尝试在我的 cordova android 应用程序中编写一些移动特定代码。我的内容 src 是一个 index.html,其中有我的 JS 代码。 当我检查 cordova.platformId 时,它返回“浏览器”,即使在 Android 上运行也是如此。使用科尔多瓦 12.0.0.

javascript cordova phaser-framework
1个回答
0
投票

我不是专家,但如果您使用

cordova-plugin-device
插件,您要查找的值应该位于属性
platform
而不是
platformid
中。

摘自文档 (12.x)

// Depending on the device, a few examples are:
//   - "Android"
//   - "browser"
//   - "iOS"
//   - "WinCE"
//   - "Mac OS X"
//
var devicePlatform = device.platform;
© www.soinside.com 2019 - 2024. All rights reserved.