[android-beginners] Re: Free and Paid apps with same code-base???

2009-10-01 Thread Justin Anderson
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
-~--~~~~--~~--~--~---



[android-beginners] Re: Free and Paid apps with same code-base???

2009-10-01 Thread Chi Kit Leung
Do you want to put into Android Market?
As I remember, they use the application namespace as a primary key.
So, you cannot install both of free and paid app in a same phone.

On Fri, Oct 2, 2009 at 8:17 AM, Justin Anderson janderson@gmail.comwrote:

 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.



 



-- 
Regards,
Michael Leung
http://www.itblogs.info
http://www.michaelleung.info

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[android-beginners] Re: Free and Paid apps with same code-base???

2009-10-01 Thread Justin Anderson
The market uses the package name.  So they can both be put on the market.
For example, my app consists of these packages:

Main App: com.magouyaware.appswipe
Key App: com.magouyaware.appswipe2

Because they have different package names they can both be uploaded to the
market.

On Oct 1, 2009 8:58 PM, Chi Kit Leung michaelchi...@gmail.com wrote:

Do you want to put into Android Market?
As I remember, they use the application namespace as a primary key.
So, you cannot install both of free and paid app in a same phone.

On Fri, Oct 2, 2009 at 8:17 AM, Justin Anderson janderson@gmail.com
wrote:   I found a way t...
Regards,
Michael Leung
http://www.itblogs.info
http://www.michaelleung.info

--~--~-~--~~~---~--~~ You received this
message because you are su...

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[android-beginners] Re: Free and Paid apps with same code-base???

2009-10-01 Thread Chi Kit Leung
Thanks for the corrections!

On Fri, Oct 2, 2009 at 1:03 PM, Justin Anderson janderson@gmail.comwrote:

 The market uses the package name.  So they can both be put on the market.
 For example, my app consists of these packages:

 Main App: com.magouyaware.appswipe
 Key App: com.magouyaware.appswipe2

 Because they have different package names they can both be uploaded to the
 market.

  On Oct 1, 2009 8:58 PM, Chi Kit Leung michaelchi...@gmail.com wrote:

 Do you want to put into Android Market?
 As I remember, they use the application namespace as a primary key.
 So, you cannot install both of free and paid app in a same phone.

 On Fri, Oct 2, 2009 at 8:17 AM, Justin Anderson janderson@gmail.com
 wrote:   I found a way t...
 Regards,
 Michael Leung
 http://www.itblogs.info
 http://www.michaelleung.info

 



-- 
Regards,
Michael Leung
http://www.itblogs.info
http://www.michaelleung.info

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[android-beginners] Re: Free and Paid apps with same code-base???

2009-09-18 Thread AngelOD

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
-~--~~~~--~~--~--~---



[android-beginners] Re: Free and Paid apps with same code-base???

2009-09-17 Thread Raphael

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.

R/

On Thu, Sep 17, 2009 at 1:39 AM, MagouyaWare magouyaw...@gmail.com wrote:

 Is there an easy way to have both free and paid applications that use
 the same code-base?

 I have just published my first application, which has both a free and
 paid version.  However, in order to do that I had to make lots of
 manual changes to my package.

 Is there any way around this?

 


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---