Reputation: 1080
I'm actually investigating the possibility to have an application that fulfill the following requirements:
So we can have some free/not free functionalities. I've already seen such a behavior in some applications but I don't remember the name.
Is there something in the Android SDK to be used? how it can be implemented?
Thanks for your help.
Upvotes: 19
Views: 20066
Reputation: 12636
First of all - what exactly you mean by "additional functionalities". Problem is quite complex.
PackageManager
and try to find desired package if found use it if not ask user for installation.PackageManager
Probably better approach to introduce free/paid features is just use in-app payment.
Upvotes: 1
Reputation: 1082
You have to build 6 different apps/apks and submit them to Play Store. And there are at least 2 options to integrate apps together:
You can also access resources from another apk using Resources res = mPackageManager.getResourcesForApplication("org.example.foo"); refer to Is it possible to access resources in another APK without using content providers? for more details.
Upvotes: 3
Reputation: 27748
Not sure if this is what you looking for, but let me suggest something to get you started (probably)
For the sake of example, say, in your application, for instance, you have 2 buttons (instead of 5)
BUTTON 1 and BUTTON 2.
When you start your application, check if the necessary applications (third party to your own application) are installed or not using the PackageManager
This is a pseudo code that I use in my app to check if Google Maps is installed or not on the users device:
boolean installedMaps = false;
// CHECK IF AN APPLICATION IS INSTALLED
PackageManager pkManager = getPackageManager();
try {
PackageInfo pkInfo = pkManager.getPackageInfo("com.google.android.apps.maps", 0); // REPLACE THIS "com.google.android.apps.maps" WITH THE ACTUAL PACAKAGE NAME
// Log.e("pkInfo", pkInfo.toString());
installedMaps = true;
} catch (NameNotFoundException e) {
e.printStackTrace();
installedMaps = false;
}
If the boolean installedMaps
returns true, enable the button. Otherwise, prompt the user to with a Dialog to download the application off Google Play.
And do this for each function you need to Activate or Deactivate.
NOTE: You will need to know the Package Name of the other application for that. If you do not know it, it can be found by running the application on your device and checking the logcat.
If you also need to share Content between all concerned application, you might also consider making use of Content Providers
Again, I am not entirely sure if this is what you are looking for. Please do correct if I am wrong in my assumption.
Upvotes: 7
Reputation: 2892
You can create apks with Service and use http://developer.android.com/guide/components/aidl.html to connect to this service. And this service can do what you want so only your imagination is your limit ;-)
I recommend read about this: http://developer.android.com/guide/topics/manifest/manifest-element.html#uid it is possible to share more data between 2 and more apps. But they should be singned with same key.
Upvotes: 7