Arama Yap Mesaj Submit
Request a Callback
+90
X
X

Select Your Currency

Turkish Lira $ US Dollar Euro
X
X

Select Your Currency

Turkish Lira $ US Dollar Euro

Contact Us

Location Halkali merkez neighborhood fatih st ozgur apt no 46 , Kucukcekmece , Istanbul , 34303 , TR
Android Studio Kotlin

Convert Your Website to Mobile Application

webviewis a powerful component that allows you to display your website or HTML files within the Android application. In this guide, Kotlin You will learn how to develop a professional WebView application from scratch using

Examine every detail step by step, from internet permissions to JavaScript settings, from back button control to local file (Assets) loading. Step into the mobile world with Eka Sunucu.

MainActivity.kt
val myWebView: WebView = findViewById(R.id.webview)
myWebView.settings.javaScriptEnabled = true
myWebView.webViewClient = WebViewClient()

// Web Sitesini Yükle
myWebView.loadUrl("https://www.ekasunucu.com")

URL
Installation

Turn your existing website into an app.

Yerel
HTML

HTML/CSS/JS files working without internet.

JavaScript
support

Activating the JS engine for dynamic content.

Back Key
Control

Navigating page history within the app.

What is WebView?

webview, Android View It is a component derived from the class that allows you to display web pages as part of your application. It's like a browser (like Chrome) without the address bar and navigation buttons.

With this method, you can package your existing responsive website as a "Native" application and publish it on the Google Play Store. It is the fastest application development method for e-commerce sites, blogs and corporate sites.

Step 1: Required Permissions and XML Design

The first settings you need to make after creating your Android Studio project.

AndroidManifest.xml

// Be sure to add internet permission

<manifest ...>
    <uses-permission android:name="android.permission.INTERNET" />

    <application
        ...
        android:usesCleartextTraffic="true">
        ...
    </application>
</manifest>
usesCleartextTraffic: If your site does not use SSL (https), you must set this permission to "true" to open http sites.
activity_main.xml

// A WebView component that maximizes the screen

<WebView
    android:id="@+id/webView"
    android:layout_width="match_parent"
    android:layout_height="match_parent" />

This code places the WebView component to fill the entire screen (match_parent).

Step 2: Setting Up Logic with Kotlin

Let's configure the WebView in the MainActivity.kt file.

MainActivity.kt
import android.webkit.WebView
import android.webkit.WebViewClient

class MainActivity : AppCompatActivity() {

    private lateinit var webView: WebView

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)

        // 1. XML'den WebView'ı bul
        webView = findViewById(R.id.webView)

        // 2. JavaScript'i Aktif Et (Most site for gereklidir)
        webView.settings.javaScriptEnabled = true

        // 3. Linklerin uygulama in açılmasını sağla
        // Bu line olmazsa linkler Chrome browsersında açılır!
        webView.webViewClient = WebViewClient()

        // 4. URL'yi Yükle
        webView.loadUrl("https://www.ekasunucu.com")
    }

    // 5. Geri Tuşu Checkü
    // User geri tuşuna bastığında uygulamadan çıkmak yerine
    // bir önceki sayfaya gitmesini provides.
    @Deprecated("Deprecated in Java")
    override fun onBackPressed() {
        if (webView.canGoBack()) {
            webView.goBack()
        } else {
            super.onBackPressed()
        }
    }
}

Local HTML File Upload

If you want your application to run without an internet connection, you can embed your HTML/CSS/JS files into the project.

  1. In your project src/main/assets/ create the folder.
  2. your HTML file (eg: index.html) into this folder.
  3. In the Kotlin code, change the URL part to this:
webView.loadUrl("file:///android_asset/index.html")

Our Mobile Application Services

You imagine it, Eka Sunucu expert team will code it.

WebView Application

2.500

We turn your existing website into a professional Android application.

  • Splash Screen
  • Internet Connection Check
  • OneSignal Notification Integration
  • Google Play Store Installation
  • APK and AAB Delivery
Order

Frequently Asked Questions

Technical details about WebView applications

Why do links open in Chrome?

if myWebView.webViewClient = WebViewClient() If you do not add the line, Android operating system will try to open the links in the default browser. This line allows links to be opened within your application (in the WebView component).

What is the "Cleartext Traffic not permitted" error?

Android 9 (Pie) and above by default HTTP blocks sites, just HTTPSIt allows . If your site is HTTP, AndroidManifest.xml to file android:usesCleartextTraffic="true" You must add the line .

File upload is not working, why?

WebView does not support File Chooser by default. For file upload feature WebChromeClient class and onShowFileChooser You need to override (customize) its method and obtain the necessary permissions (READ_EXTERNAL_STORAGE).

Can I send a push notification?

Yes, you can send notifications to your users by integrating OneSignal or Firebase Cloud Messaging (FCM) into your WebView app. This feature is available in Eka Sunucu's WebView package.

Leave Your Projectctct to the Professionals!

Don't want to deal with coding? We turn your site into a professional Android application within 24 hours and upload it to Google Play.

Top