Getting Started with Cordova
WARNING: The repository is not meant as a fully fledged Cordova plugin, but as a base for further development instead.
You can copy the repository into your own project and use the
cordova plugin add /path/to/plugin --link command to add it to your app. You will most likely need to adjust the codebase to fit your requirements and to customize the PhotoEditor SDK. For customizations, take a look at the PESDKPlugin.m and PESDKPlugin.java files and the corresponding documentation for iOS and Android. You can easily alter the configurations to change colors, behaviour etc. and handle callbacks that are sent by our SDK.
WARNING: The SDK requires dedicated license files for each platform. If unavailable, the camera and editor will crash upon launch.
You need to add the LICENSE_IOS and LICENSE_ANDROID files to each project. This can be done manually by opening the PESDKDemo.xcworkspace using Xcode and dragging the license file into the sidebar, as well as copying the license file to the /platforms/android/app/main/assets folder for Android.
Or automated by using Cordovas
resource-file tags to link the files from the root directory. To do so, put your
LICENSE_IOS files in the root folder of your project and then add the following lines to your
Within the Android platform tag (supported starting
<platform name="android"> <resource-file src="LICENSE_ANDROID" target="app/src/main/assets/LICENSE_ANDROID" /> </platform>
Within the iOS platform tag:
<platform name="ios"> <resource-file src="LICENSE_IOS" /> </platform>
WARNING: You need to make sure that the app identifiers declared in your license files match the bundle/app identifiers used on iOS and Android.
present method, but will need to handle the different ways both platforms manage filepaths. To launch the example app, take a look at the Development section below.
In order to use the plugin within your Cordova app you need to follow some steps, detailed in the following paragraphs.
The plugin adds the
NSPhotoLibraryUsageDescription keys to your iOS apps
Info.plist file. These are required as of iOS 10 and not setting them will cause your app to crash.
You can customize these messages to match your use case in the plugin.xml file:
<config-file target="*-Info.plist" parent="NSCameraUsageDescription"> <string># YOUR TEXT HERE #</string> </config-file> <config-file target="*-Info.plist" parent="NSPhotoLibraryUsageDescription"> <string># YOUR TEXT HERE #</string> </config-file>
No special configuration is needed for Android. Just require the plugin.
The example app was created by starting a new Cordova app, adding the iOS and Android platforms and linking the plugin using the
cordova plugin add /path/to/plugin --link command mentioned above.
To run the Android and iOS samples you can then simply execute
cordova run android or
cordova run ios from the
If you make changes to the plugin in the root directory, you’ll likely have to remove and add the plugin to your example project again to make sure the updated source code is used.