100mslive/100ms-flutter

Unresolved reference Activity❓

gourav6m17 opened this issue · 6 comments

I'm using flutter stripe with the 100ms and here in the MainActivity it should be extended with the FlutterFragmentActivity but unexpectly I got the error

Launching lib/main.dart on sdk gphone arm64 in debug mode...
Running Gradle task 'assembleDebug'...
e: file:///Users/xyz/Downloads/seller_support_customer_app-new-branch-to-sultan/android/app/src/main/kotlin/com/rb/sellersuppportuser/MainActivity.kt:22:13 Unresolved reference: activity
e: file:///Users/xyz/Downloads/seller_support_customer_app-new-branch-to-sultan/android/app/src/main/kotlin/com/rb/sellersuppportuser/MainActivity.kt:27:13 Unresolved reference: activity

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:compileDebugKotlin'.
> A failure occurred while executing org.jetbrains.kotlin.compilerRunner.GradleCompilerRunnerWithWorkers$GradleKotlinCompilerWorkAction
   > Compilation error. See log for more details

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 14s
Exception: Gradle task assembleDebug failed with exit code 1

Here is my MainActicvity.kt file code.

package com.example.customer_app


import io.flutter.embedding.android.FlutterFragmentActivity
import android.app.Activity
import android.content.Intent
import android.content.res.Configuration
import android.util.Log
import io.flutter.embedding.android.FlutterActivity
import live.hms.hmssdk_flutter.Constants
import live.hms.hmssdk_flutter.HmssdkFlutterPlugin
import live.hms.hmssdk_flutter.methods.HMSPipAction


class MainActivity: FlutterFragmentActivity() {
    override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
        super.onActivityResult(requestCode, resultCode, data)
         if (requestCode == Constants.SCREEN_SHARE_INTENT_REQUEST_CODE && resultCode == Activity.RESULT_OK) {
            data?.action = Constants.HMSSDK_RECEIVER
            activity.sendBroadcast(data?.putExtra(Constants.METHOD_CALL, Constants.SCREEN_SHARE_REQUEST))
        }

        if (requestCode == Constants.AUDIO_SHARE_INTENT_REQUEST_CODE && resultCode == Activity.RESULT_OK){
            data?.action = Constants.HMSSDK_RECEIVER
            activity.sendBroadcast(data?.putExtra(Constants.METHOD_CALL, Constants.AUDIO_SHARE_REQUEST))
        }

    }
}


Hello! Thank you for filing an issue.

Please include relevant logs or detailed description for faster resolutions.

We really appreciate your contribution!

Hi @gourav6m17 you can access the activity using this keyword like below:

Please check the docs here: https://www.100ms.live/docs/flutter/v2/how-to-guides/set-up-video-conferencing/screen-share#android-setup

@gourav6m17 is this resolved ?

Yes, it runs without any errors but I'll test it thoroughly. Thanks for the support.

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

This issue was closed because it has been stalled for 5 days with no activity.