Sure
But what if your app supports VOIP / WebRTC calls? You'll want to have the operating system pop up thenative call dialog, right? That's where this plugin comes in.
Currently iOS only, where we leverage CallKit
, which is part of the iOS SDK since iOS 10.
tns plugin add nativescript-call
Check the source in the demo folder, or run it on your own device:
git clone https://github.com/EddyVerbruggen/nativescript-call
cd nativescript-call/src
npm i
npm run demo.ios
Usage in NativeScript-Angular and NativeScript-Vue is nothing different from what you'd do in NativeScript-Core.
receiveCall
The properties you can pass to this method are:
Property | Type | Description |
---|---|---|
appName | string |
The app's name, as shown on the caller screen. Default the name of your app. |
icon | string |
The name of an icon to show for your app. Loaded from the App_Resources folder (see the demo). |
handleType | TNSCallHandleType |
Either "PHONE" (default) or "EMAIL" . |
handleId | string |
Either a phone number when handleType is "PHONE" , or an email address when handleType is "EMAIL" . |
callerName | string |
The name to be displayed on the call UI. |
hasVideo | boolean |
Whether or not this call supports video. Default false . |
supportsDTMF | boolean |
Whether the call can send DTMF (dual tone multifrequency) tones via hard pause digits or in-call keypad entries. Default false . |
The event handlers you can pass to this method are:
| Name | Description || --- | --- | --- || onSpeakerOn | Triggered when the speaker is turned on. || onSpeakerOff | Triggered when the speaker is turned off. |
import { TNSCall } from "nativescript-call";
const tnsCall = new TNSCall();
tnsCall.receiveCall(
{
appName: "My App",
icon: "download-from-cloud", // see demo/app/App_Resources/iOS
handleType: "PHONE",
handleId: "+31612345678",
callerName: "Donald J. Drumpf",
hasVideo: true,
supportsDTMF: true,
onSpeakerOn: () => console.log("Speaker ON"),
onSpeakerOff: () => console.log("Speaker OFF")
})
.then(() => console.log("Receive call success"))
.catch(err => console.log("Error receiving call: " + err));
endCall
import { TNSCall } from "nativescript-call";
const tnsCall = new TNSCall();
tnsCall.endCall()
.then(() => console.log("Ended call"))
.catch(err => console.log("Error ending call: " + err));
Either use Pusher, or this CURL command:
curl -v -d '{"userInfo":"eddy.verbruggen","aps":{"sound":"default"},"title":"Eddy Verbruggen","callType":"VIDEO"}' --header "apns-topic: com.app.sample" --http2 --cert ~/Desktop/voip/ck.pem:ggk12 https://api.development.push.apple.com/3/device/DEVICE_VOIP_TOKEN
本指南汇集React-Native各类学习资源,给大家提供便利。指南正在不断的更新,大家有好的资源欢迎Pull Requests! 同时还有Awesome React Native系列 https://github.com/jondot/awesome-react-native 目录 教程 React Native React.js ES6 系列教程 开源APP 图书 组件 工具 资源网站 业界讨
UseApplication Callbacks NativeScript applications have thefollowing life cycle events. start(): Call the start method after the module initialization to start application. //在start()之后调用,如果是点击back键,
基于0.18.1 Async batched bridge used to communicate with the JavaScript application. 分析Objective-C和JavaScript的通信机制。 Bridge承担以下工作(或者提供接口): A: 执行JavaScript代码 1 - (void)enqueueJSCall:(NSString *)moduleDot
1. 错误描述 1 queries executed, 0 success, 1 errors, 0 warnings 查询:SELECT t.`name`, DATE_FORMAT(str_to_date('2015'), '%Y') as statisDate, ROUND(IFNULL(SUM(t.`amount`), 0), 3) AS ... 错误代码: 1582 Incorrect
Script与Native交互基础 1 参照SDK中“plain-win”的例子,自定义一个窗口类,继承自sciter::host< window >和sciter::event_handler class window: public sciter::host<window> , public sciter::event_handler { HWND _hwnd;
NativeScript 可以使用 Javascript,CSS, XML 创建真正的 Native 跨平台应用,支持 iOS Android,NativeScript 将您的跨平台代码翻译成目标平台的代码。 UI 使用 XML 描述,CSS 样式,在编译时将 UI 转化成本地原生代码,最终得到正在的 Native 原生应用。 Telerik 公开了用于创建安卓、iOS和Windows Unive
NativeScript Command-Line Interface The NativeScript CLI lets you create, build, and deploy NativeScript-based apps on iOS and Android devices. Get it using: npm install -g nativescript What is Native
NativeScript-Snackbar �� �� �� NativeScript plugin for Material Design SnackBar component. Installation: NativeScript 7+:tns plugin add @nstudio/nativescript-snackbar NativeScript version prior to 7:t
Nativescript-Ripple This plugin aims to bring a native (or close to native) ripple implementation on Android and iOS. The android version uses a RippleDrawable and conserves the previous background, a
NativeScript-FloatingActionButton NativeScript plugin for Material Design Floating Action Button UI component. Installation Nativescript 7+: ns plugin add @nstudio/nativescript-floatingactionbutton Na
NativeScript CardView A NativeScript plugin to provide an XML widget to implement the Material Design CardView component. Installation NativeScript 7+: ns plugin add @nstudio/nativescript-cardview Nat