Tuesday, 4 November 2014

Need to get In App Billing working for Android Lollipop?

Android 5.0, or 'L' requires explicit intents.

It appears that the bind service call fails on Lollipop because of an implicit intent being used instead of an explicit intent. I am not a Java developer, so this all sounded like voodoo to me. I looked about for ways to find explicit intents, found stuff about ResolveInfo, PackageManager, even found this nice website explaining what was wrong (but not literally how to fix it) Dealing with L Deprecations: bindService()

After a bit of hacking around, I finally found enough info in one of the stack overflow answers and implemented the final fix.

I feel like I hunted for quite some time before even knowing how to find out exactly what I needed to do to modify the google example code so that it worked. Here is literally how I have modified LicenseChecker.java in order to make it work in my project:

Saturday, 30 August 2014

Power/Order/Index - an intuitive approach

I think maybe I'm doing this just so I can have something to point people at when they are wrong on the internet... but still, some of you might find it useful to have a different perspective when you're messing around with powers. It's not rigorous, because I've forgotten how to write out proper deductions.

1) 2^2 = 2*2 = 4
2) 2^3 = 2*2*2 = 8
3) 2^4 = 2*2*2*2 = 16

4) 2^2 * 2 = 2*2*2 = 8
5) 2^3 / 2 = 2*2*2 / 2 = 4

sub (1) into (5)

6) 2^3 / 2 = 2^2
infer
7) 2^3 / 2 = 2^(3-1)
8) 2^x / 2 = 2^(x-1)

sub 2 into x in (8)

9) 2^2 / 2 = 2^1
10) 2^2 / 2 = 2*2 / 2 = 2
10) 2^1 = 2

sub 1 into x in (8)

11) 2^1 / 2 = 2^0
12) 2^1 / 2 = 2 / 2 = 1
13) 2^0 = 1

sub 0 into x in (8)

14) 2^0 / 2 = 2^-1
15) 2^0 / 2 = 1 / 2
16) 2^-1 = 1 / 2

thus we see the reason why reciprocal (1/n) is also called ^-1

and now fractions:

17) 2^2 = 2 * 2 = 2^1 * 2^1 = 2^2 * 2^0
18) 2^(2-x) * 2^x = 2^2
19) 2^(n-x) * 2^x = 2^n

sub 1 for n in (19)

20) 2^(1-x) * 2^x = 2^1

sub 1/2 for x in (20)

21) 2^(1/2) * 2^(1/2) = 2^1

which explains why the square root is called ^(1/2)

for any positive value (a), (a^(1/2))^2 = (a)

to specify the cube root x of a (x*x*x = a) we need to divide the power into three (x = a^(1/3))

to specify the change in pitch of a semi tone, we know that the pitch doubles per octave, and that there are 12 notes in every octave, that's pitchchange = 2^(1/12)

If you have a game and you want something to increase in power, then you specify how much you want it to be finally at, and use power of 1 over the number of steps to get there to do it smoothly.

price of base thing (b) goes to price of super expensive (x), over four steps
price (step) = b * (x/b) ^ ((1/4) * step)
price (0) = b * (x/b) ^ ((1/4)*0) = b * (x/b) ^ 0 = b * 1
price (4) = b * (x/b) ^ ((1/4)*4) = b * (x/b) ^ 1 = b * (x/b) = x
price (2) = b * (x/b) ^ ((1/4)*2) = b * (x/b) ^ (1/2) = b * sqrt(x/b)