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.
Related
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.
I have recently started to convert my react native app and running on Expo so i could test this on my actual android device. I am getting this error above. I have since then running my app using the Expo XDE. I am also running on a windows machine.
The full error message is:
]1
I figured that this has something to do with my index.js, yet here it is
import { AppRegistry } from 'react-native';
import App from './App';
AppRegistry.registerComponent('projectTARA', () => 'App');
The following solution worked:
AppRegistry.registerComponent('main',() => App);
Credits: Rishav Kumar
(Cannot you people just reply to mark as solve ?)
The problem is you haven't opened your project in Android Studio. The previous project is running in android studio and you are running the latest one in emulator.
I created a Project from "Doco", and save it with Practice. so write that line like that
AppRegistry.registerComponent('Practice', () => FixedDimensionsBasics);
then I get an error like in a question
So, I check on my Appdelegate.m file on ios folder and find that Project name is Project
so I change that line with
AppRegistry.registerComponent('Project', () => FixedDimensionsBasics);
and my Error solved
so if you are using "Doco" then check that thing.
I came across this issue because I had previously run a React project that was not fully shut down. To fix this, I could have restarted my computer. But I chose to do this instead: (Using MacOS, should work with Linux as well, for Windows you would likely need to use Task Manager or similar):
Open terminal
Find the program that is using port 8081 by typing "lsof -i :8081". (Note this is LSOF in lowercase)
Look at the process ID (under the PID column)
Kill the process by typing "kill -9 PID" (where PID is the process ID number you found in step 3).
After killing the process you should be able to run your react-native project.
Removed node_modules and reinstalled by yarn that worked for me.
Error ? if you are running your app on the expo framework, the framework cannot find registration of the main App,or its entry point.
Solution ? go to you entry script, could be "src/main.js" or in my case the "App.js"
then;
import { registerRootComponent } from 'expo';
export default function App(){
//your code app code goes here
}
registerRootComponent(App);
Refer here: https://docs.expo.dev/versions/latest/sdk/register-root-component/
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"
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,
});
});
}
});
}
}
I would like to run a function based of the version of my node-webkit app from the package.json file. How do I get this version number?
I'm not talking about:
process.versions['node-webkit'];
Which just shows the node-webkit version.
You can get the manifest as an object in nw, using App. Just extract the version there:
var gui = require('nw.gui');
var myAppVersion = gui.App.manifest.version;
See also https://github.com/rogerwang/node-webkit/wiki/App#manifest