Comments (3)
Hey, so if I understand this correctly you need a way to add extra parameters to the intent before restarting the app?
from android-browser-helper.
@SayedElabady More like disable the default behavior of forwarding the intent to custom tabs activity if the app is already open. Because when it does that it doesn't let my custom activity to start and do its thing.
from android-browser-helper.
@SergeyPoznyakAkvelon , We can add a method to let you add extra parameters to the intent before firing it, you can find a sample below. Please let me know if this will help you in resolving the issue or not.
private boolean restartInNewTask() {
boolean hasNewTask = (getIntent().getFlags() & Intent.FLAG_ACTIVITY_NEW_TASK) != 0;
boolean hasNewDocument = (getIntent().getFlags() & Intent.FLAG_ACTIVITY_NEW_DOCUMENT) != 0;
if (hasNewTask && !hasNewDocument) return false;
//...
Intent newIntent = new Intent(getIntent());
int flags = getIntent().getFlags();
flags |= Intent.FLAG_ACTIVITY_NEW_TASK;
flags &= ~Intent.FLAG_ACTIVITY_NEW_DOCUMENT;
newIntent.setFlags(flags);
modifyIntentForNewTask(newIntent);
startActivity(newIntent);
return true;
}
/**
* Override this method to add extra parameter to the intent before firing it when
* restartNewTask is required.
*/
public Intent modifyIntentForNewTask(Intent initialIntent){
// Do the modification here as you want, for example
// if (shouldRestartBrowser()){
// add the extra parameters here, like:
// initialIntent.putExtra(INTENT_REFRESHED, true);
// }
return initialIntent;
}
from android-browser-helper.
Related Issues (20)
- When a separate activity is launched and finished, the app backgrounds and doesn't return to the twa activity HOT 4
- Consistent Google Play Billing error in TWA: clientAppUnavailable (Android 13, API 33 and above) HOT 3
- Bump the `com.google.android.gms:play-services-location` version in `locationdelegation` HOT 1
- Cannot repro the demo of twa post message HOT 4
- Post Message - onMessageChannelReady is not getting called HOT 1
- [BUG] Custom Tab doesn't appear in a bottom sheet HOT 1
- [BUG] Custom Tab height doesn't change HOT 3
- Demo site not working
- PostMessage request has failed due to an internal error on the browser message channel. HOT 2
- Base Plans are not supported in subscriptions
- Ok
- How to support activity embedding, cross-application embedding. HOT 1
- Isolating TWA local storage
- Not able to consistently launch another activity from the LauncherActivity
- onActivityResult not triggering when Activity is started by LauncherActivity
- Broken caching behavior in `SplashImageTransferTask` on dark / light mode switches
- PWA: Call to Javascript "alert()" causes un-dismissible URL bar to appear
- Google Chrome not shows the "access to camera" prompt after version 122 HOT 5
- how To Hide Custom Tab Minimize Button HOT 1
- I need help with keyboard shortcuts for chrome on android 13 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from android-browser-helper.