The code that I'm using was imported directly from this example code:
https://github.com/plaid/link/tree/master/webviews/examples/android
When I run the app in Android Studio on a Nexus 5X emulator I see this:
Empty Menu
It then goes to the loading screen:
Loading
The app then switches between the two as if it were constantly refreshing. I see the empty menu then the loading screen pops up, then back to the empty menu then loading screen again.
I'm very new to Plaid so there might be something very simple that I'm missing but thanks for the help!
In the initialize link step, replace [PLAID_PUBLIC_KEY] with the public key provided to you. If you haven't registered for an account with Plaid, you have to do that first.
linkInitializeOptions.put("key", "[PLAID_PUBLIC_KEY]");
An HTTP request is sent with the public key, and the shouldOverrideUrlLoading function will keep getting called upon response without a valid public key, perpetuating the refresh cycle that you see.
Related
I have an issue with the Forms Maps.
When I drag the map and move away to a different screen, I see the map back to the last location set using "MoveToRegion" when I resume back the map screen. As per the documentation, setting MoveToLastRegionOnLayoutChange to False should prevent this behavior but it doesn't.
I didn't specifically test this property for screen rotation, but Renderer doesn't change on app sleep and resume.
Tried with below:
Xamarin Forms V16.6.000.1062
Android V8.1
Visual Studio 2019 V16.6.3
UPDATE: I realized that it is not merely a case of Page resume, but the page is rendered as below:
mapInstance = MapsPage.SelfInstance ?? new MapsPage();
Detail = new NavigationPage(mapInstance);
Here, I store the page instance in SelfInstance the first time it is instantiated, so the page is not initialized again. Result below:
Here is the link to code sample I created with above result.
Reported this on XF Github page:
https://github.com/xamarin/Xamarin.Forms/issues/11488
Working on a Project and stuck in an Issue:
Hardware Back Button Reloading Application (I am using Angular Router in this application).
My Code to Exit Application:
ionViewDidEnter(){
this.subscription = this.platform.backButton.subscribe(()=>{
navigator['app'].exitApp();
});
}
ionViewWillLeave(){
this.subscription.unsubscribe();
}
While same logic Working in other applications. but in this application its reloading the application not exiting it.
P.S: i have also tried it to put in platform.ready() but no luck.
With IONIC 4, there is new method subscribeWithPriority developed to handle race between soft & hard back button. Try modifying your code like below:
this.platform.backButton.subscribeWithPriority(1, () => {
navigator['app'].exitApp();
});
subscribeWithPriority() stops the propagation of the event after its execution and if we subscribe with high priority and execute our prefered navigation instead of default one then it is going to work as you want.
More reference docs for details:
https://github.com/ionic-team/ionic/commit/6a5aec8b5d76280ced5e8bb8fd9ea6fe75fe6795
https://medium.com/#aleksandarmitrev/ionic-hardware-back-button-nightmare-9f4af35cbfb0
UPDATES:
Try using this new version of exitApp cordova plugin. I haven't
tried myself but looks promising from popularity.
Also try to empty the page stack from Navcontroller or go to your home screen, seems like that's causing the reload for app with sidemenu's & tab pages... this.navCtrl.pop() / this._navCtrl.navigateBack('HomeScreen'), and then call exitApp.
NOTE: Tabs & SideMenu as those have its own routing module does create lot of complexity with app navigation.
Solved:
As Mention by #rtpHarry template of SideMenu / Tabs have History which leads application to Reload it self on root page. i was able to solve this by clearing History.
ionViewDidEnter(){
navigator['app'].clearHistory();
}
on Your Root Page just Clear your history and your Hardware Back Button will close the Application instead of Reloading it.
Do you have a sidemenu in your app? I'm just curious because this seems to be when I get this problem as well.
If you look in your inspector, you will see that window.history has a length of 1.
I don't see it in some of my apps, but the app that I have a side menu setup acts this way - on the homepage if you press back the screen goes white then it reloads the app.
Like I say, looking in the inspector shows that there is a history to step back to, which it is trying to do, and whatever that history step is, it just pushes it forward back to the homepage, which made me wonder if it was the sidemenu setting up its own control of the navigation system.
I've probably said some poorly worded terminology but as I haven't solved this myself I thought I would just let you know what I had found... hopefully it helps you move forward.
In my scenario, I wasn't even trying to do the exit on back code - I just noticed that the app would appear to "reboot" if I kept pressing back.
This explain the solution on Ionic 5 (and 4.6+ too I think).
private backButtonSub: Subscription;
ionViewDidEnter() {
this.backButtonSub = this.platform.backButton.subscribeWithPriority(
10000,
() => {
// do your stuff
}
);
}
ionViewWillLeave() {
this.backButtonSub.unsubscribe();
}
also keep
IonicModule.forRoot({
hardwareBackButton: true
}),
to true (default) in your app.module.ts
Sources:
https://www.damirscorner.com/blog/posts/20191122-CustomizingAndroidBackButtonInIonic4.html
The Doc
I am now working with Android UiAutomator on for UI Test on my Android app. My app has a function that requires the user to verify the email to continue, so I try to do it like this: after reach to that function -> getUiDevice.pressHome -> Browser -> try to log in email -> PressHome again -> Press RecentApps then I stuck here, I cannot press on my Apps to return to it again. I try another way by clicking on my App icon but it starts my app again, not at the state before. Can anyone suggest me a solution for this? Any help is appreciate.
Thanks in advance.
Try this :
UiObject appBackground = new UiObject(new UiSelector().description("ABC"));
appBackground.click();
It did not show any description through 'uiautomatorviewer' command but this worked for me.
I could manage to create this behavior with:
fun backgroundAndForeground() {
val device = UiDevice.getInstance(getInstrumentation())
device.pressHome()
// Pressing app switch two times makes the last app put on background come to foreground.
device.pressKeyCode(KeyEvent.KEYCODE_APP_SWITCH)
device.pressKeyCode(KeyEvent.KEYCODE_APP_SWITCH)
}
In this case, I think that android only resume app when clicking the recent app image. It does not work on clicking display text or app icon. So, we need to click image of your app in recent app list. At that time you need to write as below. I always do that for similar case.
// Take all image view by class type and click by instance no.
new UiObject(new UiSelector().className("android.widget.ImageView").instance(3)).click();
You need to count instance no of your recent app image view. Not app icon image in recent app scroll view. Please try this. Thanks.
I've spent half a day on this and concluded I needed to issue a device.click(). Since my use-case is that my app was the last one running (not switching to the browser like you), I can safely click the middle of the screen and it'll always work.
If you're the 2nd to last running app, you can probably do x: 0 and y: device.displayHeight/2.
I've not tested this on many operating systems, only 9.
I have set up a small mobile application and during tests I have stumbled upon a problem with older versions of mobile devices running Android version 2. Please note that iPhones, iPads and newer versions of Android, namely 4.xx display the pages well. The problem is as follows:
When page is called directly from the link:
Home
it is properly displayed.
However, when there is a click handler on a link, like here:
$(document).on('click', '#lstAddrList li', function ()
{
var anchor = $(this).find('a');
sessionStorage.SiteAddr = anchor.attr('id');
changePage();
});
the list line (in this case) stays selected and nothing happens. It is ONLY after the calling page is refreshed directly from the browser when the called page is displayed. I have a feeling that older Androids do not properly handle changePage() method.
Will you have some ideas?
I am trying to make an App that acts as a map of a local area. Because of the local area, I do not want to use Googlemaps or its API. I want to use a .png that I import. My image is 2300 x 1650 and after searching for a way to load this image into my Activity (because just making one bitmap throws OOM exception), I found a way using Drawables. My code to implement the drawable is...
InputStream mapInput = resources.openRawResource(R.drawable.mymap);
mapDrawable = Drawable.createFromStream(mapInput, "mymap");
mapDrawable.setFilterBitmap(true);
mapDrawable.setBounds(0, 0, MAP_WIDTH, MAP_HEIGHT);
myCustomView.setMapDrawable(mapDrawable, MAP_WIDTH, MAP_HEIGHT);
and this works all fine and dandy and allows the App to function. However if I BACK or HOME screen out of the application and attempt to reload it, I get a NullPointerException when I try to access mapDrawable (so in this line of code, on mapDrawable.setFilterBitmap(true))
After my app fails, if I try to reopen it again, it works again. Unless I BACK or HOME out of it and then it fails. It always fails on the attempt to reopen.
I don't understand what I am doing wrong.
Here is a sample project showing asynchronous in google Maps..
https://github.com/commonsguy/cw-advandroid/tree/master/Maps/NooYawkAsync/
Try this if it works..