<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: gustavogss</title>
    <description>The latest articles on DEV Community by gustavogss (@gustavogss).</description>
    <link>https://dev.to/gustavogss</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F601127%2F7e8e3f6a-37a4-4f45-b1c1-f0c72bc129c5.png</url>
      <title>DEV Community: gustavogss</title>
      <link>https://dev.to/gustavogss</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/gustavogss"/>
    <language>en</language>
    <item>
      <title>How to have an android app from any page</title>
      <dc:creator>gustavogss</dc:creator>
      <pubDate>Thu, 17 Nov 2022 00:24:55 +0000</pubDate>
      <link>https://dev.to/gustavogss/how-to-have-an-android-app-from-any-page-26gh</link>
      <guid>https://dev.to/gustavogss/how-to-have-an-android-app-from-any-page-26gh</guid>
      <description>&lt;p&gt;Here we will be using ReactNative technology with Expo&lt;br&gt;
But first, your page needs to be very responsive, as this implementation only renders the website in an application. Even if you try to fix the styling, it won't provide a good experience.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnd6i8l9z0otbhryaowb0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnd6i8l9z0otbhryaowb0.png" alt="Image description" width="600" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;1 – First of all, it is necessary to prepare the development environment according to your operating system, access the website and follow the instructions:&lt;br&gt;
&lt;a href="https://reactnative.dev/docs/environment-setup" rel="noopener noreferrer"&gt;Configuration&lt;/a&gt;&lt;br&gt;
2 – Once Expo is installed on your machine, it's time to create your application:&lt;br&gt;
&lt;code&gt;expo init yourappname&lt;/code&gt;&lt;br&gt;
3 – Go to the application folder you just created and install this dependency:&lt;br&gt;
&lt;code&gt;npm install react-native-webview&lt;/code&gt;&lt;br&gt;
4 – Go to the application folder, and open your project in the editor of your choice, I used VSCode.&lt;br&gt;
Check if you have the assets folder, if not, create and place the favicon.png, icon.png and splash.png in the following sizes:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;favicon.png - in size 40 x 44 px
icon.png - in size 150 x 150 px
splash.png - 1284 x 2778 px
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;5 – Configure the app.json file, like something similar:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;"expo": {
"name": "yourappname",
"slug": "yourappname",
"version": "1.0.0",
"orientation": "portrait",
"icon": "./assets/icon.png",
"splash": {
"image": "./assets/splash.png",
"resizeMode": "contain",
"backgroundColor": "#ffffff" //change background color
"updates": {
"fallbackToCacheTimeout": 0
"assetBundlePatterns": [
"ios": {
"supportsTablet": true,
"bundleIdentifier": "br.com.nameofyourapp",//put your bundle domain
"buildNumber": "1.0.0"
"android": {
"adaptiveIcon": {
"foregroundImage": "./assets/adaptive-icon.png",
"backgroundColor": "#373535" //change background color
"package": "com.betrybe.app"
"android": {
"package": "br.com.nameofyourapp", //put your package's domain
"versionCode": 1
}console.log( 'Code is Poetry' );
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;6 – After everything is configured, go to the main file of the App.js application, delete everything that is there. And import these dependencies:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { StatusBar } from 'expo-status-bar';
import React from 'react';
import { StyleSheet, View } from 'react-native';
import { WebView } from 'react-native-webview';
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;7 – Then, in the same App.js file, create a constant with the name URL and put the address of your page:&lt;br&gt;
&lt;code&gt;const URL = 'https://suapagina.com.br'; //Place your page here&lt;/code&gt;&lt;br&gt;
8 – Also implement a function named App, export it, and return a View:&lt;br&gt;
&lt;code&gt;export default function App() {&lt;br&gt;
return(&amp;lt;View /&amp;gt;)}&lt;/code&gt;&lt;br&gt;
9 – Structure the View as follows:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;View style={styles.container}&amp;gt;
&amp;lt;View style={styles.page}&amp;gt;
&amp;lt;WebView source={{ uri: URL }} onLoad={console.log('Loaded!')} /&amp;gt;
&amp;lt;/View&amp;gt;
&amp;lt;StatusBar style="auto" /&amp;gt;
&amp;lt;/View&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;10 – Now let’s style our application. Within the same App.js file. Create this style:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#fff',
alignItems: 'center',
justifyContent: 'center',
marginTop: 30,

page: {
width: '100%',
height: '100%',
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;11 – After everything is done, your App.js file should look like this one:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { StatusBar } from 'expo-status-bar';
import React from 'react';
import { StyleSheet, View } from 'react-native';
import { WebView } from 'react-native-webview';
const URL = 'https://suapagina.com.br'; //Place your page here
export default function App() {
return(
&amp;lt;View style={styles.container}&amp;gt;
&amp;lt;View style={styles.page}&amp;gt;
&amp;lt;WebView source={{ uri: URL }} onLoad={console.log('Loaded!')} /&amp;gt;
&amp;lt;/View&amp;gt;
&amp;lt;StatusBar style="auto" /&amp;gt;
&amp;lt;/View&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#fff',
alignItems: 'center',
justifyContent: 'center',
marginTop: 30,

page: {
width: '100%',
height: '100%',
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;12 – To run the application directly on your cell phone:&lt;br&gt;
Connect via usb your device to your computer, and activate developer mode on your cell phone.&lt;br&gt;
It is also necessary to install the Expo application on your cell phone through the playstore, to run your application: &lt;a href="https://play.google.com/store/apps/details?id=host.exp.exponent" rel="noopener noreferrer"&gt;https://play.google.com/store/apps/details?id=host.exp.exponent&lt;/a&gt;&lt;br&gt;
To check whether your computer is connected with your mobile phone. Go to the terminal and type the command:&lt;br&gt;
adb devices&lt;br&gt;
It should appear, something similar to:&lt;br&gt;
List of attached devices&lt;br&gt;
&lt;code&gt;0055517386 deviceadb devices&lt;/code&gt;&lt;br&gt;
13 – To run the application, just enter the project folder and type the command in a terminal:&lt;br&gt;
&lt;code&gt;expo start&lt;/code&gt;&lt;br&gt;
You will be redirected to another page, choose the Local option and then the emulator you want to run your application, in our case:&lt;br&gt;
Android → Run on Android device/emulator&lt;br&gt;
That's it, wait for your home page to open on your cell phone, then your web page, and your application's logo will also be generated.&lt;br&gt;
I couldn't create my application, is there an easier way?&lt;br&gt;
1 – Even after all these steps, you still cannot create your page application.&lt;br&gt;
I have a pre-made model already configured in my repository, which I can make available here, just by typing the command in a terminal of your choice:&lt;br&gt;
&lt;a href="https://github.com/gustavogss/webviewapp.git" rel="noopener noreferrer"&gt;https://github.com/gustavogss/webviewapp.git&lt;/a&gt;&lt;/p&gt;

</description>
      <category>discuss</category>
    </item>
  </channel>
</rss>
