Wednesday, January 11, 2023

Android Updates

Well once upon a time, it was very easy to develop, test and push into the PlayStore.  I guess Google became jealous of Apple and its layers of requirements.  At som epoint I do understand that they need to have standards, but these updates every year are time consuming for the single person developer.   I spent the last 3 days trying to move one app (TDust) into the play store.  Now part of it is truly my fault for not keeping the apps up to date.  So trying to move from API 24( #7) to the new required API 30 (#11) and 64 bit versions has been fun. I can test on Adroid 7,8,11 and 12 with the devices I have.  I actually went to Best Buy and bought an unlocked phone.  It was $165 if you activate it and $165 if you dont.  Naturally I did not activate.  It is more a less a mini tablet.

I had already done the Permission thing before, but Google keeps changing the permissions required.  When permissions were implemented, to use BLE you need to have location permissions. I suppose it is because there is small possibility that the location of the phone can be determined.  But this changed as the APIs advanced.  First it was coarse location then fine and now coming in API 31 (#12) no location as long as you swear on someone's grave you wont use BLE to find the phone's location.  Actually they are completely revamping the permissions around BLE it looks like.

I am only complying with API 30 and the new App bundle requirement for now.  This is good for new apps until Aug 2022 and Updates until Nov 2022, at which point it is API 31/32.  With the price of gas, I assumed I would not be making many trips this summer, but that did not happen as we were gone much more than planned.  

When I went all the way to API 30, it all failed big time.  The program crashed, the debugger failed, it was a mess.  So I went back two revisions on the Embarcadero Delphi compiler, API 24 and the last set of code that worked from SVN.  That worked on all the devices, though Android complained a lot when installing on the newer devices. So I slowly marched up the API list.  One thing I did was create a separate code module to handle the permissions.  That way once I figured it out, it would hopefully work for all my programs.  When I got to API 29 (#10) I had to switch the compiler version, since the older version did not support API 29(#10).  This is where permissions started changing and I had to research what was happening.  After two days I finally got it all working on API 29.  I am now one step away.  At this point I had to move to the latest version of the compiler.  This caused quite a few library types to change, but I was smart enough to implement conditional compilation so that I could go back and forth on the compiler versions.  This proved useful as API 30 did not come easily.  But after a day of searching and changing, the app finally worked on all the devices with API 30 as the target.

Then uploading to the Play Store became another fun thing.  You cant upload APKs any more they have to be in the new App Bundle format. And now signing/encrypting the App is not good enough, the upload has to have a key also.  They can be the same, but they recommend against it.  Well I converted my existing key to the format they wanted but could not figure out how to generate a separate upload key.  So for now they are the same.  Supposedly I can change the upload key, I just cant change the App key.  I uploaded the app and then the Play Store went nuts about a permission, background location.  I had read the it was now required, but they wanted to know why I was using and to provide a 30 sec video showing how it was used.  Then a week or so they would get back to me.  So I deleted the upload, went back removed the permission and tested again.  It all seemed to work.  Upload this new version, no complaints and it was published.

But it cant end here.  I then tested the install on the devices. The older devices were still installing the older version, don't know why.  Something I have to look into.  But the 64 bit version just crashed on start.  So back to the devices.  The compiler keeps separate configs for debug and release.  I had failed to test the 64 bit release version.  Found a setting in the 64 bit release config that was wrong.  Once that was fixed, the 64 bit devices started working.

I still need to find out why the new 32bit version is not installing.  You would thing this is not a big deal, but............  The Samsung A13 I bought at Best Buy is an ARM8 64 bit, but they installed the 32 bit version of Android.  So even if Google is screaming 64bit to everyone, some of the big guys are still installing 32 bit OS, even on 64 bit ARMs. 

Next is the API 31/32 update due in Feb 2023 now.

No comments:

Post a Comment