nativescript

How to execute in first a function and in second canActivate()

一笑奈何 提交于 2019-11-29 15:28:13
I have this AuthGuard. In this code I want to create a condition. If my resetpasss is not null I want to navigate in here ResetPassIdComponent else I want to navigate in LoginFirstComponent. For this I create AuthGuard. export class AuthGuard implements CanActivate { myappurl: any; resetpasss: any; constructor(private router: Router, private auth: LoginService) { } geturl() { handleOpenURL((appURL: AppURL) => { console.log('Got the following appURL1', appURL); this.myappurl = appURL let url_1 = this.myappurl.toString(); let url_id = url_1.split("/").reverse()[0]; this.resetpasss = url_id let

Fetch Api:Can not get data from localhost

孤街浪徒 提交于 2019-11-29 15:25:51
I have been trying to create an android app using nativescript.I am using fetch module to get response from my server.When I am trying to get response from httpbin.org/get ,it is OK.But when I am trying to get response from my local server,I am getting Network Request Failed. error. Sending to httpbin.org/get- return fetchModule.fetch("https://httpbin.org/get").then(response => { return response.text(); }).then(function (r) { console.log(r); }, function (e) { console.log(e); }); Sending to localhost:8000/api- return fetchModule.fetch("http://localhost:8000/api").then(response => { return

Does nativescript supports .so file in android platform?

烈酒焚心 提交于 2019-11-29 14:52:15
Recently we are using nativescript to build an app, and we need to use a third-patty library which provides both IOS and Android SDK. But it failed even we push .so file to lib folder, the error is the library cannot find the expected .so file during app running. So I want to know does nativescript supports .so file and how to make it works? Thanks in advance. Currently this task is not automated in the tns CLI but it should be possible to copy your *.so files in <project>/platforms/android/libs/jni/armeabi-v7a and/or <project>/platforms/android/libs/jni/x86 directories. Gradle build respects

Nativescript background-image fullscreen

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-29 14:15:15
问题 I want to create app in Nativescript with fullscreen image on page. I have to use background-image: url('~/images/background.jpg'); . But how to make it full screen. Thanks for your help 回答1: You need to use the NativeScript supported CSS properties to achieve this. I've used the following CSS on a background-image attached to the <Page> view before and it works fine. .coverImage { background-image: url('~/images/kiss.jpg'); background-repeat: no-repeat; background-position: center;

Nativescript accessing localhost access in android and ios

落爺英雄遲暮 提交于 2019-11-29 11:59:41
I have a local node rest api running on my system. My question is ,when accessing localhost from android we are supposed to use 10.0.2.2. And When using ios we can use localhost . So is there a way we can control the host name we call , depending on the environment ios or android in a nativescript app inside JS file you can use following (better when u need quick decide what to use per platform code) /*at top file*/ var platform = require("platform"); var nativePlatformLocalhost; /*in some function or globally*/ if(platform.device.os === platform.platformNames.ios){ /*localhost for ios*/

NativeScript handling back button event

半腔热情 提交于 2019-11-29 07:32:18
I am trying to handle the hardware back button in a NativeScript app. I am using NativeScript version 2.3.0 with Angular. Here is what I have in main.ts file // this import should be first in order to load some required settings (like globals and reflect-metadata) import { platformNativeScriptDynamic, NativeScriptModule } from "nativescript-angular/platform"; import { NgModule,Component,enableProdMode } from "@angular/core"; import { AppComponent } from "./app.component"; import { NativeScriptRouterModule } from "nativescript-angular/router"; import { routes, navigatableComponents } from ".

Nativescript localhost http call fails on iOS

女生的网名这么多〃 提交于 2019-11-28 12:13:51
问题 I am using Nativescript sidekick cloud build on windows to test my app on iOS - I have also connected my iPhone. According to this post I am sending my http requests to localhost but they keep failing with this error. Http failure response for http://localhost:52553/api/rewards/all: 0 Unknown Error Error: Could not connect to the server. Here is my implementation of rewards service import { Injectable } from "@angular/core"; import { HttpClient } from "@angular/common/http"; import {

How to execute in first a function and in second canActivate()

末鹿安然 提交于 2019-11-28 09:29:23
问题 I have this AuthGuard. In this code I want to create a condition. If my resetpasss is not null I want to navigate in here ResetPassIdComponent else I want to navigate in LoginFirstComponent. For this I create AuthGuard. export class AuthGuard implements CanActivate { myappurl: any; resetpasss: any; constructor(private router: Router, private auth: LoginService) { } geturl() { handleOpenURL((appURL: AppURL) => { console.log('Got the following appURL1', appURL); this.myappurl = appURL let url_1

Does nativescript supports .so file in android platform?

為{幸葍}努か 提交于 2019-11-28 08:51:47
问题 Recently we are using nativescript to build an app, and we need to use a third-patty library which provides both IOS and Android SDK. But it failed even we push .so file to lib folder, the error is the library cannot find the expected .so file during app running. So I want to know does nativescript supports .so file and how to make it works? Thanks in advance. 回答1: Currently this task is not automated in the tns CLI but it should be possible to copy your *.so files in <project>/platforms

Nativescript accessing localhost access in android and ios

心不动则不痛 提交于 2019-11-28 06:20:38
问题 I have a local node rest api running on my system. My question is ,when accessing localhost from android we are supposed to use 10.0.2.2. And When using ios we can use localhost . So is there a way we can control the host name we call , depending on the environment ios or android in a nativescript app 回答1: inside JS file you can use following (better when u need quick decide what to use per platform code) /*at top file*/ var platform = require("platform"); var nativePlatformLocalhost; /*in