🙂 İNSANLARIN EN HAYIRLISI INSANLARA FAYDALI OLANDIR 🙂

Ramazan HABER / Android RMOS / uygulama içine webview yerine chrome gömmek ve yukaridaki link barını gizlemek

1-) Android RMOS - uygulama içine webview yerine chrome gömmek ve yukaridaki link barını gizlemek

 

aşağıdaki uygulama ile assetlink oluşturabilirsin. daha sonra

https://play.google.com/store/apps/details?id=dev.conn.assetlinkstool

 

 

yukarıdaki bilgilerle aşağıdaki linkten oluştur

https://developers.google.com/digital-asset-links/tools/generator

 

 

You may have opted into having Google Play sign your releases with a key they generated, and only use your key for the upload.

If you did, go to Google Play Console Release Management -> App Signing and copy the App signing certificate SHA-256 fingerprint and put it into the assetlinks.json file.

 

 

assetlinks.json

 

[{

  "relation": ["delegate_permission/common.handle_all_urls"],

  "target": {

    "namespace": "android_app",

    "package_name": "com.rmos.ramazan.rmosrtm",

    "sha256_cert_fingerprints": [

      "72:E5:E8:66:DF:58:F5:4E:FA:FE:CF:4E:83:59:14:CF:0A:CE:9B:B9:76:2D:A9:ED:BE:02:70:47:C3:5B:AE:A6"

    ]

  }

}]

 

 

daha sonra bu linki aşağıdaki gibi yerleştir siteye

https://http://www.rmosrtm.com//.well-known/assetlinks.json

 

UYGULAMAN AŞAĞIDAKİ GİBİ OLSUN

implementation "androidx.browser:browser:1.4.0"

 

JAVA KODU

 

CustomTabsIntent.Builder builder = new CustomTabsIntent.Builder();
builder.setShowTitle(false);
builder.enableUrlBarHiding();
CustomTabsIntent customTabsIntent = builder.build();
customTabsIntent.launchUrl(this, Uri.parse("http://rmosrtm.com"));

 

 

 

 

assetlinks.json

 

[{

  "relation": ["delegate_permission/common.handle_all_urls"],

  "target" : { "namespace": "android_app", "package_name": "com.example.twa_test",

    "sha256_cert_fingerprints": ["2A:32:7D:B7:4D:0B:A5:6A:72:47:86:A3:2F:A6:BB:D8:26:DE:AB:7E:8B:EA:C7:16:80:EA:C3:F1:50:E7:8E:D1"] }

}]

AndroidManifest.xml

 

<manifest xmlns:android="http://schemas.android.com/apk/res/android"

    package="com.example.twa_test">

 

    <application

        android:allowBackup="true"

        android:icon="@mipmap/ic_launcher"

        android:label="@string/app_name"

        android:roundIcon="@mipmap/ic_launcher_round"

        android:supportsRtl="true"

        android:theme="@style/AppTheme">

        <meta-data

            android:name="asset_statements"

            android:resource="@string/asset_statements" />

        <activity android:name="android.support.customtabs.trusted.LauncherActivity">

 

            <!-- Edit android:value to change the url opened by the TWA -->

            <meta-data

                android:name="android.support.customtabs.trusted.DEFAULT_URL"

                android:value="https://slexom.gitlab.io/namya/" />

 

            <!-- This intent-filter adds the TWA to the Android Launcher -->

            <intent-filter>

                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />

            </intent-filter>

 

            <!--

              This intent-filter allows the TWA to handle Intents to open

              airhorner.com.

            -->

            <intent-filter>

                <action android:name="android.intent.action.VIEW" />

 

                <category android:name="android.intent.category.DEFAULT" />

                <category android:name="android.intent.category.BROWSABLE" />

 

                <!-- Edit android:host to handle links to the target URL-->

                <data

                    android:scheme="https"

                    android:host="slexom.gitlab.io/namya/" />

            </intent-filter>

        </activity>

    </application>

</manifest>

res/values/strings.xml

 

<resources>

    <string name="app_name">Namya</string>

    <string name="asset_statements">

        [{

            \"relation\": [\"delegate_permission/common.handle_all_urls\"],

            \"target\": {

                \"namespace\": \"web\",

                \"site\": \"https://slexom.gitlab.io/namya/\"}

        }]

    </string>

</resources>

 

build.gradle(Project)

 

// Top-level build file where you can add configuration options common to all sub-projects/modules.

 

buildscript {

    repositories {

        google()

        jcenter()

 

    }

    dependencies {

        classpath 'com.android.tools.build:gradle:3.3.1'

 

        // NOTE: Do not place your application dependencies here; they belong

        // in the individual module build.gradle files

    }

}

 

allprojects {

    repositories {

        google()

        jcenter()

        maven { url "https://jitpack.io" }

    }

}

 

task clean(type: Delete) {

    delete rootProject.buildDir

}

build.gradle(Module: app)

 

apply plugin: 'com.android.application'

 

android {

    compileSdkVersion 28

    defaultConfig {

        applicationId "com.example.twa_test"

        minSdkVersion 16

        targetSdkVersion 28

        versionCode 1

        versionName "1.0"

        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

    }

    buildTypes {

        release {

            minifyEnabled false

            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'

        }

    }

    compileOptions {

        sourceCompatibility JavaVersion.VERSION_1_8

        targetCompatibility JavaVersion.VERSION_1_8

    }

}

 

dependencies {

    implementation fileTree(dir: 'libs', include: ['*.jar'])

    implementation 'com.android.support:appcompat-v7:28.0.0'

    testImplementation 'junit:junit:4.12'

    androidTestImplementation 'com.android.support.test:runner:1.0.2'

    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'

    implementation 'com.github.GoogleChrome.custom-tabs-client:customtabs:3a71a75c9f'

}

 

 

 

kaynak  : https://stackoverflow.com/questions/54597728/trusted-web-activity-address-bar-not-hide-chrome-for-android-72

 

 2022 Şubat 17 Perşembe
 384