Skip to content

App Upgrade: React-Native Demo App is a sample expo app integrated with App Upgrade React-Native SDK to demonstrate how Force upgrade works in react-native app with App Upgrade.

License

Notifications You must be signed in to change notification settings

appupgrade-dev/app_upgrade_react_native_demo_app

Repository files navigation

App Upgrade: React-Native Demo App

App Upgrade: React-Native Demo App is a sample react-native app integrated with App Upgrade React-Native SDK to demonstrate how Force upgrade works in react-native app with App Upgrade.

Installation

To get started, clone the repo:

$ git clone https://github.com/appupgrade-dev/app_upgrade_react_native_demo_app

Setup

  1. Once cloned, navigate to the app_upgrade_react_native_demo_app directory.

    $ cd app_upgrade_react_native_demo_app

  2. Then install the dependencies:

    $ npm install

  3. Open the directory in your code editor.

  4. Open the app_upgrade_react_native_demo_app/App.js file, and enter required values for the variables:

    Key Value Description
    xApiKey Your API Key. Required.
    appName Your app name. Required.
    appVersion Your app version. Required.
    platform Your app platform, ex: android or iOS. Required.
    environment Your app enviroment, ex: dev, stating, production. Required.
    appLanguage Your app language, ex: en, es. Optional.
    preferredAndroidMarket Your preferred android market, ex: amazon, huawei or other. Optional.
    otherAndroidMarketUrl Other market place url from where update can be done. Optional. Required only if PreferredAndroidMarket is other

If you want users to redirect to store other than app store or playstore. You can add these additional parameters in appInfo

  • preferredAndroidMarket: PreferredAndroidMarket.AMAZON // or PreferredAndroidMarket.HUAWEI or PreferredAndroidMarket.OTHER If not provided default is Google playstore.

    If you want to redirect user to some other android market place you can add the following fields:

  • preferredAndroidMarket: PreferredAndroidMarket.OTHER

  • otherAndroidMarketUrl: 'https://someotherandroidmarket.com/app/id'// Required if preferredAndroidMarket is other.

    Example:

     const xApiKey = 'YjhlZjdlMWMtODJhMC00YWZiLTk3MTktZmQ0ZmNmZjI0ODQ0';
     const appInfo = {
         appId: 'com.microsoft.bing',
         appName: 'Wallpaper app', // Your app name
         appVersion: '1.0.0', // Your app version
         platform: 'android', // App Platform, android or ios
         environment: 'production', // App Environment, production, development
         appLanguage: 'en', // Your app language, ex: en, es.
     };
  1. Save App.js file.

Run the app:

  1. Start the Metro

    $ npx react-native start

  2. Start the android application

    $ npx react-native run-android

    or for iOS

    $ npx react-native run-ios

Ref: https://reactnative.dev/docs/environment-setup

Usage:

  1. Head to App Upgrade and signup if not already.
  2. Create a new Project.
  3. Grab the API Key. You will need to provide the same in the required fields mentioned in above section.
  4. Create a new version with the required details and force upgrade field as selected. Make sure the details provided in version matches with the details provided in the App.js file.
  5. Refresh the app and you will be able to see a popup for force upgrade.
  6. Edit the version in dashboard with Force upgrade field unselected. Refresh the app and you will see a popup with soft upgrade with a button to upgrade later.

For full details on how to use App Upgrade dashboard read our Documentation

Screenshots

Andorid

forceupgrade_android

iOS

forceupgrade_ios

Need help?

If you're looking for help, try our Documentation or our FAQ. If you need support please write to us at [email protected]

About

App Upgrade: React-Native Demo App is a sample expo app integrated with App Upgrade React-Native SDK to demonstrate how Force upgrade works in react-native app with App Upgrade.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published