Add a Plugin to Your Unity Project
To add a Unity package to your project, follow these steps:
- In your Unity development environment, open the Project tab.
- In the left pane of the Project tab, right click the Assets folder, then select Import Package → Custom Package… in the context menu. An Import package… window opens.
- In the Import package… window, navigate to the folder containing the file with the .unity package extension that represents the plugin you wish to import.
- Select the .unitypackage file, and click Open. An Importing package window opens.
- In the Importing package window, review the list of files to be imported and check for conflicts with files already in your project. If a conflict exists, save any local changes somewhere outside of your project.
- Click Import. The package's files are added to the Assets folder.
- If you saved any local changes outside of your project, use your favorite file merging software to merge the differences between the file(s) you imported and the file(s) you saved.
Setup for In-App Purchasing
If you use Amazon's In-App Purchasing API (available in the Appstore SDK Unity plugin - or the older IAP v2.0 Unity plugin), you must update your manifest to declare the IAP response receiver before creating your Android APK. A sample Android manifest is included with the IAP response receiver in Assets/Plugins/Android
.
If you already have an Android manifest, you can use the following example to update your app's manifest. If your app targets Android 12 or higher, you must explicitly set android:exported
to true
in the MainActivity
and ResponseReceiver
as shown.
<application>
...
<activity android:name="com.amazon.sample.iap.entitlement.MainActivity"
android:label="@string/app_name" android:exported="true" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<receiver android:name="com.amazon.device.iap.ResponseReceiver" android:exported="true"
android:permission="com.amazon.inapp.purchasing.Permission.NOTIFY" >
<intent-filter>
<action
android:name="com.amazon.inapp.purchasing.NOTIFY" />
</intent-filter>
</receiver>
</application>
If you don't already have an Android manifest, you can rename IapSdkCptServiceSampleAndroidManifest.xml to AndroidManifest.xml. You should update the package
, android:versionName
, and android:versionCode
attributes of the manifest node.
Last updated: Sep 20, 2022