Git Product home page Git Product logo

assisted-navigation's Introduction

InternetSaathi\onboarding-sdk

Installing Onboarding SDK

In order to install the SDK add the following in your build.gradle file:

	android {
	    compileOptions {
	        sourceCompatibility JavaVersion.VERSION_1_8
	        targetCompatibility JavaVersion.VERSION_1_8
	    }
	}

	dependencies {

	        implementation 'com.frend:assistednavigation:0.1.1'
	}

First of all, you need to allow your application to have access to the internet and define its name. In your AndroidManifest.xml file, add the following:

<manifest
  ...
  >
  
	<uses-permission android:name="android.permission.INTERNET" />
	<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
	<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
</manifest>

In your Application class, initialize the SDK with your Parse application, journey, languageCode:

public class App extends Application {

  // Initializes SDK as soon as the application is created
  @Override
  public void onCreate() {
    super.onCreate();


    CustomAssistant.init(this, journey , languageCode);

  }
}

After creating our Application class, we need to define its name on the AndroidManifest.xml file, as follows:

<manifest package="<YOUR_PACKAGE_NAME>"
  ...
  >
  <application
    android:name=".App"
    ...>
    ...
  </application>

To download the audio files, add the following in Main/Starting activity. Make sure you are requesting for WRITE_EXTERNAL_STORAGE permissions before downloading the audio:

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        if (ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE) == PackageManager.PERMISSION_DENIED) {
            ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, 100);
        }
        CustomAssistant.offlineDownload(this);
    }
}

Further, store config file in json format in the assets folder

Format :

{
  "languageCode": {
    "journey": {
      "pulse": true,
      "showOnlyWhenAudio": true,
      "journey": [
        {
          "text": "Text_to_be_displayed",
          "audioUrl": "Url_of_the_audio_file",
          "activity": "name_of_the_activity",
          "view": "name_of_the_view",
          "audioPath": "name_of_audio_file_store_in_raw_folder"
        }
      ]
    }
  }
}

Example :

{
  "en": {
    "on_boarding": {
      "pulse": true,
      "showOnlyWhenAudio": true,
      "journey": [
        {
          "text": "Click here to Select English Language",
          "audioUrl": "https://ypvnxx00-a.akamaihd.net/mp3/f-tc-49360.mp3",
          "activity": "MainActivity",
          "view": "english_text_view",
          "audioPath": "english"
        }
      ]
    }
  }
}

Note : Audio's to be played locally should be stored in raw folder of the application.

assisted-navigation's People

Contributors

sohammondal1 avatar

Watchers

James Cloos avatar Soham Mondal avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.