Running the google places modal popup in flutter - flutter

Looking at the flutter code it seems like I should be able to run the google places modal dialog since it does a full screen thing and doesn't try and overlay on top of flutter.
However I am having an issue where the modal shows up and then disappears again immediately. I am not entirely sure how to solve this...
I am activating it with:
call.method == "openPlacesDialogModal" -> {
val code = GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(activity)
if (GoogleApiAvailability.getInstance().showErrorDialogFragment(activity, code, REQUEST_GOOGLE_PLAY_SERVICES)) {
return
}
//val intent = Intent(activity, PlacesActivity::class.java)
//activity.startActivity(intent)
var intentBuilder = PlacePicker.IntentBuilder()
activity.startActivityForResult(intentBuilder.build(activity), PLACE_PICKER_REQUEST)
placeResult = result
return
}
In the logs I get:
I/FlutterActivityDelegate(18184): onResume setting current activity to this
I/flutter (18184): Opening picker
I/FlutterActivityDelegate(18184): onResume setting current activity to this
I think it is the onResume getting back to the ActivityDelegate that is the issue.
I put this on top of a completely different activity too, which kind of works. It shows the dialog for longer. I made sure I have all the right permissions, I have the fine location, internet permissions. Do I need to setup anything else?
Thanks,
David.

Error here was that I was not setting up the google api correctly and it was erroring immediately. Had to put in some checks to look for this error so I could respond correctly to the app that an error occurred.

Related

Flutter Firebase DebugView not sending events

Initially the person before me set up a screen observer so that whenever the page changes, setCurrentScreen is triggered to send a event and log the screen. Because we use a bunch of open containers to animate page opening, the screen observer doesnt get triggered. So I went through the app and added some setCurrentScreen for those that the screenObserver missed, and while there I also added some logEvents to see if people are using specific parts of the app.
The way I set enabled debug view was in xcode, going to Product -> Scheme -> Edit Scheme and adding -FIRAnalyticsDebugEnabled and -FIRDebugEnabled Edit scheme
After ticking both of the above (or just one or the other), only these events are being triggered then the app stops sending events. Completely. What am I missing? output
I cannot find another issue about this. I am using the same package name in the app and firebase, otherwise I would have no output. All other issues are talking about no output at all. I have tried to do this on simulator and on actual iPhone and they both yield the same result. I have also set up a android emulator and have an actual phone. Tried it on both and same result. The above screenshot is from iPhone as I am on Mac and more comfortable working on a iPhone.
i have set IS_ANALYTICS_ENABLED to true in the .plist file and this did not work

WebView crashes on navigation popBackStack() with Jetpack Compose LazyColumn

I have WebView inside the LazyColumn. It shows up fine. The thing is when I try to navigate back by calling navController.popBackStack(), I got fatal crash (Fatal signal 11 (SIGSEGV)).
I ran it on the emulator. It works fine when click the "Back" button in the emulator.
Also, it works fine when I replace LazyColumn with Column.
Any idea or thought?
I had the same issue and you can fix this in some ways that I've found:
destroying your WebViev webView.destroy() or making it invisible webView.visibility = View.INVISIBLE when your screen disappears.
adding alpha = 0.99F (any value but less than 1) to WebView. webView.alpha = 0.99F
When using WebView inside LazyColumn try using the remember function to retain the state across rebuilds. Alternatively, you can try a different layout component like VerticalScroller to wrap the WebView.
LazyColumn{
items(items){
// ...
remember {
WebView(/* ... */)
}
}
}

Flutter:"pr.dismiss" cannot defined in progress dialog

I run my application, but show this error. Before this i can run it. But now, It says "pr.dismiss is not defined in progress dialog." I have install package,and my code in flutter is not red colour but run it that got error in debug.
So how i can solves this problem?
I RUN THIS GOT PROBLEM
as per your source code you use https://pub.dev/packages/progress_dialog package for display progress dialog. so as per this package for dismiss dialog you need to use the below method.
pr.hide().then((isHidden) {
print(isHidden);
});
// or
await pr.hide();
So replace pr.dismiss() with the above method.

Using uni_links when the app is in the background

My application has the following structure:
- InheritedWidget for dependencies
--> Splash Screen Page
--> Login Pages
--> Main Pages
When the app runs for the first time, I can use var link = await getInitialLink(); to get the value for the link that opened the app.
However, I cannot get the same result if I open the app on the background.
I tried to use
getLinksStream().listen((link) => (link) {
try {
var _latestUri;
if (link != null) _latestUri = Uri.parse(link);
print("=== Formated successfully a link!");
} on FormatException {
print("--- A link got here but was invalid");
}
});
For getting the link in the Splash Screen, but if the app is already open in the Login or Main pages, it won't go through the Splash Screen again.
Then, I tried to put it in the InheritedWidget, but alas, didn't get any result whatsoever.
So my question is: Where and how should I set up uni_links so that I can catch all incoming links even if the app is open?
Or better, is there an alternative for App Links/Universal Links that I can use?
Though it's not the best and most elegant way, I got around this.
First, I was not using getLinksStream correctly
Instead of
(link) => (link) {...}
It's
(link) {...}
Then, I need to put this subscription in my Splash Screen and do not dispose of it, so that it can listen to new events.
If anybody has a better solution, please free to add it
For this situation, you need to use both of getInitialUri() and getUriLinksStream(),
If app launchs directly u will get uri from getInitialUri, if app already running on background u will get uri from getUriLinksStream.

print not working in Swift 3 extensions

I'm new at Swift 3 and I try to make a print("Test") in a Widget extension.
I tried the same code in ViewController.swift and It works ok. I don't know why it works there but it doesn't on TodayViewController.swift. I can't access to objects too.
func loadData() {
let query = PFQuery(className: "Noticias")
query.whereKey("titulo", equalTo:"Es Navidad")
query.findObjectsInBackground(block: { (objects : [PFObject]?, error: Error?) -> Void in
if error == nil {
// The find succeeded.
print("Successfully retrieved \(objects!.count) scores.")
// Do something with the found objects
if let objects = objects {
for object in objects {
print(object.objectId!)
}
}
} else {
// Log details of the failure
print("bad day homie")
print(error!)
}
})
}
I attach I picture to see it clearly. If I try to print on the file marked as Work, it works. But if I try it on the file marked ad NO, it doesn't.
It is extremely difficult to retrieve print messages from an extension. The problem is that it's an extension! It isn't running in your app, so it doesn't arrive at your console. Sometimes I find you can solve this problem by switching the debugged process in the Debug Bar at the top of the debug area (at the bottom of the screen, not shown in your screen shot), but at other times this doesn't work.
I'll illustrate a possible technique that seems to be pretty reliable. Look at this screen shot:
"Expand" is an action extension. But my containing app is called "bk2ch13...". So how will I ever manage to pause at the breakpoint shown at the right, which is in the action extension? This is what I do.
First, with the screen as shown above, I build and run my containing app.
Then, I switch the target to the action extension:
Now I build and run again. But now I am trying to run an action extension, which you can't do, so Xcode asks me what app to run:
So I choose "bk2ch13...". So now we are running my host app again, but we are debugging the extension. So I use my host app to exercise the extension, and sure enough, we pause at the breakpoints and print statements arrive into the console.
Note, in that screen shot, how the debug bar clearly shows that we are talking to the extension, not the host app.