Files
phonegap-plugins/Android/Resources/README.md
2012-05-24 23:24:26 -07:00

1.2 KiB

Resources plugin for Phonegap (Android)

By Olivier Brand

Adding the Plugin to your project

  1. To install the plugin, move Resources.js to your project's www folder and include a reference to it in your html files.

    <script src="Resources.js"></script>

  2. Create a folder called 'com/phonegap/plugin/resources' within your project's src folder.

  3. And copy the java file into that new folder.

    mkdir -p /src/com/phonegap/plugin/resources
    cp ./ResourcesPlugin.java /src/com/phonegap/plugin/resources
  1. Add a plugin line to res/xml/plugins.xml

    <plugin name="Resources" value="com.phonegap.plugin.resources.ResourcesPlugin" />

Using the plugin


res/values/strings.xml

<?xml version="1.0" encoding="utf-8"?>

    mylogin
    /someuri



	
this.resources = window.plugins.resources.getStringResources({
              'resources': [
                   'base_uri', 'login'
               ],
               'package': 'com.androidapp.app'
 });
 
console.log(this.resources.base_uri);