Reading and writing text files

The following lines are the only occurances of ‘id’ in volbuilder.log, {id} is not present.

id: 1 or "android-29"
     Name: Android API 29
     Type: Platform
     API level: 29
     Revision: 5
----------
id: 2 or "android-30"
     Name: Android API 30
     Type: Platform
     API level: 30
     Revision: 3
----------
id: 3 or "android-32"
     Name: Android API 32
     Type: Platform
     API level: 32
     Revision: 1
----------
id: 4 or "android-33"
     Name: Android API 33, extension level 3
     Type: Platform
     API level: 33
     Revision: 3
----------
id: 5 or "android-34"
     Name: Android API 34, extension level 7
     Type: Platform
     API level: 34
     Revision: 3

What do you mean by ‘Download’? I didn’t see this option in cordova-plugin-file - npm. I copied and pasted the Json text into my app. Is there also an example with basic code?

Now I found the following line in volbuilder.log:
id is com.nsbasic.Project1

Have a look in Project Properties, in the VoltBuilder tab. There is a property named config.xml. What is in it?

<?xml version="1.0" encoding="UTF-8"?>
<widget 
xmlns="https://www.w3.org/ns/widgets"
id = "com.nsbasic.{id}"
android-versionCode = "{phoneGapBuildCounter}"
ios-CFBundleVersion = "{phoneGapBuildCounter}"
version = "{version}">

<name>{title}</name>
<description>{description}</description>

<icon src='resources/iconTemplate.png' />
<!-- preference name='SplashScreenDelay' value='2000' /> -->
<!-- preference name='AutoHideSplashScreen' value='true' /> -->
<!-- preference name='AndroidWindowSplashScreenAnimatedIcon' value='resources/splashTemplate.png' /> -->
<!-- preference name='AndroidWindowSplashScreenBackground' value='{splashBackground}' /> -->
<!-- plugin name='cordova-plugin-splashscreen' source='npm' /> -->

<preference name="permissions" value="none"/>
<!-- sample preference specifications -->
<!-- <preference name="autorotate" value="false" readonly="true"/> -->
<!-- <preference name="orientation" value="default" /> -->
<!-- <preference name="fullscreen" value="true" /> -->

<plugin name="cordova-plugin-device" source="npm"/>

<plugin name="cordova-plugin-file@8.0.0" source="npm"/>
  <preference name="AndroidPersistentFileLocation" value="Internal"/>

<config-file target="AndroidManifest.xml" parent="/*" xmlns:android="http://schemas.android.com/apk/res/android">
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" android:maxSdkVersion="28" />
</config-file>

<plugin name="cordova-plugin-statusbar" source="npm" />
  <preference name="StatusBarOverlaysWebView" value="{phoneGapStatusBarOverlay}" />
  <preference name="StatusBarBackgroundColor" value="{phoneGapStatusBarColor}" />
  <preference name="StatusBarStyle" value="{phoneGapStatusBarStyle}" />

  <allow-navigation href="*" />
  <access origin="*" />
  <allow-intent href="*" />

<plugin name="cordova-plugin-wkwebview-engine" source="npm" />
<platform name="ios">
  <preference name="WKWebViewOnly" value="true" />
  <feature name="CDVWKWebViewEngine">
    <param name="ios-package" value="CDVWKWebViewEngine" />
  </feature>
  <preference name="CordovaWebViewEngine" value="CDVWKWebViewEngine" />
</platform>

</widget>

That what I was looking for! See the {id} in the 4th line? The title of your app gets substituted there when the app is build. It should uniquely identify your app.

If you have two apps with different titles, they should install fine at the same time on a device, as two different apps.

okay, I put a unique {id} in config.sys in the voltbuilder section of properties and now I have 2 different apps. Thanks for your advices!

But my read/write problem is not solved. I want to install my app on 2 different Android devices and make the data collected from one device available to the app on the other device. Can the Cordova plugin file do this? If not, is there any other solution to my problem?

An app can write to the file system of the device it is running on using the Cordova plugin.

However, it cannot write to the file system of another device. You’ll need to set up some sort of communication between the devices or back to a shared server.

I set up some a communication between the devices (via Dropbox), that is not the problem. I got the example of the Cordova plugin to work, but only for files in the sandbox. What do I have to do to write to the ‘normal’ file system? Nobody other than the app itself can access the sandbox files (apart from the OS), right? If I specify a filename to read: “/abc/xyz/…” I get the error code INVALID_MODIFICATION_ERR from ‘fileSystem.root.getFile’.

I saw tech note:Google drive API.appstudio can read and write and save spreadsheets.i don’t know whether this works for u?cheers,tst

Thanks for your advice. I read that this only works if the app runs on a server, what I don’t want.

My ‘write text to public area of ​​my device’ problem is not solved. George, you said that the cordova file plugin was downloaded 50,000 times in 1 week. I’m surprised that no one in the forum can help me or tell me that what I want to do cannot be done with it.

@nzbnzbnzb - We provide support here for AppStudio, which was developed by us. We know all about it.

Cordova plugins are developed by other companies, not us. We do not know enough about these plugins to give the level of support we like to give. Plus, there are thousands of them.

We occasionally provide help with software that is not ours, but on paid support basis. If you’re interested, contact us at support@appstudio.dev.