Integrate video into your recruitment solution and enhance the decision making process for employers. To obtain required credentials please visit myInterview.com.
The SDK supports all Android versions starting from API 19 (KitKat).
Just put inside your application level build.gradle:
dependencies {
implementation 'com.myinterview:myinterview-sdk-android:1.0.0'
}
There are main classes that are responsible for configuration: Configuration
, FlowConfiguration
, PracticeFlowConfiguration
and Question
.
Configuration
keeps flow configurations. It can contain two fields:
normalFlowConfiguration
is instance ofFlowConfiguration
class with configuration for widget.practiceFlowConfiguration
is instance ofPracticeFlowConfiguration
class that contains list of questions for practice. Optional field.
Question
contains required info about target question.
The example of creating instance Question
class:
Question.Builder().build {
title = String
text = String
durationSecs = Int
attempts = Int
}
Fields:
-
title - question subject
-
text - the full question text
-
duration - the maximum amount of time in seconds that given for user to record the answer
-
attempts - number of attempts to record the answer
The example of creating instance of FlowConfiguration
class:
FlowConfiguration.build {
apiKey = String
jobId = String
username = String
email = String
questions = List<Question>
preparationTimeSecs = Int
showQuestions = Boolean
}
Configuration fields:
-
apiKey - API key to connect with MyInterview services. To obtain apiKey please visit myInterview.com.
-
jobId - if company has several open vacancies, this one could be vacancy id. Optional field.
-
username - username of the user that is going to answer interview questions. Optional field.
-
email - email of the user that is going to answer interview questions. Optional field.
-
questions - List of questions
-
preparationTimeSec - time in seconds to allow user prepare for answering the question before recording will start.
-
showQuestions - switch between interview and normal mode. In interview mode user has preparationTimeSec to prepare for answering before recording will start. In normal mode this parameter preparationTimeSec is ignored.
The PracticeFlowConfiguration
requires only one parameter - list of Question
. The list of Question
will be used to display during user practicing.
The full example of creating configuration for MyInterview widget:
Configuration.build(context) {
normalFlowConfiguration = FlowConfiguration.build {
preparationTimeSecs = 15
showQuestions = isShowQuestions
apiKey = API_KEY
questions = Arrays.asList(
Question.Builder().build {
title = "Introduce yourself"
text = "Example: Hello my name is [Your Name] and " +
"have been a [Profession] for [Number of] years.\n" +
"One more line.\n" +
"And this one too."
tips = "The introduction is your opportunity to make a good first impression."
durationSecs = 61
attempts = 10
},
Question.Builder().build {
title = "What is your experience?"
text = "Give some examples of your work/ study/ life experiences " +
"(During my time at... I was able to... meaning I can now... for you)."
durationSecs = 60
attempts = 2
}
)
}
practiceFlowConfiguration = PracticeFlowConfiguration(
questions = Arrays.asList(
Question.Builder().build {
title = "What is your experience? (Practice)"
text = "Give some examples of your work/ study/ life experiences " +
"(During my time at... I was able to... meaning I can now... for you)."
durationSecs = 60
attempts = 2
}
)
)
}
There are two options to integrate MyInterview Widget into the app: MyInterviewActivity
and MyInterviewView
.
The most easiest way start using MyInterview widget is to use MyInterviewActivity
.
It could be started using context.startActivity(Intent)
and context.startActivityForResult(Intent, Int)
.
val configuration = createMyInteviewWidgetConfiguration()
context.startActivity(MyInterviewActivity.createIntent(this, sampleConfiguration), MY_INTERVIEW_REQUEST_CODE)
or
val configuration = createMyInteviewWidgetConfiguration()
context.startActivityForResult(MyInterviewActivity.createIntent(this, sampleConfiguration), MY_INTERVIEW_REQUEST_CODE)
The app could handle the result of interview process.
In Activity
or Fragment
app should override onActivityResult(Int,Int,Intent)
method. Example:
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent) {
if (requestCode != myInterviewRequestCode) {
return
}
when (resultCode) {
MyInterviewActivity.RESULT_SUCCESS -> showToast("Success")
MyInterviewActivity.RESULT_CANCELED -> showToast("Canceled")
MyInterviewActivity.RESULT_ERROR -> {
val throwable = data!!.getSerializableExtra(MyInterviewActivity.EXTRA_ERROR_KEY) as Throwable
throwable.printStackTrace()
showToast(throwable.message)
}
}
}
MyInterviewView
integration option is more flexible but requires some additional coding.
The example of using MyInterviewView
in layout file:
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".UseViewSampleActivity">
<com.myinterview.sdk.MyInterviewView
android:id="@+id/myinterview_view"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</FrameLayout>
This is the minimum amount of code that is required to integrate MyInterviewView
in Activity or Fragment.
class UseViewSampleActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_use_view_sample)
myinterview_view.run {
listener = object : Listener {
override fun onError(throwable: Throwable) {
...
}
override fun onCanceled() {
...
}
override fun onCompleted() {
...
}
}
permissionCallback = object : RequestPermissionCallback {
override fun onRequestPermissionsRequired(requestCode: Int, permissions: Array<out String>) {
ActivityCompat.requestPermissions(this@UseViewSampleActivity, permissions, requestCode)
}
}
}
if (savedInstanceState == null) {
myinterview_view.startSurvey(createConfiguration())
}
}
override fun onStart() {
super.onStart()
myinterview_view.onStart()
}
override fun onStop() {
myinterview_view.onStop()
super.onStop()
}
override fun onRequestPermissionsResult(requestCode: Int, permissions: Array<out String>, grantResults: IntArray) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults)
myinterview_view.onRequestPermissionResult(requestCode, permissions, grantResults)
}
}
Important parts:
-
call
setContentView(Int)
is required because app works with View that is specified in layout xml -
set
listener
toMyInterviewView
- implementation ofListener
interface. It's used for listening results of interview process. -
set
permissionCallback
toMyInterview
- implementation ofRequestPermissionCallback
interface. It's used for requesting permissions. -
call
MyInterviewView#onStart()
andMyInterviewView#onStop()
in appropriate lifecycle callbacks for correct lifecycle handling -
call
MyInterviewView#onRequestPermissionResult(Int,Array<String>,IntArray)
insideonRequestPermissionResult(Int,Array<String>,IntArray)
in target Activity or Fragment to handle request permission results -
To start interview process the app should invoke
MyInterviewView#startSurvey(Configuration)
For handling results is using Listener
:
myinterview_view.listener = object : Listener {
override fun onError(throwable: Throwable) {
// Place for error handling
}
override fun onCanceled() {
// Would be invoked in case when user canceled interview process
}
override fun onCompleted() {
// Would be invoked in case when user
// successfully finished interview process
}
}
Copyright 2018 Myinterview Solutions Pty Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.