Question Detail

Hi,

I am looking for app where we can directly dial a number through app.

While calling we have to record that call after recording done we need to upoad the file to server.

Thanks


Thread Reply

alex levine

- 6 months ago

First of you have to set runtime permission in Native Android Java file to ask permission to dial to conact without any issue

if (ContextCompat.checkSelfPermission(this, Manifest.permission.CALL_PHONE) != PackageManager.PERMISSION_GRANTED) {
    ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.CALL_PHONE}, 465);
}

 

and put it on Manifest file

<uses-permission android:name="android.permission.CALL_PHONE" />

 

put below code in your Call button clickListener

Intent intents = new Intent(Intent.ACTION_CALL);
intents.setData(Uri.parse("tel:9800000000"));
startActivity(intents);

Anonymous

- 5 months ago

Thanks For your reply.

I am done with all my issues and i am facing only one issue that i have a media file type audio/wav.

so i want to upload the file from my phone's local storage to server.

what i am using is cordova.

Plugin for cordova is : 

cordova-plugin-file-transfer 

My uploading code is :

function uploadVoice(fileName, dirName) {
    
   var fileURL = fileName;
   var uri = encodeURI("https://www.nimsedu.org/upload.php");
   var options = new FileUploadOptions();
   options.fileKey = "file";
   options.fileName = fileURL.substr(fileURL.lastIndexOf('/')+1);
   options.mimeType = "audio/wav";
   
   var headers = {'headerParam':'headerValue'};
   options.headers = headers;
   var ft = new FileTransfer();
   ft.upload(fileURL, uri, onSuccess, onError, options);
}

 

PHP Code that i am using:

// Where the file is going to be placed
$target_path = "records/";

/* Add the original filename to our target path.
Result is "uploads/filename.extension" */
$target_path = $target_path . basename( $_FILES['file']['name']);

if(move_uploaded_file($_FILES['file']['tmp_name'], $target_path)) {
    echo "The file ".  basename( $_FILES['file']['name']).
    " has been uploaded";
} else{
    echo "There was an error uploading the file, please try again!";
    echo "filename: " .  basename( $_FILES['file']['name']);
    echo "target_path: " .$target_path;
}