-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
63678d3
commit b291f9e
Showing
29 changed files
with
1,042 additions
and
136 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
app/src/main/java/com/ciscowebex/androidsdk/kitchensink/CallRejectService.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
package com.ciscowebex.androidsdk.kitchensink | ||
|
||
import android.app.NotificationManager | ||
import android.app.Service | ||
import android.content.Context | ||
import android.content.Intent | ||
import android.os.IBinder | ||
import android.util.Log | ||
import com.ciscowebex.androidsdk.kitchensink.utils.Constants | ||
import org.koin.android.ext.android.inject | ||
|
||
class CallRejectService : Service() { | ||
|
||
private val repository: WebexRepository by inject() | ||
val tag = "CallRejectService" | ||
|
||
companion object { | ||
fun getCallRejectIntent(context: Context, callId: String? = null, accept : Boolean = true): Intent { | ||
val intent = Intent(context, CallRejectService::class.java) | ||
intent.action = Constants.Action.WEBEX_CALL_REJECT_ACTION | ||
intent.putExtra(Constants.Intent.CALLING_ACTIVITY_ID, 1) | ||
intent.putExtra(Constants.Intent.CALL_ID, callId) | ||
return intent | ||
} | ||
|
||
} | ||
|
||
override fun onBind(intent: Intent): IBinder? { | ||
return null | ||
} | ||
|
||
override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int { | ||
if(intent != null){ | ||
if(intent.action == Constants.Action.WEBEX_CALL_REJECT_ACTION){ | ||
val notificationManager = getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager? | ||
notificationManager?.cancel(Constants.Notification.WEBEX_CALLING) | ||
val callId = intent.getStringExtra(Constants.Intent.CALL_ID) | ||
if(!callId.isNullOrBlank()) { | ||
val call = repository.getCall(callId) | ||
call?.let { | ||
call.reject { result -> | ||
if (result.isSuccessful) { | ||
Log.d(tag, "rejectCall successful") | ||
} else { | ||
Log.d(tag, "rejectCall error: ${result.error?.errorMessage}") | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
return super.onStartCommand(intent, flags, startId) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.