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, но неясно, где поместить данный код.
Я читал документацию CefSharp, много гуглил и видел подобные примеры.
Кажется, они говорят, что если вам нужен JavaScript сообщение на свой C#, начните использовать CefSharp.PostMessage.
Я не могу использовать CefSharp.PostMessage. Я не могу...
founal
Я разрабатываю мобильное приложение с использованием доверительной веб -активности (TWA) и успешно интегрировал CustomTabsSession, чтобы обеспечить связь между веб -приложением и приложением Android через PostMessage.
Обычно все работает...
Я пытался обмениваться данными между двумя вкладками, открытыми в одном браузере. Обе вкладки имеют разные домены (page1.local и page2.local). Я использовал следующий код, но он работает, только если домены одинаковы.
Page1.local
Я завернул веб-приложение Vue js с использованием Android, чтобы сделать его TWA (доверенное веб-приложение).
Теперь я хочу отправить firebase_token и другие данные из части Android в веб-приложение в СВВ. Поскольку все API находятся в...