package in.example.app;
import android.content.pm.ActivityInfo;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
public class LauncherActivity
extends com.google.androidbrowserhelper.trusted.LauncherActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Setting an orientation crashes the app due to the transparent background on Android 8.0
// Oreo and below. We only set the orientation on Oreo and above. This only affects the
// splash screen and Chrome will still respect the orientation.
// See https://github.com/GoogleChromeLabs/bubblewrap/issues/496 for details.
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.O) {
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
} else {
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
}
}
@Override
protected Uri getLaunchingUrl() {
// Get the original launch Url.
Uri uri = super.getLaunchingUrl();
return uri;
}
}
public class LauncherActivity extends com.google.androidbrowserhelper.trusted.LauncherActivity {
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Setting an orientation crashes the app due to the transparent background on Android 8.0 // Oreo and below. We only set the orientation on Oreo and above. This only affects the // splash screen and Chrome will still respect the orientation. // See https://github.com/GoogleChromeLabs/bubblewrap/issues/496 for details. if (Build.VERSION.SDK_INT > Build.VERSION_CODES.O) { setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED); } else { setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED); }
}
@Override protected Uri getLaunchingUrl() { // Get the original launch Url. Uri uri = super.getLaunchingUrl();
return uri; }
} [/code] Как я могу включить postmessage связь между моим twa и браузером? Я попытался следовать этому руководству-https://developer.chrome.com/docs/android/post-message-twa, но неясно, где поместить данный код.