#1 2016-11-02 11:15:05

reg4app
Member
Registered: 2016-05-16
Posts: 147

How to record audio from the device's microphone

A simple android project for recording by the phone's Mic,and generate mp3 format file
In AB,Where should I begin with?


Cordova is already installed.

neutral and neutral


Joshua.Y

Offline

#2 2016-11-02 11:20:18

David
Admin
From: Alcobendas, Madrid, Spain
Registered: 2015-04-21
Posts: 1,657
Website

Re: How to record audio from the device's microphone

Hello Joshua,

Currently we are talking about the usage of one or more Cordova's plugin. Take a look here, here and here and ask here if you need any further help.

The main problem can be to deal with the files resulting of the record. Maybe we can easily deal with it if we can convert into their Base64 representation, however, probably some files, due to their large size, have problems while converting to Base64. So maybe we need to use at least a couple of plugins: one for recording and one for deal with the recording files.

Maybe if you explain a little more what's you wanted Joshua...

Offline

#3 2016-11-03 03:38:25

reg4app
Member
Registered: 2016-05-16
Posts: 147

Re: How to record audio from the device's microphone

I try to follow this guy's blog
and Set the AB cordova's Custom plugins:cordova-plugin-media-capture
now how can I use the 'media-capture' in AB??


Joshua.Y

Offline

#4 2016-11-03 07:46:55

David
Admin
From: Alcobendas, Madrid, Spain
Registered: 2015-04-21
Posts: 1,657
Website

Re: How to record audio from the device's microphone

Hello Joshua,

It's a combination of external Javascript usage with the Cordova's plugins usage. We have some app samples that deal with these fields: External, CordovaPlugins and SendSMS. Please take a look and ask if you need any further help Joshua.

Offline

#5 2016-11-03 08:44:04

reg4app
Member
Registered: 2016-05-16
Posts: 147

Re: How to record audio from the device's microphone

For testing my first android Project
Are there some links to let me learn how to compile my AB project in Cordova?


Joshua.Y

Offline

#6 2016-11-03 08:51:33

David
Admin
From: Alcobendas, Madrid, Spain
Registered: 2015-04-21
Posts: 1,657
Website

Re: How to record audio from the device's microphone

Hello Joshua,

reg4app wrote:

For testing my first android Project
Are there some links to let me learn how to compile my AB project in Cordova?

Sure. Take a look at this forum's thread and, in particular, to this step by step tutorial. You will not regret: once installed Apache Cordova you can compile and even run an APK in seconds.

Offline

#7 2016-11-03 09:13:40

reg4app
Member
Registered: 2016-05-16
Posts: 147

Re: How to record audio from the device's microphone

Apache Cordova can run an Apk directly!?


Joshua.Y

Offline

#8 2016-11-03 09:17:11

David
Admin
From: Alcobendas, Madrid, Spain
Registered: 2015-04-21
Posts: 1,657
Website

Re: How to record audio from the device's microphone

Hello Joshua

reg4app wrote:

Apache Cordova can run an Apk directly!?

Not exactly. Apache Cordova + Android SDK build our application and then install and run in an USB connected device, for example. We can also get only the APK and copy it to our device; or may we can use the Android SDK emulator. I think the first way (connect a device via USB) can be the best option.

Offline

#9 2016-11-03 09:50:53

reg4app
Member
Registered: 2016-05-16
Posts: 147

Re: How to record audio from the device's microphone

1.Creating a Cordova project
2.Delete the contents of the www folder
3.Copy contents of the AB Compiled www-folder into Cordova project's www folder
5.install the Cordova plugins
4.compile with Cordova

Are these steps correct!?


Joshua.Y

Offline

#10 2016-11-03 10:01:09

David
Admin
From: Alcobendas, Madrid, Spain
Registered: 2015-04-21
Posts: 1,657
Website

Re: How to record audio from the device's microphone

Hello Joshua,

What you must do is to install Apache Cordova and the Android SDK. Once you are ready, you can use the App Builder app's options to create (AB does for you) the appropiate Cordova's configuration file. App Builder also creates for you various "BAT" files, that you can directly run in order to get the application compiled and running in a connected device.

You only need to do that: run the appropiate "BAT" file, which include instructions to create the Cordova's project, etc. In order to use Apache Cordova's plugins (not included out-of-the-box) we commonly only need to specify the plugin's ID in the app's options dialog: you can take a look at the "CordovaPlugins" and "SendSMS" samples.

Wt8xMQA.png

Offline

#11 2016-11-03 10:42:24

reg4app
Member
Registered: 2016-05-16
Posts: 147

Re: How to record audio from the device's microphone

OK!
App Builder also creates
cordova_android_debug.bat
cordova_android_release.bat
cordova_android_run.bat
what is the purpose of these file?


Joshua.Y

Offline

#12 2016-11-03 10:44:52

David
Admin
From: Alcobendas, Madrid, Spain
Registered: 2015-04-21
Posts: 1,657
Website

Re: How to record audio from the device's microphone

Hello Joshua,

Take a look a this forum's thread, since probably you also want to know (in the near future) how to deploy an APK in the Google Store, in particular, how to sign the APK file in order to upload it into the Google Store. wink

Basically:

1º The Debug BAT can be used to get an APK to be tested in one or more devices.

2º The Release BAT can be used once we are ready to deploy our application in the Google Store.

3º The Run Bat can be used to directly build, install and run the application into a connected device or emulator.

Offline

#13 2016-11-04 08:00:15

reg4app
Member
Registered: 2016-05-16
Posts: 147

Re: How to record audio from the device's microphone

now I am running the 'cordova_android_run.bat',downloading tons of files....for an hour
and it is still continuing...!
roll


Joshua.Y

Offline

#14 2016-11-04 08:45:52

David
Admin
From: Alcobendas, Madrid, Spain
Registered: 2015-04-21
Posts: 1,657
Website

Re: How to record audio from the device's microphone

Hello Joshua,

reg4app wrote:

now I am running the 'cordova_android_run.bat',downloading tons of files....for an hour
and it is still continuing...!
roll

The first time we execute Cordova they download some of their dependencies like "Gradle". This can take a while, in particular if our internet connection is not too fast. The first apps build also requires more time than the next, since things like plugins are downloaded only one time. A more or less better computer also help with Apache Cordova.

Just a few months ago I change my old computer (about seven or eight years old) to other one, not too much expensive but better than the first one: I note how Cordova (and in general any other program of course) works like a charm on the new computer. Maybe just more RAM can helps too Joshua...

Offline

#15 2016-12-16 09:13:14

reg4app
Member
Registered: 2016-05-16
Posts: 147

Re: How to record audio from the device's microphone

after a mess of busy work,now continuing this study project!
and I finally figure out why my phone does not work with adb....

just make a mark

big_smile and big_smile


Joshua.Y

Offline

#16 2016-12-16 11:04:00

David
Admin
From: Alcobendas, Madrid, Spain
Registered: 2015-04-21
Posts: 1,657
Website

Re: How to record audio from the device's microphone

Hello Joshua,

Just let me know if you need any further help with this. smile

Offline

#17 2016-12-19 08:42:59

reg4app
Member
Registered: 2016-05-16
Posts: 147

Re: How to record audio from the device's microphone

I include 'cordova-plugin-media-capture' in app option

create a function captureImage

var options = { limit: 3 };

navigator.device.capture.captureImage(captureSuccess, captureError, options);

and put a button to call this function

after build the project
It is installed on my phone,but i press the button,without a response....!


Joshua.Y

Offline

#18 2016-12-19 08:47:22

David
Admin
From: Alcobendas, Madrid, Spain
Registered: 2015-04-21
Posts: 1,657
Website

Re: How to record audio from the device's microphone

Hello Joshua,

What about "captureSuccess" and "captureError"? This must be functions callbacks that must exists. If they are application's functions then we must refer to it with something like this:

navigator.device.capture.captureImage(
 window.App.Scope.captureSuccess, 
 window.App.Scope.captureError, 
 options);

However, if you want to use the "captureImage" method... why not directly uses the Apache Cordova's Camera plugin, which is "out-of-the-box" in App Builder? You can take a look at the included "Camera*" samples.

Offline

#19 2016-12-19 09:34:14

reg4app
Member
Registered: 2016-05-16
Posts: 147

Re: How to record audio from the device's microphone

Oh,yeah!
David ,you were right,missing "captureSuccess" and "captureError" function
now it can call the camera!


Joshua.Y

Offline

#20 2016-12-19 09:41:15

David
Admin
From: Alcobendas, Madrid, Spain
Registered: 2015-04-21
Posts: 1,657
Website

Re: How to record audio from the device's microphone

Hello Joshua,

Glad to know you got it! But please, don't hesitate to post here if you need any further help. Certainly, if what we wanted is an image, probably we no need the Media Capture plugin, but the Camera plugin, which is included "out-of-the-box" in App Builder.

On the other hand, maybe an "Input File" controls is enough if what we wanted is a picture from the device. In this last case our application can work perfectly out of the Apache Cordova platform. Various "Camera*" and "ImagePick*" samples exists.

The problem with capturing video or audio is the way in which we must deal with the device's files. This implied not only the usage of the Media Capture plugin, but probably we need to deal also with the Cordova's Files and FileTransfer plugins.

In fact it's possible to do that, even when this plugins are not included "out-of-the-box" in App Builder, because we can always usess non included plugins and pure Javascript code in our applications.

So please Joshua, don't hesitate to post here if you need any further help.

Offline

#21 2016-12-19 09:43:27

reg4app
Member
Registered: 2016-05-16
Posts: 147

Re: How to record audio from the device's microphone

Ok,Thanks for the hints,will check out


Joshua.Y

Offline

Board footer

Powered by FluxBB


Copyright ©2018 DecSoft. All rights reserved.