Phonegap - Upgrading to 3.0 API Feature Issues

Working with Windows using Phonegap 3.0, the Android platform, debugging in Eclipse.

I managed to build my old application, but I encountered a new problem when I try to use a function that is now a plugin.

I added all the plugins that I need with the CLI tool and added the "function" data to the config.xml file, so I assume that they are available for calling. Permissions are also set in the manifest file.

Filetransfer

I see that the code example of the file transfer API has not changed for version 3.0, so I left the same code in my code. This way the file will be downloaded, but then I get an error message that causes my application to crash.

" D/CordovaLog(12883): file:///android_asset/www/phonegap.js: Line 932 : Uncaught Error: Error calling method on NPObject! " 

I searched for this error and doesn't seem to be the standard solution?

Perhaps there is a new way to call functions that are inside plugins? Because I cannot play the audio file without receiving errors. The sound file will play, but will lead to errors.

 " 09-01 20:13:17.274: W/PluginManager(13279): THREAD WARNING: exec() call to Media.startPlayingAudio blocked the main thread for 23ms. Plugin should use CordovaInterface.getThreadPool(). " 

I re-read the media API and there is no mention of a thread pool. I do all my programming in javascript.

Basically, when I use the plugin function, the application has serious errors. I tried to use the sound recording function in my earlier working application, and when I call a stop for my recording, it gives an error message

 " 09-01 20:10:04.206: E/AudioPlayer(13279): FAILED renaming /mnt/sdcard/tmprecording.3gp to /sdsub/myapp/Recorded/myRecording.amr " 

I tested the transfer of api files again via the file delete function, and also failed

 " 09-01 20:16:00.884: W/PluginManager(13279): THREAD WARNING: exec() call to File.remove blocked the main thread for 19ms. Plugin should use CordovaInterface.getThreadPool(). " 

It seems that the essential nature of the function has changed, but is not documented anywhere. It seems that the API calls have not changed compared to the older versions, just how you install the API functions are different, but I followed this guide and installed them.

Is there a new API I missed? because the Phonegap API documentation has not changed for how these functions are called in version 3.0.

Thanks.

my configuration file

 <feature name="App"> <param name="android-package" value="org.apache.cordova.App" /> </feature> <feature name="NetworkStatus"> <param name="android-package" value="org.apache.cordova.networkinformation.NetworkManager" /> </feature> <feature name="File"> <param name="android-package" value="org.apache.cordova.file.FileUtils" /> </feature> <feature name="FileTransfer"> <param name="android-package" value="org.apache.cordova.filetransfer.FileTransfer" /> </feature> <feature name="Media"> <param name="android-package" value="org.apache.cordova.media.AudioHandler" /> </feature> <feature name="Notification"> <param name="android-package" value="org.apache.cordova.dialogs.Notification" /> </feature> <feature name="SplashScreen"> <param name="android-package" value="org.apache.cordova.splashscreen.SplashScreen" /> </feature> <feature name="Compass"> <param name="android-package" value="org.apache.cordova.deviceorientation.CompassListener" /> </feature> 

my manifest file

 <uses-permission android:name="android.permission.READ_PHONE_STATE" /> <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.RECORD_AUDIO" /> <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" /> <uses-permission android:name="android.permission.INTERNET" /> 
+6
source share
1 answer

when updating your application, the phonegap.js file must support the entire functional script. you can use a suitable version of the javascript file, for example, phonegap.0.9.5.js or a higher version. Perhaps this is due to the fact that phonegap.js does not contain the necessary functions necessary for the application. If you see the API, they have .XYZjs phone delay. so you can try higher

0
source

Source: https://habr.com/ru/post/952992/


All Articles