How can I create Android Application plugins/extensions that can be installed as an APK or from market?

I’m actually investigating the possibility to have an application that fulfill the following requirements:

  • The Main Application may have 5 deactivated functionalities
  • If you try to use a deactivated functionality, the application invites you to download an extension that can be installed as an APK or from market.
  • Once the functionality is installed, it becomes activated and then it can be used.

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.

  • How to prevent AndroidStudio from opening LogCat (tab) when pressing “Run”?
  • android camera preview wrong aspect ratio
  • Posting LinkedIn message from Android application
  • SSL Broken Pipe
  • how to scroll down a webpage
  • How to detect whether screen is on or off if API level is 4?
  • Is there something in the Android SDK to be used? how it can be implemented?

    Thanks for your help.

    Related posts:

    how to encode and decode emoji in android?
    Unable to start service - Requires ACCESS_MOCK_LOCATION secure setting
    Android picture call back data is null
    Using ItemizedOverlay and OverlayItem In Android Beta 0.9
    Reinstall application apk programmatically without downloading
    Android unable to find my onClick method
  • How to load a Java class dynamically on android/dalvik?
  • GCM Error - googleCloudMessaging.register
  • Android - AnimatorSet, Object Animator - Bounce animation chain is amalgamating?
  • Sending Amazon SNS from my PHP server
  • Alignment in Html.fromHtml()
  • How to get selected text from AccessibilityNodeInfo
  • 4 Solutions collect form web for “How can I create Android Application plugins/extensions that can be installed as an APK or from market?”

    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.

    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.

    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:

    1. If your functionality takes full screen than you can just launch appropriate activities from plugin apps.
    2. If main screen (the one from main app) should include code (functionality), resources from plugin apps (layouts, images, etc) than look at http://developer.android.com/guide/topics/manifest/manifest-element.html#uid. Using that configuration you can access code from plugin app with reflection by class name.

    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.

    First of all – what exactly you mean by “additional functionalities”. Problem is quite complex.

    1. Check for application existanece – just use PackageManager and try to find desired package if found use it if not ask user for installation.
    2. Resources access (images, layouts etc.) – also with PackageManager
    3. Use some portions of code – many different ways to get the effect. Intents (startActivityForResult()), Content providers.

    Probably better approach to introduce free/paid features is just use in-app payment.

    Android Babe is a Google Android Fan, All about Android Phones, Android Wear, Android Dev and Android Games Apps and so on.