codenameone / CodenameOne

Cross-platform framework for building truly native mobile apps with Java or Kotlin. Write Once Run Anywhere support for iOS, Android, Desktop & Web.
https://www.codenameone.com/
Other
1.72k stars 409 forks source link

Update dependencies to support nifty in-app google play updater #3635

Open javieranton-zz opened 2 years ago

javieranton-zz commented 2 years ago

I recently tried to order some food from Just Eat and was pleased by the in-app update flow that the app offered (I hadn't used the app in a while)

The way to implement this is explained here: https://developer.android.com/guide/playcore/in-app-updates

Long story short, a new gradle dependency is required: implementation 'com.google.android.play:app-update:2.0.0'

As is always the case, this dependency requires a recent gms dependency, not the outdated ones that currently get bundled when things like CN1 Google Maps or Google sign in are used

I compiled a list of versions that will satisfy the requirement and not break things

    implementation 'com.google.android.gms:play-services-maps:18.1.0'
    implementation 'com.google.android.gms:play-services-auth:20.3.0'
    implementation 'com.google.android.gms:play-services-location:20.0.0'

However, Firebase also needs to be updated to the below in the case where apps use CN1's push stuff:

implementation 'com.google.android.gms:play-services-gcm:17.0.0';
implementation 'com.google.firebase:firebase-core:21.1.1'
implementation 'com.google.firebase:firebase-messaging:23.0.8'

These new dependencies change a bit the way push is registered. Below is an example of the new way:

FirebaseMessaging.getInstance().getToken().addOnCompleteListener(task ->{
                                    if (task.isSuccessful() && task.getResult() != null) {
                                        String token = task.getResult();

This might need to be changed in CN1's code. I use my own push implementation so I did it for myself

Lastly, the build server will need to support building with SDK 32 to support these dependencies. All works well when building with SDK 32 locally (although compileSdkVersion needs to be tweaked). And minSdkVersion needs to change from 15 to 19

I know it's a pain in the ass to do these things, but the in-app updater really is great. Especially considering how awful the app store can be when trying to update (it caches app versions and users usually end up having to reinstall rather than update)

lucile98-ode commented 2 years ago

Hello,

With @xenom34, we would like to try to resolve this issue. Is it possible to be assigned? thank you (:

shai-almog commented 2 years ago

Hi, I assigned it. But it might be a bit challenging. Not sure how doable it is. @shannah might have some pointers.

lucile98-ode commented 2 years ago

thanks you :) 👍🏻

lucile98-ode commented 2 years ago

Hello, with @xenom34 we tried but couldn't find the files. The project requires more resources than we have. We don't want to waste more time maybe someone else would be more efficient.