問題描述
是否可以向服務添加許可證檢查(使用許可證驗證庫)? (Is it possible to add a license check (using License Verification Library) to a Service?)
The fourth task in integrating the LVL with one's application code, as is described by http://developer.android.com/guide/publishing/licensing.html, is "Adding code to check the license in one's application's main Activity". The document says:
Once you've implemented a Policy for managing access to your application, the next step is to add a license check to your application, which initiates a query to the licensing server if needed and manages access to the application based on the license response. All of the work of adding the license check and handling the response takes place in your main Activity source file.
What happens if the application has no Activity class? In an application consisting only of an Android Service, can we add license check code to a Service source file instead?
‑‑‑‑‑
參考解法
方法 1:
If you are starting the service from an activity, you can implement the LVL in the startup activity. Alternatively, create an activity at startup ... something similar to startup splashscreen.