Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (539)
Games in Android Showcase (132)
games submitted by our members
Games in WIP (603)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Two last questions before I release my app :)  (Read 888 times)
0 Members and 1 Guest are viewing this topic.
Offline Delta517

Senior Devvie


Medals: 2
Projects: 1



« Posted 2014-02-06 22:15:51 »

Hi! So I have two last questions before I release my game to Google Play.

1. Im going to have two different version, one free with ads and one for 1$. Should I use the same key to sign both since that would make installation easier for the user incase they upgrade? I also just thought of that If they have the Free version first and want to upgrade to the other, they will have to delete their saves and high-scores to install the new one so I guess one key to sign when exporting a apk is right? Smiley

2. Is it worth getting Google Play Licensing Check for me since I have both a free and paid version?

Thanks for reading Smiley
Offline nerb
« Reply #1 - Posted 2014-02-07 01:56:19 »

Should I use the same key to sign both

I use the same key to sign everything. I don't know of any reason to use multiple keys!?

2. Is it worth getting Google Play Licensing Check for me since I have both a free and paid version?

I guess if you forsee your app becoming reasonably popular, and the losses from piracy being relatively high, then it could be worth a thought. Otherwise I'd avoid it. (I have a hard enough time getting people to purchase my app, let alone pirate it!  Grin)
Offline Delta517

Senior Devvie


Medals: 2
Projects: 1



« Reply #2 - Posted 2014-02-07 04:34:48 »

Oh, I thought it was wise to have a different key for everything, but I can see it being better to have one for everything. Also I guess I will avoid the License Check then, since I don't really see my game being the new Angry Birds. I also have a free version with only simple banner ads so I don't see the point in them pirating it, though it would be a little fun to watch people going through all that trouble just to play my game without ads Smiley Thanks for the answer!
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Delta517

Senior Devvie


Medals: 2
Projects: 1



« Reply #3 - Posted 2014-02-08 00:59:22 »

Okay, another problem I have is that I had to create two different android projects (both linked to the main source of the game) with a ".free" at the free versions packaging name in the AndroidManifest, because you cant have two apps with the same packaging on Google Play. But this makes it so that the user have to restart everything if they upgrade from the free version to paid version.

All I want to is that I could save the preference file to a specific place (so it wont get removed if the free version gets removed) and make the paid version read it. And Im using LibGdx btw Smiley
Offline ricardo

Senior Devvie


Medals: 2
Projects: 3



« Reply #4 - Posted 2014-02-08 03:08:38 »

In my (small) personal experience, save your game data with SharedPreferences. Android will do all the *dirty* work for you, and it is fast.
Also, I made a quick search, and you can share same app data if your second app is a child.
Example:
free version: com.package.game
paid version: com.package.game.paid

You must use paid as a child of free (not otherwise). Because if you use:
free version: com.package.game.free
paid version: com.package.game

This will not detect your data (at least that is what I think), because your original package don't have any child.


For more information, read matt5784 answer HERE. (Just the first part, you don't need to backup nothing, etc):
Quote
it appears to be possible to share preferences between applications if a few requirements are met. First, if you want App B to be able to access App A's preferences the package name of App B must be a child of App A's package name (e.g. App A: com.example.pkg App B: com.example.pkg.stuff). Additionally, they can't be wanting to access the file at the same time
Offline Delta517

Senior Devvie


Medals: 2
Projects: 1



« Reply #5 - Posted 2014-02-08 04:59:58 »

Thanks for the answer, but a lot of people seemed against using that method Sad I have tried doing it now with using Context. I'm able to find the preference file, but it's not able to get the contents from the preference file itself, since it always returns 0 (the default value). Is this because I use LibGdx? I have read that LibGdx saves its own preference files as SharedPreferences on Android so that shouldn't be the issue.

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
public void tryLoadPrefs(){
      Context otherAppsContext = null;
     
      try {
         otherAppsContext = createPackageContext("com.mayogames.zombiecubes.free", 0);
      } catch (NameNotFoundException e) {
         System.out.println(e);
      }
     
      System.out.println("Extracting = " + otherAppsContext.getSharedPreferences("Settings", CONTEXT_IGNORE_SECURITY).getInt("seconds", 0));
   }


EDIT: Im loading in the onCreate() method. Is that a problem?
Offline ricardo

Senior Devvie


Medals: 2
Projects: 3



« Reply #6 - Posted 2014-02-08 13:45:21 »

You don't need to use try, if there is no data value return the default value you put. And, you don't need to create package. Android will do this for you.

Use something like this to create saved file:
1  
2  
3  
4  
int lvlComplete = 10;
SharedPreferences.Editor saveLevel = getSharedPreferences("game_name", 0).edit();
saveLevel.putInt("levels", lvlComplete);
saveLevel.commit(); // do not forget to commit.


And to load game data:
1  
2  
SharedPreferences getData = getSharedPreferences("game_name", 0);
int lastLevel = getData.getInt("levels",0);   // use getInt, getBoolean, getString, etc.
Offline Delta517

Senior Devvie


Medals: 2
Projects: 1



« Reply #7 - Posted 2014-02-08 16:37:41 »

You don't need to use try, if there is no data value return the default value you put. And, you don't need to create package. Android will do this for you.

Use something like this to create saved file:
1  
2  
3  
4  
int lvlComplete = 10;
SharedPreferences.Editor saveLevel = getSharedPreferences("game_name", 0).edit();
saveLevel.putInt("levels", lvlComplete);
saveLevel.commit(); // do not forget to commit.


And to load game data:
1  
2  
SharedPreferences getData = getSharedPreferences("game_name", 0);
int lastLevel = getData.getInt("levels",0);   // use getInt, getBoolean, getString, etc.


Using that method I only got the paids version own SharedPreference and not the Free version one Sad

1  
2  
3  
4  
SharedPreferences getData = getSharedPreferences("Settings", 0);
      int lastLevel = getData.getInt("seconds", 0);   // use getInt, getBoolean, getString, etc.
     
      System.out.println(lastLevel);
Offline Delta517

Senior Devvie


Medals: 2
Projects: 1



« Reply #8 - Posted 2014-02-08 16:54:08 »

I have absolutely NO IDEA what happend, but when I changed it to this

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
public void tryLoadPrefs(){
         Context otherAppsContext = null;
         SharedPreferences getData = null;
         
         try {
            otherAppsContext = createPackageContext("com.mayogames.zombiecubes.free", 0);
            getData = otherAppsContext.getSharedPreferences("Settings", 0);
         } catch (NameNotFoundException e) {
            System.out.println(e);
         }
         
         System.out.println("Extracting = " + getData.getInt("seconds", 0));
   }


It suddenly imports every single data over to my paid version? o.O Of course Im happy, but Im a little scared this is a stupid way since I dont understand how it did so... Is it maybe because the line "getData = otherAppsContext.getSharedPreferences("Settings", 0);" got the Settings file from the Free version AND at the same time made a own in the Settings and set that because of the equal sign? Smiley
Offline ricardo

Senior Devvie


Medals: 2
Projects: 3



« Reply #9 - Posted 2014-02-08 17:24:54 »

"Using that method I only got the paids version own SharedPreference and not the Free version one"

Well, it works  now and you don't need more code, but can you show me full packages name from paid and free version?
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Delta517

Senior Devvie


Medals: 2
Projects: 1



« Reply #10 - Posted 2014-02-08 18:02:03 »

I'm able to get the info now, but I'm having trouble saving the info into its own file. It seems like its linked to the Free version one, because instead of creating or saving into it's own folder, it saves to the Free version one. I think this is because of LibGdx, but I'll continue to mess around to see if I can get it to work.

The package name is:
com.mayogames.zombiecubes
com.mayogames.zombiecubes.free
Offline ricardo

Senior Devvie


Medals: 2
Projects: 3



« Reply #11 - Posted 2014-02-08 18:25:33 »

Change package names.
Free: com.mayogames.zombiecubes
Paid: com.mayogames.zombiecubes.paid

Read again my second comment. Everything should work now.
Paid version can access Free version data (but free version data cannot access paid version). No problem though users upgrade from free to paid version, not otherwise.
Offline Delta517

Senior Devvie


Medals: 2
Projects: 1



« Reply #12 - Posted 2014-02-08 18:41:50 »

Yeah, I did read that, but as I said, there was a lot of people against it so I wanted to try another method Smiley I did managed to get it to work now, by making the Free version name the settings preference "SettingsFreeVersion" instead and the paid version just "Settings" Smiley
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

rwatson462 (30 views)
2014-12-15 09:26:44

Mr.CodeIt (23 views)
2014-12-14 19:50:38

BurntPizza (50 views)
2014-12-09 22:41:13

BurntPizza (84 views)
2014-12-08 04:46:31

JscottyBieshaar (45 views)
2014-12-05 12:39:02

SHC (59 views)
2014-12-03 16:27:13

CopyableCougar4 (57 views)
2014-11-29 21:32:03

toopeicgaming1999 (123 views)
2014-11-26 15:22:04

toopeicgaming1999 (114 views)
2014-11-26 15:20:36

toopeicgaming1999 (32 views)
2014-11-26 15:20:08
Resources for WIP games
by kpars
2014-12-18 10:26:14

Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!