Oculus商店同时支持免费和付费的应用程序。目前,我们支持全球范围的交易,仅限使用信用卡(除美国禁止贸易的国家)。
我们鼓励开发者去使用授权系统来保护他们的付费应用。
在Oculus账号管理工具的文档中,包含我们的账号设置门户网站和应用程序的统计报告工具,请参考Account Management章节。
通过手机SDK里自带的VrPlatform可以有效地进行授权检查。这个功能通常用于保护通过未经授权的分销商店出售的应用程序。在一个授权检查期内,应用的包名称与当前所登录的用户有权使用的应用清单进行比较。这种检查与Oculus后台服务一样,不可见并且自动执行的。
如果用户的授权应用清单中找不到这个应用包名称,那么这个应用进程将会被杀死,并且首页将自动启动来显示错误提示。如果检查进程运行有错误,为了防止规避,应用将和授权信息未找到的情况一样处理。
此检查可能存在的失败原因有:
- 没有安装服务/服务连接失败
- 无效的服务签名参数
- 调用的应用程序既不是开发商(OSIG),也不是VR签名的
- 没有用户登录
- 用户未被授权
注意:授权检查可以在开发过程中保持启用状态,因为任何开发构建必须要使用一个有效的osig文件才会自动跳过检查。当Oculus标记了你的发布包,我们将测试集成来确认你的应用授权是判定为正确的。
本机:Java
从/sdk/1stParty/VRPlatform/libs/目录下复制vrplatlib.jar到你的工程/libs/路径下,并且加入到你的工程构建路径。
在你的activity(Android组件)的onCreate方法里,添加如下代码:
OVREntitlementChecker.doAutomatedCheck(this);
本机:C++
按照上面“本机:Java”中描述的步骤。每个本地工程必须继承VrActivity。这通常被称为MainActivity,所以与Java一样,在这个MainActivity的onCreate里添加授权检查。
Unity
默认情况下授权检查在Unity是禁用的。要启用授权检查:
- 选择Edit >Project Settings >Player
- 在PlayerSettings窗口,选择Android图标并且展开Other Setting选项卡
- 在Scripting Define Symbols字段中,添加USE_ENTITLEMENT_CHECK
验证授权集成
你可以通过检查启动应用后的logcat的输出来验证你的集成。
例如:
D/OVREntitlementChecker(19779): Package oculussig verified, entitlement check was skipped.
注意:术语“oculussig”等同于“osig”
原文如下
Oculus Store supports both free and paid applications. We currently support commerce worldwide (except in US trade-embargoed countries) via credit card only.
We encourage developers to use the Entitlement System to secure their paid applications.
For documentation on Oculus Account Management tools, including our account setup portal and application stats reporting tool, please see Account Management.
Entitlement checking is available through VrPlatform in the Mobile SDK. This feature is typically used to protect applications sold through the store from unauthorized distribution. During an entitlement check, the application’s package name is compared with a list of applications that the currently logged-in user is entitled to use. This check is performed invisibly and automatically with the Oculus background service.
If the application package name is not found on the user’s entitlement list, the application is killed, and Home automatically launches to display an error message. If the check runs into any error, applications are treated as though an entitlement were not found, in order to prevent circumvention.
Possible failures in this check are:
- No service installed/problem connecting to service.
- Invalid service signature.
- Calling app is neither developer (osig) nor VR signed.
- No user logged in.
- User is not entitled.
Note: Entitlement checking may be left enabled during development, as any development build with a valid osig file will automatically skip the check. When Oculus signs your package for release, we will test the integration to confirm that your application’s entitlement is verified correctly.
Native: Java
Copy the vrplatlib.jar library from /sdk/1stParty/VRPlatform/libs/ into your project’s /libs/ directory and add to your project’s build path.
In your activity’s onCreate method, add the following line:
OVREntitlementChecker.doAutomatedCheck(this);
Native: C++
Follow the procedure described in the “Native: Java” section above. Every native project must subclass VrActivity. This is usually called MainActivity, so add the entitlement check in the onCreate as with Java.
Unity
Entitlement checking is disabled by default in Unity. To enable entitlement checking:
- Select Edit > Project Settings > Player.
- In the PlayerSettings window, select the Android icon and expand the Other Settings tab.
- In the Scripting Define Symbols field, add USE_ENTITLEMENT_CHECK.
Verifying Entitlement Integration
You can verify your integration by checking the logcat output after starting your app.
For example:
D/OVREntitlementChecker(19779): Package oculussig verified, entitlement check was skipped.
Note: The term “oculussig’ is equivalent to “osig.”