CodePush not updating new version - react-native

I have version 5.0.1 of my application with two versions released on CodePush.
I do not bump up any Version or Build numbers. So 5.0.1 and Build 1.
The first version v1 gets installed, but after I make a new release (v2), the bundle doesn't get downloaded or installed anymore.
v1:
v2:
I use the following to add CodePush to my app:
const CodePushHomeScreen = codePush(HomeScreen);
Thanks

Default behavior restricts updates to only occur once an app is restarted. I would first confirm that updates aren't being registered after a restart of the app and/or switch things over to update on resume instead using this snippet:
let codePushOptions = { checkFrequency:
codePush.CheckFrequency.ON_APP_RESUME };
class MyApp extends Component {
}
M HomeScreen App = codePush(codePushOptions)(HomeScreen);
If that doesn't work, delete the two updates and release two more using the flag:
--targetBinaryVersion "~5"

Related

Is there way to check react native app version?

Let's say I have uploaded my app version 1.0.0 to app store and play store.
After that I have released new version which is 1.0.1. So, I wonder how can we notify user that app need to update.
I have searched and read lots of article but all of them are using packages which some are outdated and most are not working. Can someone help me please?
https://www.npmjs.com/package/sp-react-native-in-app-updates is the package that I used.
You can install this lib called react-native-device-info, and use it as follow:
import VersionNumber from 'react-native-version-number';
[...]
render() {
var versionNumber = `${VersionNumber.appVersion}.${VersionNumber.buildVersion}`;
return (
<Text style={ styles.versionText }>App Version: {versionNumber}</Text>
)
}
[...]
Hope it helps!
you can check latest version on store and your current version of app by this react-native-version-check and also must check this I think this help you most app-upgrade-react-native-sdk.

React native Fabric autolink error with react 60.0 and above

I have upgraded to my app to react-native 60.4 which support Autolinking all packages so that you dont have to manually go about setting things up and thus lowers the chances of error.
The problem is most of the packages have still not gotten compatible with this process and henceforth the app completely breaks.
my error is with https://github.com/corymsmith/react-native-fabric
referring to an issue on the repo for the same -> https://github.com/corymsmith/react-native-fabric/issues/225, which still remains unanswered.
I started giving it a try by forking the repo and understanding the auto link process given by react native.
In the package.json of the node_module package i replaced
"rnpm": {
"android": {
"packageInstance": "new FabricPackage()"
}
},
with file in the package root react-native.config.js
module.exports = {
dependencies: {
'react-native-fabric': {
platforms: {
android: {
"packageImportPath": "import com.smixx.fabric.FabricPackage;",
"packageInstance": "new FabricPackage()"
}
}
}
}
};
I also updated the build gradle to 3.4.1 from 3.1.0
My react native app is able to now find the package.
But when i call the package in my react component i get NoClassDefFoundError, which means that class is not found.
Anybody else gave this a try and have a solution please let me know.
Try to unlink with react-native unlink and then re run your code again.
Putting it here from the above comment to make it more clear:
Ok i got this to work by changing the forked repo -> (adding a react-native.config.js in the root of the package with with auto discovery and link configurations), but i think the only scalable solution i see right now is to degrade to RN ^59.0 as not a lot of packages have auto link config changes. So will wait for RN 60.4 to mature and then upgrade to it in about a month. In addition to this fabric is currently migrating to firebase and plans to complete by year end. This mean that anyways the sdk integration is going to be obsolete and hence this package too.
Also this issue is majorly related to react-native-fabric and not RN itself.

Get the latest code-push deployed bundled on a fresh app install

Is it possible to ensure that after a fresh install of my code-pushified react-native app the user gets the latest deployed bundle from code-push?
My intention is to ensure that the user will always get the latest version of my app even after opening it for the first time.
EDIT 1
I am already aware of code-push configurations such as InstallMode and checkFrequency. I am currently using the less intrusive installMode = ON_NEXT_RESTART.
The scenario I want to avoid is the following: I first publish my app on the Play Store (let's do an Android example) with version 1.0.0. After, let's say, 6 months and a lot of new features and bug fixes my app is on version 1.0.27. If I only published the updates (the new versions) on code-push then the original apk available in Play Store still contains the bundle version 1.0.0. This means that any new user opening the app for the first time, right after installation, will get the 6-months-old 1.0.0 version without any of new the features and fixes that the latest version includes. Only after restarting the app (let's say it happens on the next day) the user will get the 1.0.27 version from code-push (remember that I am using installMode = ON_NEXT_RESTART).
The obvious solutions for this are:
Publish a new apk on the Play Store for every new version of my app (besides, of course, publishing it on code-push).
Use a more intrusive installMode.
Mark every single code-push release as a mandatory install.
I am ok with the 1st option (and the 1st option only). I wanted to check if there is another option I am not aware of. To be honest I don't know if what I want is actually possible to do with code-push.
As per discussion in comments, what you wish to achieve can be achieved using manual updates of code push. To do so, you can set a variable in AsyncStorage to denote that you have opened app at least once, and if that doesn't exist control & immediately update the app. An example can be seen below;
class MyApp extends Component {
componentDidMount() {
AsyncStorage.getItem('#AppHasOpened').then((appHasOpened) => {
if (!(appHasOpened && appHasOpened === 'yes')) {
AsyncStorage.setItem('#AppHasOpened', 'yes').then(() => {
codePush.sync({
installMode: codePush.InstallMode.IMMEDIATE,
});
});
}
});
}
}

After bundling my aurelia app I get a: No PLATFORM.Loader error

After bundling a simple aurelia application with jspm bundle-sfx I get the following error:
No PLATFORM.Loader is defined and there is neither a System API (ES6) or a Require API (AMD) globally available to load your app.
An example application: https://github.com/Baudin999/jspm-bundling-test
You can use: npm run setup:dev in a non windows env to switch back to the dev settings (which is just a comment/uncomment in the ./src/client/index.html) and you can use npm run setup:prod to switch back to the production environment, bundling will automatically be triggered. all other scripts can be found in the package.json.
I can't link to other questions because I haven't found any questions which relate to this problem. I "think" (which means absolutely nothing) that this might be related to the fact that aurelia needs a full loader even when bundling with bundle-sfx but I haven't found any ways to solve the error.
EDIT (25/01/2017 17:16): I've found out that the error is because I import the aurelia-bootstrapper.
As soon as I add: import * as bootstrapper from 'aurelia-bootstrapper'; I get the error
Please add the code how do you bootstrap your aurelia app.
There is nothing actually to import from bootstrapper apart from bootstrap function.
Which you would use in case of custom manual bootstrapping.
like in
import { bootstrap } from 'aurelia-bootstrapper'
const configure: (au: Aurelia) => {} = async function (au: Aurelia) {
au.use
.standardConfiguration();
await au.start()
au.setRoot() // or au.enchance()
})
bootstrap(configure)
in a happy path scenario with jspm - you System.import('aurelia-bootstrapper')
and it takes over finding the root node of your app and the script to configure Aurelia (main by default)
Have a look at Bootstrapping Aurelia in the docs
Oh.. and bundle-sfx is not supported there are other means to bundle aurelia apps using jspm

Titianim app Ti.Android.currentActivity is undefine

I am new to Titanim Development. Now I am working with a existing app. The app seems to developed with the 3.0.2 version but I configured my system(OSX maverick) with latest version(3.2.3).
source:
Ti.Android.currentActivity.startActivity(Ti.Android.createIntent({
url: '/app/ui/WindowEula'
}));
When I build and run the application the application through error in the above line
Ti.Android.currentActivity is undefine.
How to fix this error.
try this :
var activity = Titanium.Android.currentActivity;
activity.finish();
use currentActivity instead of CurrentActivity.