Visit the free getting started tutorials on nativescript.org for JavaScript or Angular.
Kindly note that we filter out plugins that:
package.json
$ tns plugin add nativescript-fortumo-sms
A NativeScript module providing access to Fortumo SMS Gateway.
MIT license
Run
tns plugin add nativescript-fortumo-sms
inside your app project to install the module.
Keep sure to define the following permissions, activities and other data in your manifest file:
<?xml version="1.0" encoding="UTF-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android"> <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <!-- Open Stores --> <uses-permission android:name="org.onepf.openiab.permission.BILLING" /> <!-- Google --> <uses-permission android:name="com.android.vending.BILLING" /> <!-- Nokia --> <uses-permission android:name="com.nokia.payment.BILLING" /> <!-- Samsung --> <uses-permission android:name="com.sec.android.iap.permission.BILLING" /> <!-- Fortumo --> <uses-feature android:name="android.hardware.telephony" android:required="false" /> <uses-permission android:name="android.permission.RECEIVE_SMS" /> <uses-permission android:name="android.permission.SEND_SMS" /> <uses-permission android:name="android.permission.READ_PHONE_STATE" /> <!-- SlideME --> <uses-permission android:name="com.slideme.sam.manager.inapp.permission.BILLING" /> <!-- Skubit --> <uses-permission android:name="com.skubit.BILLING" /> <application> <!-- Amazon --> <receiver android:name="com.amazon.device.iap.ResponseReceiver"> <intent-filter> <action android:name="com.amazon.inapp.purchasing.NOTIFY" android:permission="com.amazon.inapp.purchasing.Permission.NOTIFY" /> </intent-filter> </receiver> <!-- Amazon --> <!-- Fortumo --> <receiver android:name="mp.MpSMSReceiver"> <intent-filter> <action android:name="android.provider.Telephony.SMS_RECEIVED" /> </intent-filter> </receiver> <service android:name="mp.MpService" /> <service android:name="mp.StatusUpdateService" /> <activity android:name="mp.MpActivity" android:configChanges="orientation|keyboardHidden|screenSize" android:theme="@android:style/Theme.Translucent.NoTitleBar" /> <!-- Fortumo --> </application> </manifest>
For quick start have a look at the demo/app/main-view-model.js file of the demo app to learn how it works.
Otherwise ...
Include the module in your code-behind:
var FortumoSMS = require('nativescript-fortumo-sms');
Initialize the environment:
function onPageLoaded(args) { FortumoSMS.init(); } exports.onPageLoaded = onPageLoaded;
The (optional) object that is submitted to the PayPal.init function has the following structure:
PayPal.init
198612227
function buyProduct(args) { // configure var purchase = FortumoSMS.newPurchase() .setId('<PRODUCT-ID>') .setName('test product') .setSecret('<APP-SECRET>') .setDisplayName('A test product') .setAmount('1.95') .setCurrency('USD'); // start purchase purchase.start(function(cbResult) { switch (cbResult.code) { case 0: // SUCCESS break; case 1: // CANCELLED break; case 2: // FAILED break; case 3: // PENDING break; case -1: // "unhandled exception" break; } }); } exports.buyProduct = buyProduct;
The purchase object that is created by FortumoSMS.newPurchase function has the following structure.
purchase
FortumoSMS.newPurchase
var c = purchase.isConsumable();
var a = purchase.getAmount();
var m = purchase.getCreditsMultiplier();
var c = purchase.getCurrency();
var id = purchase.getId();
var n = purchase.getName();
var s = purchase.getSecret();
payment.setAmount('1.25');
purchase.setCreditsMultiplier(1.23);
purchase.setCurrency('USD');
purchase.setId('<PRODUCT-ID>');
purchase.setIfConsumable(true);
purchase.setName('My product');
purchase.setSecret('<APP-SECRET>');
The callback that is submitted to the purchase.start method receives an object with the following properties:
purchase.start
code
0
-1
1
2
3
If you want to get the logging output of the module, you can use FortumoSMS.addLogger function to add a callback that receives a message from the module:
FortumoSMS.addLogger
FortumoSMS.addLogger(function(msg) { console.log('[nativescript-fortumo-sms]: ' + msg); });
Popularity metric based on:
Quality metric based on:
Maintenance metric based on: