Project developed for MB Talk - App Center integration on React Native

Overview

App Center Setup

Download APK

Click here

Requirements

How to use this repo

  • Clone this repo: [email protected]:andrefangeloni/mb-talk-app-center.git;
  • Navigate to the downloaded folder and then run yarn on terminal to install dependencies;
  • Install Pods: cd ios && pod install && cd .. (iOS only);
  • Rename env-template.json to env.json and paste your API_KEY generated on TMDB;
  • Follow the instructions below, generate your own api's keys and paste on the respective files.

Installation

  • Open terminal and run npm install -g appcenter-cli
  • Run appcenter login. This opens a browser and generates a new API token.
  • Copy the API token from the browser, and paste this into terminal.

Adding dependencies on your project

yarn add appcenter appcenter-analytics appcenter-crashes react-native-code-push

Getting Started

Reference: Visual Studio App Center

Android:

1 - Create a new file with the name appcenter-config.json in android/app/src/main/assets/ with the following content and replace {APP_SECRET_VALUE} with your app secret value.

{
  "app_secret": "{APP_SECRET_VALUE}"
}

Note: If the folder named assets doesn't exist, it should be created under project_root/android/app/src/main/assets

2 - In your android/settings.gradle file, make the following additions:

project(':react-native-code-push').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-code-push/android/app')
include ':app', ':react-native-code-push'

3 - In your android/app/build.gradle file, add the codepush.gradle

...
apply from: "../../node_modules/react-native/react.gradle"
apply from: "../../node_modules/react-native-code-push/android/codepush.gradle"
...

4 - Update the MainApplication.java file to use CodePush via the following changes:

...
// 4.1 - Import the plugin class.
import com.microsoft.codepush.react.CodePush;

public class MainApplication extends Application implements ReactApplication {
    private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
        ...
        // 4.2 - Override the getJSBundleFile method to let
        // the CodePush runtime determine where to get the JS
        // bundle location from on each app start
        ...
        @Override
        protected String getJSBundleFile() {
            return CodePush.getJSBundleFile();
        }
    };
}

5 - Open terminal and run appcenter codepush deployment list -a <ownerName>/<appName> -k
5.1 - Copy the Production Deployment Key

6 - Modify the app's res/values/strings.xml to include the following lines:

<resources>
  <string name="app_name">{app_name}</string>
  <string moduleConfig="true" name="CodePushDeploymentKey">{DeploymentKey}</string>
  <string
    moduleConfig="true"
    translatable="false"
    name="appCenterCrashes_whenToSendCrashes"
  >
    DO_NOT_ASK_JAVASCRIPT
  </string>
  <string
    moduleConfig="true"
    translatable="false"
    name="appCenterAnalytics_whenToEnableAnalytics"
  >
    ALWAYS_SEND
  </string>
</resources>

iOS:

1 - Open terminal and run cd ios && pod install && cd ..
2 - Create a new file with the name AppCenter-Config.plist in ios/<app_name>/ with the following content and replace {APP_SECRET_VALUE} with your app secret value.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "https://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
  <dict>
  <key>AppSecret</key>
  <string>{APP_SECRET_VALUE}</string>
  </dict>
</plist>

3 - Add the following content on AppDelegate.m

#import <AppCenterReactNative.h>
#import <AppCenterReactNativeAnalytics.h>
#import <AppCenterReactNativeCrashes.h>
#import <CodePush/CodePush.h>

3.1 - Add these lines to the didFinishLaunchingWithOptions method

[AppCenterReactNative register];
[AppCenterReactNativeAnalytics registerWithInitiallyEnabled:true];
[AppCenterReactNativeCrashes registerWithAutomaticProcessing];

3.2 - Replace else condition:

from:

- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
{
  #if DEBUG
    return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
  #else
    return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
  #endif
}

to:

- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
{
  #if DEBUG
    return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
  #else
    return [CodePush bundleURL];
  #endif
}

4 - Open terminal and run appcenter codepush deployment list -a <ownerName>/<appName> -k
4.1 - Copy the Production Deployment Key

5 - Open Info.plist file, add new entry named CodePushDeploymentKey and paste the value.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
...
<key>CodePushDeploymentKey</key>
<string>{DeploymentKey}</string>
</dict>

CodePush Usage

  • Run on terminal: appcenter codepush release-react -a <owner>/<project_name> -m -d Production

πŸŽ“ LICENSE

This project is licensed under the MIT License - see the LICENSE file for details.

Author

You might also like...

πŸ‘Ύ A React Native app to visualize your NFTs in AR

πŸ‘Ύ A React Native app to visualize your NFTs in AR

AR NFT πŸ‘Ύ Description AR NFT is a mobile app developed using React Native, Wallet Connect, and Viro React to allow users to login in your favorite wal

Nov 11, 2022

React Native app demonstrating using xmtp-js to send a message

XMTP React Native Example This is a work in progress to demonstrate importing xmtp-js into a React Native app. The example currently generates a rando

Dec 20, 2022

Welcome to the EHS robotics club's GitHub repository, this will also be used as our primary community center and means of communication. Also be sure to join our remind for on the go updates @EHSFTC21

NOTICE This repository contains the public FTC SDK for the Ultimate Goal (2020-2021) competition season. Formerly this software project was hosted her

Feb 25, 2022

Similar to the minimap application, this program gets information from the center of the screen and displays information about that creature from a database.

New-World-CreatureInfo Similar to the minimap application, this program gets information from the center of the screen and displays information about

Sep 21, 2022

An implementation of a sample E-Commerce app in k8s. This online retail marketplace app uses Spring Boot, React, and YugabyteDB.

An implementation of a sample E-Commerce app in k8s. This online retail marketplace app uses Spring Boot, React, and YugabyteDB.

An implementation of a sample E-Commerce app in k8s. This online retail marketplace app uses Spring Boot, React, and YugabyteDB.

Oct 27, 2022

A React Native project starter with Typescript, a theme provider with hook to easy styling component, a folder architecture ready and some configs to keep a codebase clean.

React Native Boilerplate Folder structure : src β”œβ”€β”€ assets β”‚Β Β  β”œβ”€β”€ audios β”‚Β Β  β”œβ”€β”€ fonts β”‚Β Β  β”œβ”€β”€ icons β”‚Β Β  └── images β”œβ”€β”€ components β”‚Β Β  β”œβ”€β”€ Layout.tsx

Sep 1, 2022

This project is a simple messaging application made using React-Native framework, Gifted-Chat library and Firebase database

This project is a simple messaging application made using React-Native framework, Gifted-Chat library and Firebase database. The example that will be shown here focuses on the ability of two people to message each other in a chat room.

Jan 30, 2022

starter project for react native cli setups, typescript included

starter project for react native cli setups, typescript included

A starter project with react native 0.68, @storybook/react-native 6.0 beta, storybook/addon-react-native-web getting started To get all the dependenci

Dec 21, 2022

This bare project template includes a minimal setup for using unimodules with React Native tvOS.

What This is a clone of expo's bare minimal template which includes a minimal setup for using unimodules with React Native. Additionally, this templat

Dec 25, 2022
Owner
AndrΓ© Angeloni
React Native Developer
AndrΓ© Angeloni
Sceneform React Native AR Component using ARCore and Google Filament as 3D engine. This the Sceneform Maintained Component for React Native

Discord Server Join us on Discord if you need a hand or just want to talk about Sceneform and AR. Features Remote and local assets Augmented Faces Clo

SceneView Open Community 42 Dec 17, 2022
source code of the live coding demo for "Building resilient and scalable API backends with Apache Pulsar and Spring Reactive" talk held at ApacheCon@Home 2021

reactive-iot-backend The is the source code of the live coding demo for "Building resilient and scalable API backends with Apache Pulsar and Spring Re

Lari Hotari 4 Jan 13, 2022
Codebase for talk on Spring I/O 2022 in Barcelona about Spring for Apache Kafka

Spring I/O Barcelona 2022 - Spring Kafka beyond the basics Codebase for my talk on Spring I/O 2022 in Barcelona about Spring for Apache Kafka Slides P

Tim van Baarsen 18 Dec 24, 2022
Docker-compose-integration-tstst - An exploration of how to run integration tests against an application that has inconvenient external dependencies (e.g. a SQL database).

Tstst? it was supposed to be docker-compose-integration-tests but i was too lazy to fix it at the outset, and now im trying to convince myself its fun

null 1 Jan 4, 2022
Framework for automated integration tests with focus on messaging integration

Citrus Integration Testing Welcome to Citrus Citrus is a test framework written in Java that is able to create fully automated end-to-end use case tes

Citrus Framework 373 Dec 27, 2022
React native wrapper for Jitsi Meet SDK Library that rely on the native view (Activity / ViewController)

react-native-jitsi-meet-sdk React native wrapper for Jitsi Meet SDK Library. This Library implements the Jitsi SDK with a native activity on the Andro

null 7 May 2, 2022
An awesome native wheel picker component for React Native.

⛏️ react-native-picky An awesome native wheel picker component for react-native. Features Supports multiple columns βœ… Supports looping βœ… Native Androi

null 28 Dec 4, 2022
Flights metasearch engine simulation using Java, GraphQL and React.js, developed for COMP30220 Distributed Systems.

Distributed Airways For the full project report, see ./report.pdf. A demonstration video is available here. Requirements Docker JDK 8 and Apache Maven

Rajit Banerjee 3 Dec 29, 2022
Prevent Screenshots in your React Native app when needed. πŸ¦„

React Native Prevent Screenshots Prevent Screenshots in your React Native app when needed. ?? Installation First, you need to install the package usin

Ahmed Mahmoud 64 Oct 19, 2022