Hi Yury,
There could be situation when there are several appstores installed on a device. So you should provide developers a way to detect if your appstore was used to download the app.
I suggest implementing two additional methods in the interface:
1. To check if this appstore was used to install the app
2. To check if this appstore can handle in-app purchases of this app (in case the app was side-loaded so to appstore answers that the app was installed by it)
Best regards,
Vassili
I agree, it makes sense.
Let's brainstrorm general library structure together. First of all the library should be broader than in-app billing. It should include other store-specific APIs (like licensing, push, etc) as well. So I suggest the following structure:
enum AppstoreService {
APPSTORE_SERVICE_IN_APP_BILLING,
APPSTORE_SERVICE_LICENSING,
...
}
class AppstoreServiceManager {
Appstore getAppstoreForService(String
packageName, AppstoreService appstoreService);
Appstore getInstallerAppstore(String packageName);
List<Appstore> getAppstoresSupportingAPI(String
packageName, AppstoreService appstoreService);
}
interface Appstore {
boolean hasApp(String packageName);
boolean isInstaller(String packageName);
boolean isServiceSupported(AppstoreService
appstoreService);
AppstoreInAppBillingService getInAppBillingService();
//... other methods that return different Appstore specific
services
}
Will appreciate your feedback about this architecture.
Question:
1. Should we use "String package" parameter or just pass Context that the library would get application package name itself?
Best regards,
Vassili
Don't warry. One can sue you only for trademark vialation but:
- You can violate a trademark only buy confusing end-users, using a trademark in API function name is not a trademark violation
- Apple failed to get "AppStore" trademark because the court
has decided it is a generic term:
http://appleinsider.com/articles/13/01/02/court-dismisses-apple-trademark-suit-over-amazon-appstore-name
And there is no better term to describe an appstore than "appstore" ;) So I suggest just using it.
> Also, as your main idea is to provide
> wrapper/adapter for client part, but not store itself, it is useful
to
> postfix with "lib", "client", etc.
I do not the fact is that it is a wrapper for an appstore not appstore itself it is a reason to reflect in the name. For developers this class is an appstore because it is how its app communicated with an appstore.
If there is Camera class:
http://developer.android.com/reference/android/hardware/Camera.html
for sure it is not camera itself but wrapper ;)
Best regards,
Vassili