mirror of
https://github.com/purplecabbage/phonegap-plugins.git
synced 2026-01-14 00:47:54 -05:00
1.2 KiB
1.2 KiB
Resources plugin for Phonegap (Android)
By Olivier Brand
Adding the Plugin to your project
-
To install the plugin, move
Resources.jsto your project's www folder and include a reference to it in your html files.<script src="Resources.js"></script>
-
Create a folder called 'com/phonegap/plugin/resources' within your project's src folder.
-
And copy the java file into that new folder.
mkdir -p /src/com/phonegap/plugin/resources
cp ./ResourcesPlugin.java /src/com/phonegap/plugin/resources
-
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);