# Possible Maps Workaround?

**URL:** <https://community.thunkable.com/t/possible-maps-workaround/1594609>\
**Category:** Questions about Thunkable X\
**Created:** [November 3, 2021, 2:21am UTC](https://community.thunkable.com/t/possible-maps-workaround/1594609 "2021-11-03T02:21:01Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![ronnie](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/ronnie/32/121539_2.png) [@ronnie](https://community.thunkable.com/u/ronnie)\
**Post date:** [November 3, 2021, 2:21am UTC](https://community.thunkable.com/t/possible-maps-workaround/1594609/1 "2021-11-03T02:21:01Z")

</div>

So, I’m brainstorming some ideas here to get Google Maps working in my app. My thought is to use a web viewer, capture click events, then pass those back to the app via a script. The thing I am unsure of is, how can I get the app to capture those clicks? Is there any way to do that outside of using a database to store the click information and then using an API call or something to grab it? My thought would be to put an API call in an infinite loop until some condition is returned to end the loop.

Anyone done anything or have any ideas on that? Just curious.

---

<div class="post-metadata">

**Author:** ![kartik14](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/kartik14/32/44782_2.png) [@kartik14](https://community.thunkable.com/u/kartik14)\
**Post date:** [November 3, 2021, 7:45am UTC](https://community.thunkable.com/t/possible-maps-workaround/1594609/2 "2021-11-03T07:45:21Z")

</div>

If you just want to identify the click location on the map, does this work for you? [Maps by Google and Apple - Thunkable Docs](https://docs.thunkable.com/map#add-marker) (just remove the location sensor block, and connect the onPress event’s lat & long to addMarker)

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/d/2/d2406ed3325b45d7b4520d7a503992fd7328ae21.png)

---

<div class="post-metadata">

**Author:** ![ronnie](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/ronnie/32/121539_2.png) [@ronnie](https://community.thunkable.com/u/ronnie)\
**Post date:** [November 3, 2021, 7:48am UTC](https://community.thunkable.com/t/possible-maps-workaround/1594609/3 "2021-11-03T07:48:53Z")

</div>

My problem is the Google Maps component does not work in a published app. I can’t use Apple Maps in an Android app, so I am stuck. I am almost done with my workaround and it is working really well! I just need to figure out how to get the location text back into the app as a number so I can chop decimal places off and then I’m all set. It’s a bit of work, but it’s better than being stuck with blank maps.

---

<div class="post-metadata">

**Author:** ![ronnie](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/ronnie/32/121539_2.png) [@ronnie](https://community.thunkable.com/u/ronnie)\
**Post date:** [November 3, 2021, 8:09am UTC](https://community.thunkable.com/t/possible-maps-workaround/1594609/4 "2021-11-03T08:09:16Z")

</div>

And, it works!

Here’s my block:

 ![1707A669-1E99-42B1-820D-3C06249164F5_4_5005_c](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/1/4/14a0eb01e4a56c70d735a02c6919e22c20b9ae20.jpeg)

So, I load my web page that has my Google Maps script into the map viewer I have created. When a user clicks on that, I use the Receives Message of the map viewer to get a returned message. My web page then returns a JSON with the latitude and longitude of the clicked point on the map. I can then pull this in and use it as a variable in the app. The end result is a working, clickable Google map!

 ![BD6DDCD0-3FBB-4D5F-8FAF-171164E0B98A](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/4/6/4659422f70e6088348c3118a0b50d899012a6e09.jpeg)

The added benefit of doing it this way is that I can make my own custom map markers and customize other options of the map.

---

<div class="post-metadata">

**Author:** ![muneer](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/muneer/32/75210_2.png) [@muneer](https://community.thunkable.com/u/muneer)\
**Post date:** [November 3, 2021, 9:08am UTC](https://community.thunkable.com/t/possible-maps-workaround/1594609/5 "2021-11-03T09:08:04Z")

</div>

Does it work in an installed APK?

My `Web Viewer Extension` stopped working sine couple of months. It will be nice to know that things work again.

The same `Web Viewer Extension` and actually the same app works fine on iPhone but not on Android.

---

<div class="post-metadata">

**Author:** ![ronnie](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/ronnie/32/121539_2.png) [@ronnie](https://community.thunkable.com/u/ronnie)\
**Post date:** [November 3, 2021, 9:11am UTC](https://community.thunkable.com/t/possible-maps-workaround/1594609/6 "2021-11-03T09:11:34Z")

</div>

> [@muneer](#):
>
> Does it work in an installed APK?

I haven’t pushed to the Play Store yet, but it works great in Android Studio.

 ![D5EAA93B-88DB-4406-89DA-32BB76D50329](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/f/c/fcf613aed32b141dbf331e12864a74dcbe3dc764.jpeg)

---

<div class="post-metadata">

**Author:** ![muneer](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/muneer/32/75210_2.png) [@muneer](https://community.thunkable.com/u/muneer)\
**Post date:** [November 3, 2021, 9:12am UTC](https://community.thunkable.com/t/possible-maps-workaround/1594609/7 "2021-11-03T09:12:41Z")

</div>

Just download the APK and install it in your device. No need to push to Play Store to test this.

---

<div class="post-metadata">

**Author:** ![ronnie](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/ronnie/32/121539_2.png) [@ronnie](https://community.thunkable.com/u/ronnie)\
**Post date:** [November 3, 2021, 9:13am UTC](https://community.thunkable.com/t/possible-maps-workaround/1594609/8 "2021-11-03T09:13:30Z")

</div>

> [@muneer](#):
>
> Just download the APK and install it in your device.

I don’t have an Android device, so I have to use Android Studio to test my APKs.

---

<div class="post-metadata">

**Author:** ![muneer](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/muneer/32/75210_2.png) [@muneer](https://community.thunkable.com/u/muneer)\
**Post date:** [November 3, 2021, 9:21am UTC](https://community.thunkable.com/t/possible-maps-workaround/1594609/9 "2021-11-03T09:21:34Z")

</div>

OK, so you are using an emulator not a real device which might not exactly be the same response as a real phone.

---

<div class="post-metadata">

**Author:** ![ronnie](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/ronnie/32/121539_2.png) [@ronnie](https://community.thunkable.com/u/ronnie)\
**Post date:** [November 3, 2021, 9:25am UTC](https://community.thunkable.com/t/possible-maps-workaround/1594609/10 "2021-11-03T09:25:48Z")

</div>

I have my wife test it on her Google Pixel 2XL when I push updates to the Play Store and the web viewer has had no issues on her phone.

---

<div class="post-metadata">

**Author:** ![Michael\_Rogulla](https://avatars.discourse-cdn.com/v4/letter/m/ba8739/32.png) [@Michael\_Rogulla](https://community.thunkable.com/u/Michael_Rogulla)\
**Post date:** [November 3, 2021, 12:18pm UTC](https://community.thunkable.com/t/possible-maps-workaround/1594609/11 "2021-11-03T12:18:02Z")

</div>

Hi @muneer , do I understand you correctly, that the very basic component “web viewer” from Thunkable is not working in your app? For me it is working on iOS and Android. Some months ago I found out that you have to give the web\_viewer component in the “design”-screen a valid URL, preferably a blank page (I use one from my own webspace).

I hope that helps.

---

<div class="post-metadata">

**Author:** ![muneer](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/muneer/32/75210_2.png) [@muneer](https://community.thunkable.com/u/muneer)\
**Post date:** [November 3, 2021, 12:30pm UTC](https://community.thunkable.com/t/possible-maps-workaround/1594609/12 "2021-11-03T12:30:31Z")

</div>

See this sample project. It uses JavaScript to obtain the day after number of days entered by the user. It works on iPhone but not on Android  
[https://x.thunkable.com/projectPage/60d06b27eb9be10011749fcd](https://x.thunkable.com/projectPage/60d06b27eb9be10011749fcd)

Can you please check and see.

Screenshot from the phone

 ![Screenshot_2021-11-03-15-42-04-95_2bbfbfee96a5dfce998f962ebb8b5da3](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/d/0/d0c7e61da79537cac45e330f6c1d5b5edaab7d78.jpeg)

Screenshot from the computer  
 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/4/e/4ebc3a9b3e4763681939e075d48589382f38299d.png)

The `Web Viewer Extension` gets the computed date when run from the computer or on an iPhone but respond with **undefined** when run from an Android.

---

<div class="post-metadata">

**Author:** ![Michael\_Rogulla](https://avatars.discourse-cdn.com/v4/letter/m/ba8739/32.png) [@Michael\_Rogulla](https://community.thunkable.com/u/Michael_Rogulla)\
**Post date:** [November 3, 2021, 10:10pm UTC](https://community.thunkable.com/t/possible-maps-workaround/1594609/13 "2021-11-03T22:10:10Z")

</div>

Hi, I think this conversion from a list to an object is not correct:  
 ![grafik](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/8/a/8ab62e24f54bbcb1fda8429393a941a299fb7b6e.png)

AFAIK an object is an associative array with key/value pairs, like { “name”: “Mike”, “year”: 2021 }. But in your app you deliver only four values (numbers) without keys. I think you should build an object with 4 key/value pairs (year, month, day, adddays) and pass it to the block “generate JSON from object”. I don’t know why it maybe works on an iPhone, I would say that this block shouldn’t work on either platform…

---

<div class="post-metadata">

**Author:** ![muneer](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/muneer/32/75210_2.png) [@muneer](https://community.thunkable.com/u/muneer)\
**Post date:** [November 3, 2021, 11:25pm UTC](https://community.thunkable.com/t/possible-maps-workaround/1594609/14 "2021-11-03T23:25:15Z")

</div>

Thank you for taking the time to look into the issue. I wanted an array ( a list in Thunkable terms) and this is a valid array. I wasn’t looking for an object and therefore your description of the situation assumes an object for no obvious reason.

In the other hand, you are welcome to demonstrate any other simple project having two way communication between the app and an HTML file using the `Web Viewer` component and have it working using computer, iPhone, Android phone.

---

<div class="post-metadata">

**Author:** ![ronnie](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/ronnie/32/121539_2.png) [@ronnie](https://community.thunkable.com/u/ronnie)\
**Post date:** [November 4, 2021, 6:44am UTC](https://community.thunkable.com/t/possible-maps-workaround/1594609/15 "2021-11-04T06:44:48Z")

</div>

I’m not sure why it is doing this. I tried seeing if I could figure it out by duplicating your html file on my server to tweak some things and I get the same result, no matter what I try. Oddly, if I pass the data to an alert(), it displays the information correctly but then updates the label with undefined. The way I worked my maps was to have the script call the postMessage function and return JSON data that I could then work with. Yours should return a string with the date information, but it does, indeed, return undefined when I put it in my Android emulator. I have no idea. The only thing I can ascertain is the the message data is not being passed into the postMessage function, for whatever reason, after it is processed inside the receiveMessage function.

---

<div class="post-metadata">

**Author:** ![muneer](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/muneer/32/75210_2.png) [@muneer](https://community.thunkable.com/u/muneer)\
**Post date:** [November 4, 2021, 9:52am UTC](https://community.thunkable.com/t/possible-maps-workaround/1594609/16 "2021-11-04T09:52:21Z")

</div>

@ronnie  
Do you mean to say your code/html works with Android devices without any issue? If yes, could you see what is the difference between the two?

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![Michael\_Rogulla](https://avatars.discourse-cdn.com/v4/letter/m/ba8739/32.png) [@Michael\_Rogulla](https://community.thunkable.com/u/Michael_Rogulla)\
**Post date:** [November 4, 2021, 1:27pm UTC](https://community.thunkable.com/t/possible-maps-workaround/1594609/17 "2021-11-04T13:27:26Z")

</div>

> [@muneer](#):
>
> Thank you for taking the time to look into the issue. I wanted an array ( a list in Thunkable terms) and this is a valid array. I wasn’t looking for an object and therefore your description of the situation assumes an object for no obvious reason.

Hmmm… I only described your blocks: on the right side you generate a list with 4 elements. This list is feeded into a block “generate JSON from object” which is in my opinion not correct: the block “generate JSON from object” expects an object, doesn’t it? But you feed it with a list of 4 values. Is this the way you meant to be?

---

<div class="post-metadata">

**Author:** ![muneer](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/muneer/32/75210_2.png) [@muneer](https://community.thunkable.com/u/muneer)\
**Post date:** [November 4, 2021, 1:46pm UTC](https://community.thunkable.com/t/possible-maps-workaround/1594609/18 "2021-11-04T13:46:38Z")

</div>

> [@Michael\_Rogulla](#):
>
> Is this the way you meant to be?

I very much appreciate your effort.

Yes, this is exactly what I meant to do. I could use the JSON structure but even if, for example, you try to save a list to Firebase, it will just save it as a JSON.

In the list is correctly passed to the HTML file and processed correctly. If you try the project in your computer you will see that it calculates the date correctly even if you enter in the number of days field (the last one) 200 days, just press the button and the correct date will be displayed in the text box.

The function works correctly and as intended. The only issue is when run from an Android device it gives **undefined** for some reason.

---

<div class="post-metadata">

**Author:** ![ronnie](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/ronnie/32/121539_2.png) [@ronnie](https://community.thunkable.com/u/ronnie)\
**Post date:** [November 4, 2021, 2:07pm UTC](https://community.thunkable.com/t/possible-maps-workaround/1594609/19 "2021-11-04T14:07:55Z")

</div>

@muneer, no. I could not get it to work and I tried various things. I’m not sure why it is returning undefined on Android.

---

<div class="post-metadata">

**Author:** ![muneer](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/muneer/32/75210_2.png) [@muneer](https://community.thunkable.com/u/muneer)\
**Post date:** [November 4, 2021, 3:28pm UTC](https://community.thunkable.com/t/possible-maps-workaround/1594609/20 "2021-11-04T15:28:08Z")

</div>

@ronnie ,  
@Michael_Rogulla

Many thanks. I found the problem. Chrome does not allow the return of objects. Only text where as Safari will auto-convert to text. The `Date in JavaScript` is an object not a text.

[Next page](https://community.thunkable.com/t/possible-maps-workaround/1594609.md?page=2)
