[php] 안드로이드 웹뷰 정리 2026-02-23 > 팁앤테크

본문 바로가기
사이트 내 전체검색

팁앤테크

[php] 안드로이드 웹뷰 정리 2026-02-23

페이지 정보

본문

9bd8344ae4448c715b78624d2c4d2ffe_1771850258_1827.png



9bd8344ae4448c715b78624d2c4d2ffe_1771850300_1786.png
 

9bd8344ae4448c715b78624d2c4d2ffe_1771854235_0291.png



manifests/AndroidManifest.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">

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

<application
android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.AppCompat.Light.NoActionBar"
android:usesCleartextTraffic="true">
<activity
android:name=".MainActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>

</manifest>


kotlin+java/zeronara.net/MainActivity.java

package zeronara.net;

import android.content.ActivityNotFoundException;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.Window;
import android.webkit.SslErrorHandler;
import android.webkit.WebChromeClient;
import android.webkit.WebResourceError;
import android.webkit.WebResourceRequest;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.net.http.SslError;

import androidx.appcompat.app.AppCompatActivity;

public class MainActivity extends AppCompatActivity {
public WebView webView;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.activity_main);

webView = (WebView) findViewById(R.id.webView);
WebSettings webSettings = webView.getSettings();

webSettings.setJavaScriptEnabled(true);
webSettings.setDomStorageEnabled(true);
webSettings.setUseWideViewPort(true);
webSettings.setLoadWithOverviewMode(true);
webSettings.setCacheMode(WebSettings.LOAD_DEFAULT);

// User-Agent
String defaultUA = webSettings.getUserAgentString();
webSettings.setUserAgentString(defaultUA + " zeronaraApp/1.0 (Android)");

webView.setWebViewClient(new WebViewClient() {

@Override
public boolean shouldOverrideUrlLoading(WebView view, WebResourceRequest request) {
String url = request.getUrl().toString();

// 구글 플레이스토어 링크 처리
if (url.startsWith("market://") || url.contains("play.google.com/store")) {
try {
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
startActivity(intent);
} catch (ActivityNotFoundException e) {
// 플레이스토어 앱이 없으면 브라우저로 폴백
String fallbackUrl = url.replace("market://", "https://play.google.com/store/apps/");
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(fallbackUrl)));
}
return true;
}

// 외부 브라우저로 열어야 할 스킴 처리 (tel, mailto )
if (url.startsWith("tel:") || url.startsWith("mailto:") || url.startsWith("intent:")) {
try {
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url)));
} catch (ActivityNotFoundException e) {
e.printStackTrace();
}
return true;
}

return false; // 그 외 URL은 웹뷰에서 처리
}

@Override
public void onPageFinished(WebView view, String url) {
super.onPageFinished(view, url);
}

@Override
public void onReceivedError(WebView view, WebResourceRequest request, WebResourceError error) {
super.onReceivedError(view, request, error);
}

@Override
public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) {
handler.proceed();
}
});

webView.setWebChromeClient(new WebChromeClient() {
@Override
public void onReceivedTitle(WebView view, String title) {
super.onReceivedTitle(view, title);
}
});

webView.loadUrl("https://zeronara.net");
}

@Override
public void onBackPressed() {
if (webView.canGoBack()) {
webView.goBack();
} else {
getOnBackPressedDispatcher().onBackPressed();
}
}

@Override
protected void onPause() {
super.onPause();
webView.onPause();
}

@Override
protected void onResume() {
super.onResume();
webView.onResume();
}

@Override
protected void onDestroy() {
super.onDestroy();
webView.destroy();
}
}

res/layout/activity_main.xml

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/main"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">

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

</androidx.constraintlayout.widget.ConstraintLayout>

res/values/strings.xml

<resources>
<string name="app_name">ZERONARA</string>
</resources>


아이콘 생성

***.png준비 640*640

9bd8344ae4448c715b78624d2c4d2ffe_1771854283_2008.png
 








댓글목록

등록된 댓글이 없습니다.

Total 827건 1 페이지
  • RSS
팁앤테크 목록
번호 제목 글쓴이 조회 날짜
열람중 제로쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 291 02-23
826 제로쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 26921 11-02
825 제로쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 30102 07-10
824 제로쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 37379 04-06
823 제로쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 28003 02-21
822 제로쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 31200 12-31
821 제로쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 27100 12-24
820 제로쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 26609 12-04
819 제로쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 29188 10-17
818 제로쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 27923 10-02
817 제로쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 45043 08-04
816 제로쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 27032 08-04
815 제로쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 35358 08-03
814 제로쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 35652 07-08
813 제로쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 58268 07-08
812 제로쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 69718 07-06
811 제로쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 28038 06-09
810 제로쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 32713 06-03
809 제로쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 31316 04-16
808 제로쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 31791 03-29
807 제로쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 27012 03-26
806 제로쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 33378 03-12
805 제로쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 28984 03-10
804 제로쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 46191 03-03
803 제로쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 35725 02-28

검색

회원로그인

회원가입

사이트 정보

株式会社YHPLUS / 대표 : ZERO
〒140-0011 東京都品川区東大井2-5-9-203
050-5539-7787
오픈카카오톡 (YHPLUS) :
https://open.kakao.com/o/slfDj15d

접속자집계

오늘
22,938
어제
20,625
최대
240,985
전체
2,756,487
Copyright (c) 株式会社YHPLUS. All rights reserved.