-
Notifications
You must be signed in to change notification settings - Fork 34
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
Update targetSdk to 26 and switch to dynamic permissions #325
Comments
this is a cordova app, so each plugin that we choose to include can have permissions, in addition to the permissions that the native plugins that I wrote. So let's start with a list of all permissions, figure out the plugins that add them (and whether they are really necessary), and classify them into runtime versus compile time. This is the full list of permissions.
|
|
ok so some obvious fixes are:
|
see whether barcodescanner has a more recent updateWe are at The changes don't seem significant; we might as well update to address backwards compatibility. The most recent version also has |
upgrade
|
ok so after upgrading, downloading the |
Looking at the support plugins included with various plugins,
The rest of them are v4 and this is v13. Let's look at the v4 versus v13 documentation. |
Looking at the
|
so that code was changed as part of phonegap/phonegap-plugin-push#1949 This may imply that we need to update all the other plugins too. Argh! |
According to this |
opening the why isn't the project using version 26 or 27 instead? |
Aha! If I look at the SDK manager #325 (comment), it does have the Android Support Repository at 47.0.0 installed, but the Android Support Library is only 23.1.0. The example in the installation instructions does not have an entry for the Android Support Library. Hm, let's try uninstalling the library first... |
If I uninstall the library, the entry disappears, but the error persists. Checking the compat directory, I still see
And I can't see any support library entries so that I can install the latest version. Apparently, this is a known issue - e.g. https://stackoverflow.com/questions/12382555/android-support-library-manual-download |
digging a bit further, the new method is was added in version 26.1.0 According to the libraries tab in android studio, we have three sets of support libraries.
But I don't actually see the version 26.1.0 version in but it is in Because for some of them, the sources are in the local library.
I'm going to try upgrading gradle since I keep getting Android Studio warnings about it. Although I am kind of paranoid about making the change since it is not easily reversible. The warning says
|
I figured it out and it was really annoying. Basically, in
This was what was forcing us to use
Next, I ran into a multi-dex error, caused by a conflict between
There is not much of an explanation for the bump After making both of them be the same version, the build succeeds. So the next step is to figure out whether we should downgrade firebase-messaging or upgrading the location services. I am tempted to upgrade the location services, although I should remember to update the |
finally getting back to this after dealing with other issues all morning. we should start with upgrading location services since:
|
see whether we are really using the file plugin, what for, and whether it needs that permissionThe file plugin is used at
and they are both for emailing logs/data out from the app, to determine the location of the database file on iOS. So changes in android permissions should not affect us. services.js
recent.js
} We are using version So to recap:
So as long as we handle errors in the javascript correctly, we should be good. |
cordova-plugin-email-composerrequired It looks like it uses the standard intent instead. So let's upgrade that. Fails because of
Also, it looks like the app doesn't automatically ask for permissions; instead the user has to ask them https://github.com/katzer/cordova-plugin-email-composer/tree/0.9.2#permissions and add the permission to the manifest. And in 0.8.15, the plugin actually did so automatically. https://github.com/katzer/cordova-plugin-email-composer/tree/0.8.15#permissions So it seems like for our use case, it is actually safer to stick with This is the commit. No reason specified, no link to any issue. I also don't see any issues related to the change by searching. Going to retain the current version. It looks like the plugin also supports the |
ok, so now I'm ready to make changes to our plugins. So far, I have:
Investigate further:
|
Further investigations:
So I think we are fine wrt follow ups even without updating anything. |
Made all changes in #325 (comment) except implementing runtime permissions. Tried to rebuild. Ran into persistent error that I don't remember. Removed android platform, re-added android platform. Now getting failure with
which is the same as https://stackoverflow.com/questions/49171052/error-android-resource-linking-failed-aapt2-27-0-3-daemon-0 The issue seems to be the use of version At any rate, the appcompat dependency is loaded from
which is included in the auth library But why do we even need the |
No, but we use it to decode the JWT and extract the email in our code. Switched to the most recent version of So I grepped around to figure out which library this was in my case.
and it was
We can't really fix the versioning (
so we fix by setting both the v4 and v13 support library versions in jwtauth. Should really move to *** Build succeeded!! *** Now just need to fix dynamic permissions, and we are done! |
any update on this? Before launching the app we need to pull from master and build it again. |
After the weekend, let's get back to testing this. First failure: the broadcast receiver doesn't receive any broadcasts. I tested this with adding breakpoints in the code and we send the broadcast but don't receive it. A brief search finds this breaking change in API 26. We can fix this in one of three ways:
The original thought behind defining implicit broadcasts was that other apps could receive them and perform actions, which would make it easier to build interoperable apps. However, we have since moved away from that approach, and towards plugins that can be directly incorporated into other apps. Note that we are getting pushback for the two step process already; it is likely to be even less likely that people will want to actually install two separate apps. So barring a strong use case for multiple cooperating apps, I am going to go with an explicit broadcast, configured with the package name |
Changing the intent creation to specify the packagename of the app works.
need to figure out where we should put that for the long-term though. Not sure that all classes should import Once this is resolved, the next error is the expected one for permissions.
We could:
But the challenge is that both So I think that the plugin should actually do all the checking, and in the service and actions, we should just generate a tracking error if we don't have permissions, and move to the start state, just like when location services are turned off and on. The good news is that we should be able to re-use a lot of the same logic in the FSM. Before we commit to this, let's ensure that passing in the cordova interface or the plugin doesn't really work. |
Actually I don't see how I can even pass it in. The broadcast receiver is defined in the manifest and launched automatically by the system, not the cordova plugin. So there is no plugin in the interface that we can pass in. Note also that we shouldn't really check the permissions unless the user has consented. |
It seems like the overall correct design is to check for permission errors in the actions, which is where we perform the dangerous operations. That will allow each action to check for its own permission. However, if an action forgets, we should still have a backup in the service. And given that there is only one dangerous permission that we really need, that will make it much simpler than spreading the checks across a bunch of places. Ok, so here's the final plan:
|
New plugin releases for the point release: |
I have updated the master branches on both the e-mission (e-mission/e-mission-phone#544) and emTripLog (e-mission/e-mission-base#17) repositories with the plugin versions upto the patch release. @deepalics0044 @ipsita0012 @PatGendre @MythriNagaraju @jf87 you can pull and re-build your apks now if you like. Note that by default, updating Since the update involves lots of plugins, the stackoverflow workaround is too onerous. The steps I've been following are:
Note that the changes in this issue only affect android, so adding the android platform alone is sufficient. If you haven't pulled recent changes to iOS, you might want to update and rebuild ios (e.g. Given the length of this issue, if you have any problems with building, please file a new issue that links to this one Good luck! |
Thank you! Okay let's get started. :) |
@deepalics0044 thanks to the Indian team for testing this release. Please continue testing, check in with your testers periodically, and report any issues proactively. We will all thank you! |
Hi, we updated the phone app, it is not working as expected, on the simulator and on my android4 phone.
|
@PatGendre first, does this work in the published app (emTripLog)? Comparing against that will help determine whether the issue is with the rebuilt app or with the platform in general. Also, which emulator (api 23, api 26, api 28?) are you using? |
@shankari Ok, I installed already the emtriplog app connected to the Sydney server (with the mode/purpose feature), a few days ago, and it worked. |
@PatGendre so the only change from 1.2.0 (which I assume was the version you installed earlier) to 1.2.1 was to change the notification priority to low to turn off the buzzing, and some text strings, neither of which should affect the permissions. And on android4 (< 5.1.1), you should never have been prompted for the permissions anyway because it doesn't support runtime permissions (https://developer.android.com/guide/topics/permissions/overview#install-time_requests_android_511_and_below) So I'm confused. Can you clarify what you mean by
I think that is probably the real issue. The toggle behavior is just confusing because the FSM is in the start state. |
Ok thanks so for the permissions that's normal that I am only asked for permissions when installing the app and not later. |
so when you are checking the tracking button, can you also check the FSM state (in Developer Zone)? |
yes it is in wainting_for_trip_start By the way I have another question related to location service. When I activate it, I am prompted wether I want to activate enhanced location services. Is the e-mission tracking influenced when I choose to activate these? (which I usually do) |
Let me investigate this. As you can see from the testing done, I focused on testing the toggle of the location services (from the settings) instead of the button in the e-mission UI. This may be a regression, and I think I might even have a rough idea of why it is happening. |
By default, e-mission uses geofencing for the tracking off/on, which requires the enhanced services. If you configure your version of the platform to not duty cycle (currently testable by editing the settings in the developer zone), then it does not require geofencing. But we use the fused API (that combines WiFi with GPS) by default even for ongoing location tracking so I think that we will always require enhanced services. There is currently no setting that allows you to use the non-fused API, and I don't think that there will ever be. IIRC on Android P, you cannot even choose basic v/s enhanced; it is always enhanced. |
Thanks for the explanation on the enhanced location services. |
The emulator uses API 27 |
wrt #325 (comment) To reiterate, it is NOT sufficient to just pull and get an updated I will investigate the location tracking button in the e-mission UI today. |
Experimented with the location tracking button and it appears to be a UI issue. Could it be related to #239 Filed new issue #367 to avoid cluttering this one. |
@shankari : thanks a lot, I tested the #367 issue with the updated emtriplog UI and the Tracking button works perfectly well :-) We will update the UI (and update the plugins!). |
I am going to close this since @PatGendre and @MythriNagaraju have both run the rebuilt android app with no major issues. If we find anything later, we can just open new issues. |
It seems for me Android motion activity data is not anymore collected since that update. Is this just an issue on my side or do you observe the same? Thanks :-) |
You need to upgrade the server as well (e-mission/e-mission-server#642). |
Thanks a lot @shankari ! 👍 |
Supporting apk version 26 requires us to switch to dynamic permissions. This is not a huge issue since we already support dynamic permissions on iOS, but it does require non-trivial implementation and testing time.
It is not a coincidence that the last update of e-mission and emTripLog were updated in Oct 2019.
However, as other groups, notably @jf87 @deepalics0044 @PatGendre want to deploy custom apps to the store, we need to fix this pretty soon.
The text was updated successfully, but these errors were encountered: