2019年4月21日日曜日

Firebase GPS demo made with ThunkableX (common to Android & iOS)

ThunkableX [1] is a kind of software system of App Inventor, which makes it possible to create a common source program for Android and iOS. Some of its functions have not yet been realized, but it is a wonderful system that continues to progress. Here, we created a simple GPS demo program using ThunkbleX.

Suppose Jack and Betty want to show each other the current location on the smartphone in real time. The MIT App Inventor program that realizes it is shown in the literature [2]. It uses the real-time database Firebase, but it is assumed that both have Android devices. By contrast, this article assumes Jack has an Android device but Betty has an iPhone.

I created a ThunkableX app like Fig. 1 below. The source list (block configuration) of the app used here is common to Jack and Betty. Using the Firebase, current positions of each other are displayed in real time. When you press the send button, your location information will be stored in Firebase. Fig. 2 shows the contents of Firebase. If there is a change in the Firebase, the opponent's smartphone immediately updates the map display by seeing the change event in real time.



The whole block of ThunkableX that realizes this is shown in Fig. 3. For reference [2], registration of the listener for change event as shown in Fig. 3(1) was unnecessary. However, the reason ThunkableX needs it is probably because of the commonality with iOS. When you use Firebase, you do not need to make any settings if it is a temporary test program. However, if you use it in a full-fledged app, you will need to set up your own Firebse Database URL and API Key. Otherwise, security issues may occur.


References
[1] https://thunkable.com/#/
[2] USING FIREBASE IN A REAL APP – “HERE I AM!” GPS DEMO APP (https://appinventor.pevest.com/2016/09/13/using-firebase-in-a-real-app-here-i-am-gps-demo-app/)

0 件のコメント:

コメントを投稿