I'm using a maps API in my project, which needs to be initialised within MainActivity, and when it's renamed in the manifest file, the maps will not work.
This is my MainActivity.kt
import androidx.annotation.NonNull
import io.flutter.embedding.android.FlutterActivity
import io.flutter.embedding.engine.FlutterEngine
import com.yandex.mapkit.MapKitFactory
class MainActivity: FlutterActivity() {
override fun configureFlutterEngine(@NonNull flutterEngine: FlutterEngine) {
MapKitFactory.setApiKey([key])
super.configureFlutterEngine(flutterEngine)
}
}
You need not to change your Launcher activity in android manifest. But just update your Main Activity with this overridden function
Kotlin:
override fun provideFlutterEngine(context:Context):FlutterEngine {
return AudioServicePlugin.getFlutterEngine(context);
}
Java:
@Override
public FlutterEngine provideFlutterEngine(Context context) {
return AudioServicePlugin.getFlutterEngine(context);
}