I found a way that works!  And it is simple.  A co-worker of mine has this
slogan on his whiteboard: "Do the simplest thing that could possible work."

I have my main app, which contains both free and paid code.  I also have an
app that acts as a key to unlock the pro version.

The following code tells me if my main app should be running in free or paid
mode:

public class PaidMode
{
    public static boolean isInPaidMode(Context context)
    {
        String mainAppPkg = ...;
        String keyPkg = ...;
        int sigMatch = context.getPackageManager.checkSignatures(mainAppPkg,
keyPkg);
        return sigMatch == PackageManager.SIGNATURE_MATCH;
    }
}


Anywhere I want to have different functionality between modes I can just
call that method.

Hope this helps someone else as well!

Thanks,
Justin

----------------------------------------------------------------------
There are only 10 types of people in the world...
Those who know binary and those who don't.
----------------------------------------------------------------------


On Fri, Sep 18, 2009 at 9:40 AM, AngelOD <angelod1...@gmail.com> wrote:

>
> Yes, I would also highly recommend the use of either a shared Java
> library, or SVN (in which case you should read up on merging two
> source trees, as that's exactly for that purpose). In my experiences,
> the use of symlinks can get rather messy, but is of course quite
> possible, both on Linux, Mac, and Windows (Win2K and higher), it just
> requires that you know what you're doing.
>
> - Tristan
>
>
> On Sep 18, 6:57 am, Raphael <r...@android.com> wrote:
> > Not yet. You can get around by extracting as much application logic as
> > possible in a java lib, but you still need basically two projects for
> > the android parts & resources.
> >
> > If you're using Linux or a source control system like SVN you can
> > share or symlink your res dir however. It's far from ideal though.
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to android-beginners@googlegroups.com
To unsubscribe from this group, send email to
android-beginners-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to