nativescript-play-livesync
v0.0.13
Published
Playground LiveSync plugin for iOS and Android
Downloads
8
Maintainers
Keywords
Readme
NativeScript PlayLiveSync
This plugin is used for communication between NativeScript Playground website and NativeScript Preview applications(iOS and Android).
The communication between the site and the mobile applications is made through PubNub. The repository contains the native implementation in Java and Objective-C respectively.
To debug the plugin you can follow the steps from here.
Installation
tns plugin add nativescript-play-livesync
Configuration
As the plugin needs the a scheme to restart the current application when needed, the following configurations should be present in the application's App_Resources folder:
Android
The following activity configuration should be added to the AndroidManifest.xml file somewhere above <activity android:name="com.tns.ErrorReportActivity"/>
if you want to use nsplay scheme:
<activity
android:name="com.tns.playlivesync.NativeScriptActivity"
android:configChanges="keyboardHidden|orientation|screenSize"
android:launchMode="singleTask">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="nsplay"/>
</intent-filter>
</activity>
iOS
Add in Info.plist file the following configurations:
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLName</key>
<string>org.nativescript.playground</string>
<key>CFBundleURLSchemes</key>
<array>
<string>nsplay</string>
</array>
</dict>
</array>
<key>LSApplicationQueriesSchemes</key>
<array>
<string>nsplayqr</string>
</array>
In the configuration above there are 3 values that need to be set:
- nsplay - the scheme of the current application which is needed to generate a url with the following format
nsplay://....
that will be used for restarting the application with given arguments - nsplayqr - the scheme of the QR application which is used for restarting the current application
- org.nativescript.playground - the CFBundleURLName is used in the plugin only to get the first item of the CFBundleURLSchemes array from the dictionary having CFBundleURLName property set. This is needed as some plugins may add additional CFBundleURLSchemes and we may end up resolving them as the application scheme. So we used this property to distinguish the right dictionary in the CFBundleURLTypes array.
License
Apache License Version 2.0, January 2004