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

getBinaryResourcesModifiedTime always returns the same time on Android #650

Closed
jacob-meacham opened this issue Dec 22, 2016 · 5 comments
Closed

Comments

@jacob-meacham
Copy link

  • react-native-code-push version: 1.16.0-beta
  • react-native version: 0.36.0
  • iOS/Android/Windows version: Android 6.0.1, API 23, gradle 2.14.1

The timestamp returned in getBinaryResourcesModifiedTime() always returns 312796800000 (11/30/1979, 12:00:00 AM). This is expected as per https://code.google.com/p/android/issues/detail?id=220039. The workaround to set android.keepTimestampsInApk = true is an ok one, but in a default project, the binary version is never loaded once a codepush bundle has been installed.

I'm happy to cook up a PR to fix this issue, but I am not primarily an android dev and wanted to get some feedback on an appropriate fix. My initial proposal is to set a buildConfigField in codepush.gradle, and then check that at runtime.

Thanks!

@vladimir-kotikov
Copy link

Looks like this is exactly the same problem as with cordova plugin here: microsoft/cordova-plugin-code-push#196

@matrosov-nikita
Copy link
Contributor

Hi @jacob-meacham

Yeah, I see the timestamp within update and built apk time are equal, but there is additional check for binary versions equality. Even though the timestamps are the same, after build step plugin cleans out current local package (if you bump version) and anyway downloads new updates. Could you provide specific case which demonstrates your problem?

@jacob-meacham
Copy link
Author

@matrosov-nikita yeah, on debug builds right now we're not bumping version appropriately. We should definitely fix that on our side, but it's why I noticed this issue. If the code is just dead, maybe the better solution is just to remove it?

@matrosov-nikita
Copy link
Contributor

@jacob-meacham, I've sent the PR. It uses buildConfigField to get correct apk built time as you've already suggested. Could you pls check whether it works for you?

@jacob-meacham
Copy link
Author

This is similar to the hacked fix I had been using and works for me. Thanks!

sergey-akhalkov added a commit that referenced this issue Feb 9, 2017
…method (#683)

Due to “the last modified date on all files in an apk now have the time stamp of 'Fri, Nov 30 1979 00:00:00'”
(https://code.google.com/p/android/issues/detail?id=220039) we have to store apk build time value in
`app/src/main/res/values/strings.xml` file and use it further in `getBinaryResourcesModifiedTime` method

Fix #650
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants