I ported my JavaFX application to my Android device. I want my application to read incoming SMS messages and store it in a database. I found several questions here in StackOverflow but I don't know how to implement in a JavaFX approach. Please help!
How to analyze incoming message (JavaFX on Android)
1.3k views Asked by The Well At
1
There are 1 answers
Related Questions in JAVA
- Azure VM: Single disk (filesystem) greater than 1023 GB?
- Backup strategy for build tool hosted on Azure VM
- New-AzureQuickVM not creating VM on exsisting Cloud Service?
- Ping Azure VM in same subnet using VM name
- 'Your credentials did not work' in MS Azure
- Installing Azure powershell in an azure Virtual Machine
- Azure Virtual Network Custom DNS Server
- Extend On-premise AD to Azure
- How can I use Azure-provided DNS for Resource Manager VMs?
- Find out data traffic coming in and going out through azure VM
Related Questions in JAVAFX
- Azure VM: Single disk (filesystem) greater than 1023 GB?
- Backup strategy for build tool hosted on Azure VM
- New-AzureQuickVM not creating VM on exsisting Cloud Service?
- Ping Azure VM in same subnet using VM name
- 'Your credentials did not work' in MS Azure
- Installing Azure powershell in an azure Virtual Machine
- Azure Virtual Network Custom DNS Server
- Extend On-premise AD to Azure
- How can I use Azure-provided DNS for Resource Manager VMs?
- Find out data traffic coming in and going out through azure VM
Related Questions in JAVAFX-2
- Azure VM: Single disk (filesystem) greater than 1023 GB?
- Backup strategy for build tool hosted on Azure VM
- New-AzureQuickVM not creating VM on exsisting Cloud Service?
- Ping Azure VM in same subnet using VM name
- 'Your credentials did not work' in MS Azure
- Installing Azure powershell in an azure Virtual Machine
- Azure Virtual Network Custom DNS Server
- Extend On-premise AD to Azure
- How can I use Azure-provided DNS for Resource Manager VMs?
- Find out data traffic coming in and going out through azure VM
Related Questions in JAVAFX-8
- Azure VM: Single disk (filesystem) greater than 1023 GB?
- Backup strategy for build tool hosted on Azure VM
- New-AzureQuickVM not creating VM on exsisting Cloud Service?
- Ping Azure VM in same subnet using VM name
- 'Your credentials did not work' in MS Azure
- Installing Azure powershell in an azure Virtual Machine
- Azure Virtual Network Custom DNS Server
- Extend On-premise AD to Azure
- How can I use Azure-provided DNS for Resource Manager VMs?
- Find out data traffic coming in and going out through azure VM
Related Questions in JAVAFXPORTS
- Azure VM: Single disk (filesystem) greater than 1023 GB?
- Backup strategy for build tool hosted on Azure VM
- New-AzureQuickVM not creating VM on exsisting Cloud Service?
- Ping Azure VM in same subnet using VM name
- 'Your credentials did not work' in MS Azure
- Installing Azure powershell in an azure Virtual Machine
- Azure Virtual Network Custom DNS Server
- Extend On-premise AD to Azure
- How can I use Azure-provided DNS for Resource Manager VMs?
- Find out data traffic coming in and going out through azure VM
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
Popular Tags
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
These are the required steps to create and port a JavaFX application to an Android device, so you can track SMS messages, allowing:
Step 1
Using Gluon plugin for NetBeans create a new JavaFX project. Let's call it SMSTracker, with main class
org.jpereda.sms.SMSTrackerFX
. Onbuild.gradle
, update the jfxmobile plugin version to b9:First of all let's create
SMSMessage
, a JavaFX pojo with our model:With ScenicBuilder and FXML or by code, create your UI. For this sample, it will be a simple UI with three main areas, for the three above mentioned options.
And this is what we have for now:
Step 2
Following HelloPlatform sample, we will add a
PlatformService
class and aPlatformProvider
interface, with the required services:This interface will be implemented on each of the three platforms (desktop, iOS and Android). Obviously, we'll focus only on the Android implementation.
This is the project view on NetBeans with all the packages and files involved:
Step 3
Let's implement now the services on Android. For that I've followed several great answers at SO: sending SMS, read inbox and listening to incoming SMS.
From the last one, we can crete a class that sets an
ObjectProperty
with anSMSMessage
object every time one is received:In order to launch this listener, we use
FXActivity
, the class that extends the Android Context class and provides the access to the Android services, to register an instance ofSmsListener
:Step 4
Finally, all we need to do is bind the property with our label on the UI and start the broadcast:
Note the use of
Platform.runLater()
to update the label: the broadcast thread is different than the JavaFX thread.Step 5
The last step before building the apk consists on modifying the
AndroidManifest.xml
file to ask for the required permissions.Since the jfxmobile-plugin creates one by default, running
gradlew android
at this stage will generate it. It is located underSMSTracker\build\javafxports\tmp\android
folder.Copy it to another location (
SMSTracker\lib
) and include its reference in thebuild.gradle
file:Now edit the file and add the required permissions and the receiver:
Save, build and run
gradlew androidInstall
to upload the apk to your device.Full project
All the code for this application can be found here, including apk ready to be installed on Android devices.