我的要求是将应用程序固定为手机上的纵向模式和选项卡上的横向模式,从闪屏开始。尝试使用 ionic native 上可用的 Screen Orientation 插件,但对我不起作用。
我尝试过的事情:
在 app.component.ts 上:
constructor(..., private screenOrientation: ScreenOrientation) {
platform.ready().then(() => {
this.screenOrientation.lock('landscape');
ScreenOrientation.lockOrientation('landscape');
screen.msLockOrientation('landscape');
this.screenOrientation.lock(this.screenOrientation.ORIENTATIONS.LANDSCAPE);
Run Code Online (Sandbox Code Playgroud)
我也在 home.ts 上尝试了上述所有行,但没有奏效。当我设置:
console.log(this.screenOrientation.type);
Run Code Online (Sandbox Code Playgroud)
这将在日志中正确打印出屏幕方向。每当我设置 subscribe 方法时,它也会在屏幕方向发生变化时提醒我,这意味着所有导入语句都可以正常工作并且我能够正确访问插件方法。我能够在 Android 和 iOS 上复制这个问题。任何帮助将不胜感激。
平台/库/依赖项详细信息:
"@angular/common": "4.1.3",
“离子角”:“3.6.0”,
“离子”:“3.7.0”
请帮我解决这个问题,
地理定位插件不适用于某些 android 设备。它在不同的 Android 手机上进行了测试,以识别地图问题上的当前位置,发现以下结果:
============ 我已经测试了这几台设备 ==========
酷派3600I | 安卓 6.0.1 | 不工作
红米笔记4 | 安卓 7、MIUI 9 | 不工作
摩托克 3 | 安卓 6 | 不工作
红米笔记4 | 安卓 7、MIUI 9 | 不工作
红米4 | 安卓 7.1.2,MIUI 9.1 | 在职的
摩托 G4 Plus | 安卓 7.0 | 在职的
米注3 | 安卓 6+,MIUI 8+ | 在职的
荣誉冬青2加| | 在职的
三星J7 | | 在职的
摩托克 3 | | 在职的
GetLatLong(){
this.platform.ready().then(() => {
var myoption = {
timeout:5000,
enableHighAccuracy:true …Run Code Online (Sandbox Code Playgroud) 我的 ionic 4 代码中有一个按钮和一个函数。理想情况下,单击按钮时,该功能应该启动,但事实并非如此。
我的 HTML
<ion-content padding>
<div class="contentFlow" id="profile-content">
<h1>Profile</h1>
<ion-button (click)="clicked()" expand="block" color="light">
Logout
</ion-button>
</div>
</ion-content>
Run Code Online (Sandbox Code Playgroud)
我的技术:
clicked() {
alert('hello');
}
Run Code Online (Sandbox Code Playgroud)
注意:我需要将 div 保留在我的代码中。
我应该怎么办?
当我运行“离子电容器运行android”命令以在android studio中启动我的应用程序时,出现错误消息:
无法启动Android Studio。”,您必须使用JavaScript转义的路径,在capacitor.config.json中配置“ linuxAndroidStudioPath”以指向studio.sh的位置:例如:{“ linuxAndroidStudioPath”:“ / usr / local / android -studio / bin / studio.sh“}
但是我配置了我的电容器.config.json的路径,但错误仍然存在。
这是我的capacitor.config.json文件
android-studio ionic-framework ionic-native ionic4 capacitor
正如官方文档 [1] 中提到的,我一直在尝试使用 Cordova Advanced HTTP 插件 [2] 在 Ionic + Angular + Capacitor 项目中实现 SSL Pinning。
但是,每次我用 Xcode 打开 iOS 应用程序时,它都会记录一个错误 [3],说证书无效,我认为这是错误的。
2019-07-02 09:20:13.211085+0530 App[481:58424] TIC SSL Trust Error [1:0x280002100]: 3:0
2019-07-02 09:20:13.228677+0530 App[481:58424] NSURLSession/NSURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9813)
2019-07-02 09:20:13.228721+0530 App[481:58424] Task <46E01436-B71E-421D-B8F0-584EBEBEDD56>.<1> HTTP load failed (error code: -1202 [3:-9813])
2019-07-02 09:20:13.228908+0530 App[481:58418] Task <46E01436-B71E-421D-B8F0-584EBEBEDD56>.<1> finished with error - code: -1202
2019-07-02 09:20:13.231665+0530 App[481:58415] Task <46E01436-B71E-421D-B8F0-584EBEBEDD56>.<1> load failed with error Error Domain=NSURLErrorDomain Code=-1202 "The certificate for this …Run Code Online (Sandbox Code Playgroud) ionic-framework certificate-pinning ionic-native ionic4 capacitor
连接的设备:
它正在运行开发者选项并启用了 USB 调试
它使用 MTP 作为设备文件管理器
驱动程序已安装到笔记本电脑上,没有任何问题,我可以正常浏览文件
当我运行:ionic cordova run android --device我得到这个输出:
BUILD SUCCESSFUL in 5s
42 actionable tasks: 42 up-to-date
Built the following apk(s):
C:\Users\K-PC\myApp\platforms\android\app\build\outputs\apk\debug\app-debug.apk
native-run.cmd android --app platforms\android\app\build\outputs\apk\debug\app-debug.apk --device
[native-run] ERR_NO_DEVICE: No hardware devices found. Not attempting emulator because --device was specified.
[native-run]
[native-run] More details for this error may be available online:
[native-run]
[native-run] https://github.com/ionic-team/native-run/wiki/Android-Errors
[ERROR] An error occurred while running subprocess native-run.
native-run.cmd android --app platforms\android\app\build\outputs\apk\debug\app-d... exited with exit code 1.
Re-running this …Run Code Online (Sandbox Code Playgroud) 我有一个 Ionic 5/Angular 应用程序,它使用 Ionic Native Camera 插件来拍照并裁剪图像。在我更新到 Android 11(使用 note 10 plus)之前,该功能一直运行良好。更新后,裁剪时抛出以下错误:无法保存裁剪后的图像 - 访问被拒绝。
TS代码:
takePicture() {
this.androidPermissions.requestPermissions([this.androidPermissions.PERMISSION.READ_EXTERNAL_STORAGE,
this.androidPermissions.PERMISSION.WRITE_EXTERNAL_STORAGE]);
const options: CameraOptions = {
quality: 100,
targetHeight: 1920,
targetWidth: 1080,
sourceType: 1, // CAMERA
destinationType: 0, // DATA_URL
encodingType: this.camera.EncodingType.JPEG,
correctOrientation: true,
allowEdit: true
};
this.camera.getPicture(options).then((imageData) => {
// Persist image data
});
}
Run Code Online (Sandbox Code Playgroud)
应用程序在其他设备上运行良好。还检查了我的应用程序、图库应用程序和照片编辑器应用程序是否具有存储和相机权限。我可以拍照,裁剪器会打开 - 点击“完成”后,会显示“访问被拒绝”消息,紧接着会显示“无法保存裁剪后的图像”。
注意:我在另一台运行 Android 11 的设备上进行了测试,结果出现了相同的错误。
我正在开发一个使用谷歌地图和离子电容器的移动应用程序。我在谷歌地图 API 中创建了密钥。我激活了 Maps JavaScript API 和 Maps SDK for Android API。我添加了一种计费方式。我可以使用我创建的密钥在浏览器上看到地图,但我在 Android 应用程序中收到错误。因此,不显示地图。在 AndroidManifest.xml 中添加了 api 密钥。
我添加到 AndroidManifest.xml 的权限:
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
Run Code Online (Sandbox Code Playgroud)
错误如下。W/DynamiteModule:未找到 com.google.android.gms.googlecertificates 的本地模块描述符类。
无法使用 defaults.java.io.FileNotFoundException 检索 com.google.android.libraries.consentverifier#com.xxx.xxx 的标志快照:/data/user/0/com.xxx.xxx/files/phenotype/shared/ com.google.android.libraries.consentverifier#com.xxx.xxx.pb:打开失败:ENOENT(没有这样的文件或目录)
感谢您的帮助...
我正在寻找文件操作,例如创建,读取和写入文本或登录文件,我进行了很多研究,但是我没有找到合适的例子来做。该链接给出了示例,但当我在打字稿文件中使用该示例时,出现类似[ts]的错误,例如类型'Window'上不存在属性'requestFileSystem'。
像这样的例子
window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, function (fs) {
console.log('file system open: ' + fs.name);
fs.root.getFile("newPersistentFile.txt", { create: true, exclusive: false }, function (fileEntry) {
console.log("fileEntry is file?" + fileEntry.isFile.toString());
// fileEntry.name == 'someFile.txt'
// fileEntry.fullPath == '/someFile.txt'
writeFile(fileEntry, null);
}, onErrorCreateFile);
}, onErrorLoadFs);
function writeFile(fileEntry, dataObj) {
// Create a FileWriter object for our FileEntry (log.txt).
fileEntry.createWriter(function (fileWriter) {
fileWriter.onwriteend = function() {
console.log("Successful file write...");
readFile(fileEntry);
};
fileWriter.onerror = function (e) {
console.log("Failed file write: …Run Code Online (Sandbox Code Playgroud) ionic-native ×10
android ×4
ionic4 ×4
angular ×3
capacitor ×3
ionic2 ×2
ionic3 ×2
google-maps ×1
ionic5 ×1
native ×1
typescript ×1