import { Application, Frame, Http, Observable, Utils } from '@nativescript/core'; import * as permissions from '@nativescript-community/perms'; export class LoginModel extends Observable { public server: string = 'http://192.168.178.59:8080'; public username: string; public password: string; constructor() { super(); } async onLogin() { const content = new FormData(); content.append('username', this.username); content.append('password', this.password); const response = await Http.request({ url: this.server, method: 'POST', content: content, }); console.log(response.content?.toString()); console.log( Application.android.foregroundActivity.requestPermissions([ android.Manifest.permission.READ_EXTERNAL_STORAGE, ], 3765) ); console.log( Application.android.foregroundActivity.shouldShowRequestPermissionRationale(android.Manifest.permission.READ_EXTERNAL_STORAGE) ); console.log( Utils.android.getApplicationContext().checkPermission(android.Manifest.permission.READ_EXTERNAL_STORAGE, android.os.Process.myPid(), android.os.Process.myUid()) ); console.log( permissions.request({ storage: { read: true, write: false }, photo: { reason: 'to pick images' }, }) ); } goToGalleries() { const frame = Frame.topmost(); frame.navigate('gallery-page'); } }