1.0.9 • Published 3 months ago

react-native-tone-framework v1.0.9

Weekly downloads
-
License
MIT
Repository
github
Last release
3 months ago

React Native Tone Framework Documentation

Table of Contents

  1. Introduction
  2. Installation
  3. Prerequisites
  4. Platform Setup
  5. Basic Usage
  6. API Reference
  7. Event Handling
  8. Permissions
  9. Advanced Features
  10. Troubleshooting
  11. License

  12. Introduction


The React Native Tone Framework is a specialized module that enables TONE-enabled content sharing and streaming capabilities in React Native applications. It allows businesses to exchange marketing and mobile engagement concepts through audio frequency detection.

Key Features:

  • Audio frequency detection
  • Content sharing
  • Marketing engagement
  • Cross-platform support (iOS & Android)
  • Offline mode support
  • Location-based services
  1. Installation

Install via npm:

npm install react-native-tone-framework

Or using yarn:

yarn add react-native-tone-framework
  1. Prerequisites

  • Client key from Tone Framework official site
  • Android API level 22 or above
  • iOS version 12 or above
  • React Native version 0.59 or above
  1. Platform Setup

iOS Setup: 1. Add required permissions to Info.plist:

<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
<string>We use the location to provide accurate and relative information for users</string>
<key>NSLocationAlwaysUsageDescription</key>
<string>We use the location to provide accurate and relative information for users</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>We use the location to provide accurate and relative information for users</string>
<key>NSMicrophoneUsageDescription</key>
<string>This app requires microphone access to enable voice commands.</string>
  1. Enable Background Modes capabilities for:
  • Microphone usage
  • Location updates

Android Setup: 1. Add permissions to AndroidManifest.xml:

<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
<uses-permission android:name="android.permission.VIBRATE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
  1. Add dependency to build.gradle:
implementation 'com.google.code.gson:gson:2.10.1'
  1. Basic Usage

Import required functions:

import {
  initFramework,
  setClientID,
  requestPermission,
  start,
  stop,
  onToneReceived,
  onToneTag
} from 'react-native-tone-framework';

Basic implementation:

useEffect(() => {
  // Initialize framework
  initFramework();
  
  // Request necessary permissions
  requestPermission();
  
  // Set client ID
  setClientID('your-client-id');
  
  // Start listening
  start();
  
  // Setup listeners
  const toneReceivedListener = onToneReceived((toneData) => {
    console.log('Tone received:', toneData);
  });
  
  const toneTagListener = onToneTag(({ toneTag, isBadCode }) => {
    console.log('Tone tag:', toneTag, 'Is bad code:', isBadCode);
  });
  
  return () => {
    // Cleanup
    stop();
    toneReceivedListener.remove();
    toneTagListener.remove();
  };
}, []);
  1. API Reference

Core Functions:

  • initFramework(): Initialize the Tone Framework
  • setClientID(clientID: string): Set the client identification
  • requestPermission(): Request necessary platform permissions
  • start(): Start tone detection
  • stop(): Stop tone detection
  • restart(): Restart the framework
  • removeListeners(): Remove all event listeners

Offline Mode Functions:

  • enableOfflineMode(): Enable offline functionality
  • disableOfflineMode(): Disable offline functionality
  • downloadOfflineData(): Download data for offline use
  • deleteOfflineData(): Clear offline data

Platform Specific Functions:

  • startReceiver(): Start receiver (Android only)
  • stopReceiver(): Stop receiver (Android only)
  • enableAppleExclusivePermission(): Enable iOS specific permissions
  • disableAppleExclusivePermission(): Disable iOS specific permissions
  • showDefaultToneTagSheet(): Show default tone tag sheet (iOS only)
  1. Event Handling

The framework provides two main event listeners:

onToneReceived:

const listener = onToneReceived((toneData) => {
  // Handle received tone data
});

onToneTag:

const listener = onToneTag(({ toneTag, isBadCode }) => {
  // Handle tone tag data
});
  1. Permissions

The framework requires several permissions:

  • Location (Fine location for Android)
  • Microphone access
  • Notifications (Android)
  • Background mode capabilities (iOS)

Use requestPermission() to handle permission requests:

await requestPermission();
  1. Advanced Features

Offline Mode:

// Enable offline mode
enableOfflineMode();

// Download data for offline use
downloadOfflineData();

// Disable offline mode
disableOfflineMode();

// Clear offline data
deleteOfflineData();

Platform Specific Features:

iOS:

// Enable Apple exclusive permissions
enableAppleExclusivePermission();

// Show default tone tag sheet
showDefaultToneTagSheet();

Android:

// Manage receiver
startReceiver();
stopReceiver();
  1. Troubleshooting

Common Issues:

  1. Framework not initialized:
  • Ensure initFramework() is called before other functions
  • Verify client ID is set correctly
  1. Permissions not granted:
  • Call requestPermission() before starting the framework
  • Check platform-specific permission settings
  1. Events not receiving:
  • Verify listeners are properly set up
  • Check if framework is started
  • Ensure cleanup is handled properly
  1. Platform specific issues: iOS:
  • Verify background modes are enabled
  • Check Info.plist permissions

Android:

  • Verify manifest permissions
  • Check gradle dependencies
  1. License

Proprietary License - TheToneknows Company

This framework is proprietary software owned by TheToneknows Company. Usage of this framework requires a valid license that must be purchased from TheToneknows Company.

License Requirements:

  • Commercial license must be purchased from TheToneknows Company
  • One license per application/implementation
  • License is non-transferable
  • Unauthorized use, reproduction, or distribution is prohibited

To obtain a license, please contact: TheToneknows Company Website: https://thetoneknows.com Email: licensing@thetoneknows.com

For more information and support, visit: https://github.com/Anilkumar18/react-native-tone-framework

1.0.9

3 months ago

1.0.8

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago