Hi, does anybody know how to set up a code that allows the user to search for the nearest store? For example, they would press a button and it will show them the nearest Walmart. Thanks!
You would need to include an Activity Starter Component, and give your search parametres. The app will then open Google Maps to display your query
Hope this meets your requirement !
Hi, thank you so much for responding!
This is my code on the right, but I tried it on an emulator and it says there is no action to be found. Could you tell me what might be wrong? Thank you.
Can u share your blocks?? and what have you entered in the Textbox1 ?
Try to use your cellphone
I have given u the snapshot of the COMPLETE CODE and the result of running it on emulator. The search criteria is shown on the google maps. So either u r missing out something in the rest of the code, or there is a conflict in code somewhere.
This code snippet works on the emulator used with App Inventor 2.
Use the + icon to zoom in to your location
Your Blocks might work.. make sure you have text in your TextBox.
@Anup_Ludra Sure, I changed up the code for it to correspond to a button, however I added a text box to make it like yours.
I tried the code you wrote as well, however it still shows me the error that there is no activity. Do you think it may be a problem within the emulator and my device? Or am I missing something, I really need this function.
Did you show all your Blocks? A guess is you may have a LocationSensor in your app or another component that cannot be used successfully in an emulator or using an emulator. Emulators emulate; they are not a real device and do not have the hardware necessary for lots of actions.
Did you test your app on a real device as was suggested by someone earlier? If not, try on a real device using Companion.
Ah yes, I had a location sensor in another screen. I deleted it and tried it on a Chromebook, and it does open up Google Maps, however it opens it up with nothing searched. I'll try to mess with it around and see if I can fix it. Thanks.
Success! Thanks to everybody that responded. I tweaked it a little and used a real device and it works! Sorry if I was a little slow, but I'm not an expert to this program. Once again, thank you.
Whatever suggestion worked out for you, kindly mark it as Solution and close the topic.
Having seen your blocks, and screen layout, you could make it simpler by having a spinner element giving all the options, or a textbox to take user requirement and do it with only 1 ActivityStarter, instead of a seperate Activity Starter for each search criterea and hardcoding the criterea, as you have done now.
Just a suggestion.
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.