Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not open Google Play Store for Google Fit if not available #19

Closed
sgilroy opened this issue Nov 2, 2016 · 3 comments
Closed

Do not open Google Play Store for Google Fit if not available #19

sgilroy opened this issue Nov 2, 2016 · 3 comments
Assignees
Labels
enhancement feature request

Comments

@sgilroy
Copy link

sgilroy commented Nov 2, 2016

Currently if Google Fit is not installed, calling health.isAvailable() will open the Google Play Store to allow the user to install Google Fit. This is problematic in my application because we want to determine if Google Fit is available and then from there decide what to show the user with regards to options for enabling Google Fit integration. Checking for availability should be a separate method from helping the user install Google Fit. Alternatively, the same method isAvailable() could be used, but an optional parameter could be used to determine whether to open the Google Play Store if the package is not installed.

@dariosalvi78
Copy link
Owner

OK, both ideas (flag or separate function) are OK for me. Maybe the flag is easier. Are you going to propose a pull request for it?

@sgilroy
Copy link
Author

sgilroy commented Nov 2, 2016

@dariosalvi78 I will probably not be working on a hotfix for this in the short term, though it is in our backlog to fix this eventually. I agree that the flag is likely easier to implement, but I would argue that by sending the user to the Google Play Store the isAvailable() method has a side effect, and that is a bad pattern for a getter method. I think a separate method, such as openDownloadPage() or something like that would make more sense.

For now we are using a reasonable workaround for our app, which is to wait to check isAvailable() until after the user turns on Google Fit integration. To make this work, I implemented two separate methods in for our settings page: isHealthIntegrationPossible() and isHealthIntegrationAvailable(). On iOS, we check isAvailable() in both isHealthIntegrationPossible() and isHealthIntegrationAvailable(), and on an iPad this will return false. On Android, we check for the presence of the cordova-plugin-health in isHealthIntegrationPossible() and call isAvailable() from isHealthIntegrationAvailable(). The "possible" check determines whether the integration feature is visible at all, and when the integration is enabled, the "available" check determines whether the integration is used to get data from the plugin.

We still want to get this issue resolved so we can provide a better experience for Android users. Since we don't have a way to determine whether Google Fit is available that does not potentially send the user to the Google Play Store, we can't provide the user with an explanation of what is about to happen.

@dariosalvi78
Copy link
Owner

You're right, a getter should be a getter :)

I can work on that, it should be easy enough.

@ghost ghost assigned dariosalvi78 and ghost Nov 23, 2016
@ghost ghost added the enhancement feature request label Nov 23, 2016
@ghost ghost closed this as completed in 223cf65 Nov 23, 2016
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement feature request
Projects
None yet
Development

No branches or pull requests

2 participants