Open creatorplanet opened 2 years ago
package com.example.alpha
import androidx.appcompat.app.AppCompatActivity import android.os.Bundle import android.view.WindowManager import androidx.databinding.DataBindingUtil import com.example.alpha.databinding.ActivityBroadcastBinding import com.remotemonster.sdk.RemonCall
class BroadcastActivity : AppCompatActivity() { lateinit var binding : ActivityBroadcastBinding var remonCall: RemonCall? = null override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) binding = DataBindingUtil.setContentView(this, R.layout.activity_broadcast) window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
remonCall = RemonCall.builder()
.context(this)
.serviceId("SERVICED1")
.key("1234567890")
.videoCodec("VP8")
.videoWidth(640)
.videoHeight(480)
.localView(binding.localView)
.remoteView(binding.remoteView)
.build()
val channelId = intent.getStringExtra("channelId")
remonCall?.connect(channelId)
remonCall?.onClose {
finish()
}
}
override fun onDestroy() {
remonCall?.close()
super.onDestroy()
}
}
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.alpha">
<uses-feature android:name="android.hardware.camera" android:required="false"/>
<uses-permission android:name="android.permission.CAMERA"/>
<uses-permission android:name="android.permission.RECORD_AUDIO"/>
<application
android:allowBackup="true"
android:fullBackupContent="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.Alpha">
<activity android:name=".BroadcastActivity" />
<activity android:name=".LoginActivity" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".MainActivity" />
</application>
package com.example.alpha
import android.content.Intent import androidx.appcompat.app.AppCompatActivity import android.os.Bundle import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import android.widget.Button import android.widget.TextView import androidx.databinding.DataBindingUtil import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.RecyclerView import com.example.alpha.databinding.ActivityMainBinding import com.google.android.gms.auth.api.signin.GoogleSignIn import com.google.android.gms.auth.api.signin.GoogleSignInClient import com.google.android.gms.auth.api.signin.GoogleSignInOptions import com.google.firebase.auth.FirebaseAuth import com.google.firebase.auth.ktx.auth import com.google.firebase.firestore.FirebaseFirestore import com.google.firebase.ktx.Firebase
class MainActivity : AppCompatActivity() { private lateinit var auth: FirebaseAuth private lateinit var googleSignInClient: GoogleSignInClient
lateinit var binding : ActivityMainBinding
var array : MutableList<UserDTO> = arrayListOf()
var uids : MutableList<String> = arrayListOf()
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
binding = DataBindingUtil.setContentView(this, R.layout.activity_main)
// Configure Google Sign In && Logout
val gso = GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
.requestIdToken(getString(R.string.default_web_client_id))
.requestEmail()
.build()
googleSignInClient = GoogleSignIn.getClient(this, gso)
val btnLogout = findViewById<Button>(R.id.btnLogout)
btnLogout.setOnClickListener {
Firebase.auth.signOut()
googleSignInClient?.signOut()
val logoutIntent = Intent(this, LoginActivity::class.java) // move Login page
logoutIntent.flags = Intent.FLAG_ACTIVITY_CLEAR_TASK or Intent.FLAG_ACTIVITY_NEW_TASK // 초기화 * 재로그인
startActivity(logoutIntent)
finish()
}
// Get user list
FirebaseFirestore.getInstance().collection("users").get().addOnCompleteListener{
task ->
array.clear()
uids.clear()
for ( item in task.result!!.documents) {
array.add(item.toObject(UserDTO::class.java)!!)
uids.add(item.id)
}
binding.userListRecyclerview.adapter?.notifyDataSetChanged()
}
binding.userListRecyclerview.layoutManager = LinearLayoutManager(this)
binding.userListRecyclerview.adapter = RecyclerviewAdaptor()
}
//List
inner class RecyclerviewAdaptor : RecyclerView.Adapter<RecyclerviewAdaptor.ViewHolder>(){
override fun onCreateViewHolder( parent: ViewGroup, viewType: Int ): RecyclerviewAdaptor.ViewHolder {
val view = LayoutInflater.from(parent.context).inflate(R.layout.item_user,parent,false)
return ViewHolder(view)
}
override fun getItemCount(): Int {
return array.size
}
override fun onBindViewHolder(holder: RecyclerviewAdaptor.ViewHolder, position: Int) {
holder.itemEmail.text = array[position].email
holder.itemCountry.text = array[position].country
holder.itemView.setOnClickListener {
openBroadcastActivity("creatwith")
}
}
inner class ViewHolder(view : View) : RecyclerView.ViewHolder(view){
val itemEmail: TextView = view.findViewById<TextView>(R.id.itemEmail)
val itemCountry: TextView = view.findViewById<TextView>(R.id.itemCountry)
}
}
//Broadcast Activity
fun openBroadcastActivity(channelId : String){
val i = Intent(this, BroadcastActivity::class.java)
i.putExtra("channelId", channelId)
startActivity(i)
}
}
configurations {
implementation.exclude module:'protobuf-java'
}
implementation 'org.webrtc:google-webrtc:1.0.+' //WebRtc
implementation 'com.remotemonster:sdk:2.7.2' // RemoteMoster company
ActivityCompat.requestPermissions(this, arrayOf(Manifest.permission.CAMERA, Manifest.permission.RECORD_AUDIO),0)
class LoginActivity : AppCompatActivity() { //create a button variable lateinit var btnSignIn:com.google.android.gms.common.SignInButton private lateinit var auth: FirebaseAuth
lateinit var googleSignInClient: GoogleSignInClient
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_login)
supportActionBar?.hide() //themes: hide menuBar
auth = Firebase.auth
//assign the xml view to the button
btnSignIn= findViewById(R.id.btnSignIn)
// Configure Google Sign In
val gso = GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
.requestIdToken(getString(R.string.default_web_client_id))
.requestEmail()
.build()
googleSignInClient = GoogleSignIn.getClient(this, gso)
//now set click listener for button
btnSignIn.setOnClickListener {
val signInIntent = googleSignInClient.signInIntent
resultLauncher.launch(signInIntent) //startActivityForResult(signInIntent, RC_GOOGLE_SIGN_IN)
}
ActivityCompat.requestPermissions(this, arrayOf(Manifest.permission.CAMERA, Manifest.permission.RECORD_AUDIO),0)
}
리모트몬스터 :: 2016년 설립한 스타트업 https://github.com/RemoteMonster https://thevc.kr/remotemonster https://blog.remotemonster.com/tagged/%EB%A6%AC%EB%AA%A8%ED%8A%B8%EB%AA%AC%EC%8A%A4%ED%84%B0
WebRTC 통화기능 라이브러리 표준화, 통신 기술/ 네트워크에 대한 지식, 통신품질 통신사를 만들 수 있는 기술, 콜센터(cloud), 드론, IOT 아카마이 전세계 cdn 업체, 라우팅 최종 경로를 다 안다.