Need advice on a high school Android app project

Hello Everyone,

I am an 11th grader LEARNING to develop an small Android app using Kotlin for a school project. I want to be able to broadcast a preset text message through a Heltec V3 device that is Bluetooth-paired with my Android phone.

I’ve installed and configured the Meshtastic Android app on my phone and was able to send text messages to show on my teammate’s Heltec V3 device (we purchased 2 devices for this school project).

I tried to learn by browsing the Meshtastic-Android project files and was overwhelmed by the project size and complexity. So I thought I might stand a better chance if I could learn from a very simple example app that I could actually build and play with before integrating the necessary code into my own project.

Please may I ask if anyone could provide a simple ‘sendText’ app example project for me to learn from, or offer a link to such a project if it’s already available on Internet? Thank you for any help anyone could give.

Marc

I have taken the liberty of asking around and not heard of anything. The closest I got was this link

https://reddit.com/r/androiddev/w/index/getting-started

I would start with using a linux system unless Android is a must (which I assume it is from your question).

I think a big part of this is where are you wanting to send messages from?

  1. Code running on the Heltec,
  2. on a second MCU (eg connected to the heltec via serial)
  3. an android app
  4. or code running on a connected computer (eg via usb connection to heltec)
  5. Other?

… might be able to help with 2 or 4, but 1 or 3 is more tricky!

I guess Kotlin implies 3?

I would think that a serial connection to the heltec, is going to be easiest

In theory at least, meshtastic can be used as a a transport medium

Data it receives via serial port can be put over the mesh to come out of another device.

1 Like

Thank you. I actually saw your Reddit post when I did another search hoping to find some simple sample Android apps and happened to see your post. Ah…it seems there is little hope to learn by examples in this case. I am a bit frustrated cause I thought when the programmers tested their Android Meshtastic app they must have some small test apps or code to check out sending and receiving without involving all other features of the final app. So we (me and my teammate at school) were expecting it to be easy to find something that could help us learn to add only a sendText() feature to our little Android app project.

I spent almost two hours today to learn to step through the Meshtastic Android app running on my Samsung S22 phone. I thought I should trace the user input message feature. I found things like the following:
sendMessage() called in MessageFragment.kt
sendMessage() code is in UIState.kt
sendDataPacket() called from sendMessage()
sendDataPacket() code is in UIState.kt
meshService.send(packet) called from sendDataPacket()
meshService.send() code is in MeshService.kt
meshService.send() called sendNow(), which called sendToRadio()

Then I found the sendToRadio() code simply stored the packet in some kind of queue object before calling startPacketQueue().

Anyway, that made me little dizzy cause I thought there must be many files and code from the gigantic Meshtastic-Android project folder I must learn to add to my own little Android project folder in order to be able to follow the above calling sequence, so honestly I am feeling quite lost now cause I basically don’t know what my next step should be in order to be able to do that successfully without introducing countless build errors.

Then I saw that Meshtastic Python CLI link and clicked to find out more. There I downloaded Termux and follow all setup/install steps and got maybe one meshtastic command to run (something like -version). But “meshtastic --ble-scan” always printed on screen many code lines and ended with an error message (file not found or something like that). I was thinking as an alternative maybe I could learn to invoke some Meshtastic Python CLI scripts from my Android app to do the sendText() I need…then of course I got stuck cause I couldn’t even connect my phone to my Heltec V3 through BLE. For my school project I need an Android app running on a phone without any cable attached except for a USB power bank. So I searched all over Internet and didn’t see a solution to my problem. I actually didn’t even see any post indicating this problem so maybe that’s why no one discussed about it and provided a solution. I will try this Termux + Python CLI method using my teammate’s phone (OnePlus 7 I think) tomorrow.

I also searched to see if GitHub Copilot has the ability to go into the Meshtastic project and learn everything before I post it my questions but so far it doesn’t look like it is able to learn a gigantic project. I don’t want to pay it to find out it actually can’t help.

Yes sir it needs to be option 3 on your list cause my team is doing an Android app running on a phone connected to a power bank. So it means ‘tricky’ I know cause I cannot find any available sample apps/code I could use to learn from. How I know…the people who developed that Meshtastic-Android app are truly amazing. Can’t imagine what they had to go through to make so many features work.

Yeah. The entry level is very high. Try looking on GitHub. If only one could write progs for a smartphone more easily then programming would be more popular. As it is the edifice is so complex. I know that chrome books allow one to run Linux on it in a sort of Linux mode. Problem is then Bluetooth. Interfacing with node is the hardest part. Good luck.

Try here perhaps for similar LoRa projects

https://www.reddit.com/r/Lora/s/A7PSoDKmtt

https://www.reddit.com/r/Lora/s/BW4tDs3my3

Meshtastics ‘wide scope’ its both it strongest feature, and perhaps biggest cause of issues.

Its huge, and covers lots of many different hardware flatforms. Because it kinda tries to a bit of everything it very complex. But that maturity, means lots of things are relatively well developed.

In general is seems might not need the ‘overhead’ of meshtastic, and just need ‘lower level’ LORA based radio communication.

For example just go direct to Arduino on the

has a fairly complete example of two way Lora communication

You could have a small script running on the heltec, that just receives messages over serial, and transmits over lora, plus the reverse.

Then your Android app, just needs to speak the same simple Serial protocol.

Seems you don’t need 99% of the features that meshtestic provides.

1 Like

Thanks for the link. So I looked into LoRaWAN mentioned there for support of far-reaching messages and found the requirement for a router, which can be expensive. Some Internet websites mention pay services or use of free public routers. Pay services or adding the expensive router piece won’t happen with our budget and public routers may not be available close to our school.

I am starting to wonder if the Meshtastic software people would have some test code in form of a buildable Android app that was created for testing send and receive functionalities only without the rest of the massive feature set. So next I may look for a way to contact those amazing people to see if they could share some test app/code that I could use to learn from.

It’s not loraWAN.

Both Meshtastic and Lorawan, are communication systems, built using Lora as the underlying RF commuincation system.

That example, is just using Lora directly. Its interfacing with the Lora chipset on the device directly,and just sending messages to other devices directly.

Its actulyl using ‘radiolib’ is the same library that Meshtastic use to interface with the Lora hardware.

I have been spending time here and there going through all the links suggested. Along with my own search results it is looking impossible for a high schooler to learn to incorporate Meshtastic functionality into a simple Heltec V3 app. I prefer using Meshtastic over the underlying LoRa-only layer because of the low-cost mesh capability (i.e. no gateway needed for long distance comm). Regardless, there is not any usable info we can base on to learn quick enough for a school project so we decided to go with the LoRa-only route. Already got ropg’s LoRa_rx_tx talking between my V3 device and my teammate’s V3 device. And this sample app looks simple enough for us to add our own code if needed. Next step is to take the above advice to learn to use USB Serial in our Android app and also add that to the Heltec V3 code. The whole setup is somewhat less than ideal as originally we thought our Android app could just Bluetooth into the V3 without a physical cable connected…until we learned about the much more complex BLE stuff required by the V3 board. Funny the V2 version was still Bluetooth and would be easier to deal with but well…

Anyway I want to thank you all for your advice, which helpfully discouraged me enough to give up on something (Meshtastic, BLE) that could be much more difficult for a high schooler to learn. And I can’t help but to admire you amazing software people! Thank you all!

2 Likes