Creating the project
Use the following procedure to create a new Android Studio project to build the basic player for app development:
Create a suitable directory in Windows Explorer and extract the SDK zip file to it. Rename the opy-sdk-android-4.24.x-integration.jar file nmpsdk.jar.
The production.jar file is used to build the production version.In Android Studio, create a new Basic Activity project. In the wizard, set the Minimum API level to 21 (Android 5.0 Lollipop) or higher.
The Minimum API level refers to the API level needed to build the app. For submission to Google Play Store, this needs to be 28 as new apps must be built to run on Android 9 as a minimum.
In the new project, ensure the Android view is selected, select app > manifests, and open the AndroidManifest.xml file. Add the following permission before the
<application>
tag.CODE<uses-permission android:name="android.permission.INTERNET"/> <uses-permission android:name="android.permission.WAKE_LOCK" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> <uses-permission android:name="android.permission.READ_PHONE_STATE" android:maxSdkVersion="22"/> <uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
Switch to Project view, expand the project and select app. Copy the following .JAR files from the unzipped OpenTV Player SDK folder into the \common\libs directory.
- opy-sdk-android-4.24-cpak-3.11.2.0.jar
- opy-sdk-android-4.24-cpakjava.securestorageagent-3.11.2.0.jar
- nmpsdk.jar
Select src and open the build.gradle file to verify the following line is present in the
dependencies
block.GROOVYimplementation fileTree(dir: 'libs', include: ['*.jar'])
Next step: Add OpenTV components