Creating apps using Phonegap Builder and integrating the Cordova SMS Plugin

I am looking to create an app using Phonegap with the Adobe Phonegap Builder on . Specifically, I want to utilize the Plugin for sending SMS messages.

In my config.xml file, I have added:

<gap:plugin name="com.cordova.plugins.sms" version="0.1.2" />

The Adobe PhoneGap Builder recognizes this plugin as integrated.

Next, I downloaded and included /www/sms.js from https://github.com/cordova-sms/cordova-sms-plugin/tree/48d9630 and linked it in the index.html

I then created a JavaScript function similar to the one provided on Git:

var message = "Testing SMS by sending it to ";
var options = {
    replaceLineBreaks: false,
    android: {
        intent: 'INTENT' 
    }
 };

var success = function () { 
    alert('Message sent successfully'); 
};

var error = function (e) { 
    alert('Message Failed:' + e); 
};

sms.send("MY Handy number", "sms", options, success, error);

I came across a suggestion in another post to replace

var exec = require('cordova/exec'); 

with

var exec = cordova.exec

However, this did not resolve the issue.

Answer №1

Alright, I have managed to rectify the issue.

The first step is to include the JavaScript files in the specified order.
It is crucial that the file sms.js does not exist.

In the config.xml file, you need to add:

And that's all there is to it. :)

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

How to find the length of an array in Node.js without utilizing JQuery

Is it possible to determine the length of the Dimensions array in nodejs? The array can have 1 or 2 blocks, and I need to write an if condition based on this length. Since this code is inside an AWS-Lambda function, using JQ may not be an option. For exam ...

What is the best approach: Loading all database results at once or making multiple requests?

Looking to refine a vast database with these specific columns: Name - Maximum Height - Minimum Height - Range - Maximum Angle - Minimum Angle The goal is to filter the data based on user-inserted criteria, such as if a user inputs a maximum height of 80c ...

Cordova on iOS experiences an immediate error and HTTP status code of 0 when attempting an Ajax call, resulting in a failure with

For the past 3 weeks, I have been struggling with an issue that seems to have no solution. The problem occurs when using Cordova, as my ajax calls return immediately after being triggered. The error message appears right below the sending message in the lo ...

The parameter of type 'never' cannot be assigned with the argument of type 'number | boolean | undefined'

In my project, I am creating a validation input using TypeScript in Next.js. interface InputRules { required?: boolean min?: number max?: number minLength?: number maxLength?: number } I have defined an object that contains methods to handle val ...

Execute the onBackpress function in Flutter using code

Is there a way to trigger the backpress function (onWillPop) in Flutter programmatically? In Android Native development, I would typically achieve this by calling a function to simulate a backpress click. this.onBackPressed(); Within my app, the onBackP ...

React-select allows for multiple selections within a component when the onChange function

I am currently utilizing react-select. Per the official documentation, it recommends using 'isMulti' to select more than one option. Below is the custom component that I have created. import React from 'react'; import { Form } from &ap ...

Middleware designed for logging in React, akin to Multer in the realm of Express JS

Currently developing a React application that involves multiple API calls. I am exploring the possibility of integrating a middleware to intercept and log all these calls, similar to how Multer functions in an Express server. I am also curious if there is ...

Storing data efficiently with Angular 2's local storage service

I am attempting to create a ToDoList using localstorage within a service. add.component.ts export class AddComponent implements OnInit { item: Item[]; constructor( private router: Router, private itemService: ItemService) { } ...

Data obtained from the server includes JSON objects along with quotes and regular expressions

While analyzing the functionality of a search page server through element inspection, it was observed that requests are sent via POST with JSON parameters. To verify this observation, I recreated the same POST request using Insomnia with identical paramete ...

Transforming an image object into a File object using Javascript

My goal is to utilize HTML5 on the client side in order to convert an "image object" into a "File object" for uploading to azure blob storage. I am working with AngularJs and my approach involves: Converting the image to a file Uploading the file to blob ...

Interpret data from an external JSON file into a HighCharts chart using JavaScript

Currently, I am exploring the process of incorporating HighCharts Chart data directly within the actual webpage. Below is the complete code snippet: <!DOCTYPE html> <html><head> <script type="text/javascript" src="http://code.jquery. ...

Best practices for integrating Volley with Android development to maintain clean code and handle callback issues

Currently, my Android application has functional code using Volley. However, due to callbacks, the cleanliness of my code is compromised. Two key functions in my code are: private void updateSettings() { ... HTTP.requestObject(Request.Method. ...

Is it possible to retrieve an array using axios?

Currently, I am exploring computed properties in Vue.js. One of the computed methods I am working on involves making a request to an axios API to retrieve an array after applying some logic within the promise. computed: { filteredTrips: function () { ...

Navigation bar with a full-page slider

I am trying to incorporate my bootstrap nav bar into a full-width slider, similar to the layout in this example. https://i.sstatic.net/LE9wP.jpg This is the full width slider http://codepen.io/grovesdm/pen/MazqzQ Currently, I have positioned the nav ba ...

Displaying interactive charts in a pop-up window using Highcharts within a Bootstrap

I am looking to display a highchart inside a popover. Check out my code in this jsfiddle http://jsfiddle.net/hfiddle/abpvnys5/47/. Here is the HTML: <ul class="stat_list" style="float: left;"> <a data-toggle="popover" data-trigger="hover ...

What is the best way to retrieve a service response prior to component initialization in Angular 4?

My service sends a request to an API, and based on the response, I need to decide whether a component should be loaded or not. However, due to the delay in receiving the response, the component loads regardless of the response status. After about 0.5 secon ...

Looking for a single solution to have my background image in CSS cover the entire screen on both my computer and cell phone

I used the following code in my demo .html file: body{ background-image: url('https://i0.wp.com/www.socialnews.xyz/wp-content/uploads/2020/10/26/5573c6f0bee7ca021f4a8aecbaf6cbeb.jpg?quality=80&zoom=1&ssl=1'); -webkit-backgroun ...

Encountering Errors when Transitioning a Standard React Component to TypeScript

I am currently in the process of migrating https://github.com/catalinmiron/react-typical to TypeScript. However, I am encountering some challenges. Below is a screenshot depicting the errors in VSCode: https://i.sstatic.net/IKZK2.png Here is the same co ...

Filtering Gmaps markers using angular and javascript: A step-by-step guide

This code is designed to show markers on a map based on selected dates. Only the markers created during the chosen time period will be visible. I am monitoring a value from an external JavaScript script called obj.dateRangeSlider("values"). as shown belo ...

What is preventing us from assigning the jquery selector object to a different object's property for later use?

I'm facing an issue in the code below where I am trying to assign a jQuery selector object to another object property but it's not functioning as expected. Can you help me identify what mistake I might be making? index.html <html lang="en"&g ...