Flutter - Weird redrawing - android

I have a weird behavior in my app. I have the google_maps_flutter plugin with the flutter_typeahead plugin which is used as an autocomplete address search.
When the user login in the app, the app only stores the user data in the internal database and the map is loaded, the app gets the current user location and set the map in such location, and then the user can use the autocomplete address search to type any address and load the results coming from Google Api Directions.
The strange thing here is, when I tap in the autocomplete, the page or the map is redrawn/reloaded and I can't do anything as you can see in this link:
App after just login.
But the most weird is, if I just exit from the app (no logout) with SystemNavigator.pop(animated: true);, and after that I open again the app, this behavior is gone and the app works, like this video: App reopened.
I don't have a clue why, and I can't post the code here, first, because it's a production app and second, because the minimal code is so extense to publish it here.
It's a little similar to my Github issue: https://github.com/flutter/flutter/issues/78638 but here, although I'm getting in realtime the user location, the map isn't moving because I'm in the same place al the time.
EDIT: In the dispose method for the StatefulWidget I set a debug print to check when this is disposed and when I tap on the typeahead plugin, I see the StatefulWidget (where is the map and the typeahead) is disposed, when I just login, but it isn't present when I reopen the app.

Related

How to use Google Maps API offline in Angular/Ionic App

I have an Angular 12 Ionic app that is using the Google Maps API via #angular/google-maps package (https://github.com/angular/components/tree/master/src/google-maps#readme). The application we are building will be used in areas where internet access can be spotty at best. We are attempting to maintain functionality of the map when internet is lost. IE, potentially cache or store the loaded map locally to reference should we go offline.
We are expecting the user to be online when we initialize the map and load any polylines & markers
Should the user then go offline, and navigate around the app, when coming back to the map we would like to show the map, polylines and markers that were previously loaded.
What currently is happening is the the component is being destroyed and then reloaded when navigated back causing a reload of the map which cannot happen because we are offline. However, if we were able to cache or locally store that map, then we can load it from the cache/local until the user comes back online.
Using the package described above we are looking at trying to serialize the google.maps object to json for storage, however it is causing an issue.
let mapTest: google.maps.Map;
const center: google.maps.LatLngLiteral = { lat: centerPoint.lat, lng: centerPoint.lng };
mapTest = new google.maps.Map(document.getElementById('map') as HTMLElement, {
center,
zoom: 11
});
This is a basic typescript implementation as provided by the Google API Documentation (https://developers.google.com/maps/documentation/javascript/using-typescript). When we attempt to stringify the map we get the following error
Same error shows if we stringify mapTest.data.
Question is, is there anything we can do to locally store the google.map object or the google.map.data object? This ultimately will be put onto an Android device using Ionic, is something like this possible with Native Android maps? Or is this just not a feasible task at all
The Google Maps JavaScript API cannot be used offline.
See feature request: API feature to download a map for offline use.

How developer get notified when app stops working in between?

When user is using an android app and on one page he doesn't get any response but loading progress bar is visible then how developer can be notified for this issue? Is there any tool or any other way to implement this type of functionality in the app.
Implement the firebase crash analysis in your Project . Firebase itself give you the Trackpath via email.
Here you will get the method , line number, exception type everything in the email .

How to set user information to Crashlytics api in Android

I am trying to set user information to crash reports in crashlytics in Android App, so that it will help me to find out which of our users experienced a given crash. I have explored and found there are 3 APIs can set user information in crash report.
Those are,
void Crashlytics.setUserIdentifier(String identifier);
void Crashlytics.setUserName(String name);
void Crashlytics.setUserEmail(String email);
It is recommended to use all the APIs. All documented at http://support.crashlytics.com/knowledgebase/articles/120548-how-do-i-set-user-information-
But I have no idea,
1. How to get user-identifier, name and email details, which are input to those APIs?
2. Which place in program to call these crashlytics APIs?
Please share some ideas, how to implement this.
Regards
Annada
Looks like detail UI in Fabric has been changed.
Select one of crash issue.
Click Version in Recently Activity
On detail page top right hand corner, you should see affected user information.
If your application uses some form of user identification (i.e. login, email, phone, device specific id) you can use that as crashlitics user information. I suppose you can generate user id when your app is first launched and save it in shared preferences, for example. It'll be shown at top-right corner of detailed crash view.
i.e. I set ID and name as soon as user authenticates in my app.
You typically want to set them as soon as possible (as your data arrives) and all info has been initialized.
For new Firebase api
FirebaseCrashlytics.getInstance().setUserId("12345")
For More
Customize your Firebase Crashlytics crash reports

Get user information in Crashlytics

I am using Crashlytics in my application and I wanted to get user id and email along with each crash. I did something like this:
Crashlytics.setUserEmail(tokenModel.getEmail());
Crashlytics.setUserIdentifier(String.valueOf(tokenModel.getPk()));
I am doing this in my login screen, after the user has provided his email and successfully registered with the app, so as to get user id. The problem is, I am not getting these data in the crash reports.
What is the lifecycle and working of Crashlytics in above context? Do I need to set these fields every time the app opens?
I am not sure if it needs to be done every time you launch the app and the Crashlytics docs don't explicitly say it neither.
I know that we do it with every launch and it works - provided user info is displayed properly in the dashboard.
My suggestion would be to try send this information every time you initalize Crashlytics with Fabric.with(this, new Crashlytics());, as soon as you have your user data provided (for example after fetching his user profile from your server).
You need to select the issue, click in more details and at the top right corner you can see a label with Identifier.
You need to set it every time you initialise the Crashlytics. At least doing this it works.
if you are using this Crashlytics.setUserIdentifier(""); you can check in data tab in firebase. Fabric.with(this, new Crashlytics()); working fine.
If you look into codes of FirebaseCrashlytics than you can see that userId is being saved into the session. So I am sure that after restarting application your id will be restored.

Coming url doesn't let me go further in cordova app after google authentication

Hello I am using Cordova app using Visual Studio 2015 community and simply login in the app using google authentication it's pretty fine login is done by open it in new window but after login it gives me the three pop up messages and than don't do anything.
The messages are (which are coming after login process and gives allow permission):
1) gap_init:2
2) gap:[null,"CoreAndroid","messageChannel","CoreAndroid237153815"]
3) gap:[null,"CoreAndroid","show","CoreAndroid237153816"]
by pressing these messages as "OK" it's just showing me my first page in the same popup window from where I logged in using Google and returned url after login is:
http://localhost:4400/?code=4/chL63O9SMzMFZGOlqcB9TFMVUFxWj0E4GYEuVFDQ3gM#.
My configured url settings in console.developers.google.com are:
Authorized JavaScript origins = http://localhost:4400
Authorized redirect URIs = http://localhost:4400
and when I am calling the api in that in redirect_uri I pass localhost://4400
I am supposed to go on the second page after login and give allow permission i.e. index2.html but no such process takes place after window gets popped up.
In mobile it open's the browser but don't come back to application for further process staying there after allow process done and finding the coming url i.e.
http://localhost:4400/?code=4/chL63O9SMzMFZGOlqcB9TFMVUFxWj0E4GYEuVFDQ3gM#.
Where am I doing wrong please suggest me anyone as soon as possible. Thank you
IF you have placed cordova.php in root try reload after renaming it

Categories

Resources