apla/me.apla.cordova.app-preferences

Can I specify a specific file for preferences for Android?

Closed this issue · 2 comments

pke commented

I'm migrating a titanium app to cordova and titanium app preferences are saved in:
/data/data/com.domainname.appname/shared_prefs/titanium.xml

is there a way to read this file with this plugin?

apla commented

Android have two possible calls to get shared preferences — default preferences and named ones. I've just added (commit e56013a) possibility to work with named preferences on Android. I'm not sure about titanium preferences format and my code is untested, but you can try. Usage:

var appPrefs = plugins.appPreferences;
var titaniumPrefs = appPrefs.suite('titanium');
titaniumPrefs.fetch()

@benjaminpetrin hacked preference reading in his fork to do similar task: https://github.com/getadored/me.apla.cordova.app-preferences/commit/32893cf05adeec4fc7b6eaf4c66ce16bf5467306

apla commented

There is a wiki page about that functionality: Suites