Skip to content

Commit

Permalink
request permissions and add opensles module
Browse files Browse the repository at this point in the history
  • Loading branch information
sreimers committed Aug 10, 2024
1 parent f3283fc commit 58639e7
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 5 deletions.
20 changes: 18 additions & 2 deletions app/android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">

<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_PHONE_CALL" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_MICROPHONE" />
<uses-permission android:name="android.permission.MANAGE_OWN_CALLS" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.CALL_PHONE" />
<uses-feature
android:name="android.hardware.telephony"
android:required="false" />
<uses-feature
android:name="android.hardware.camera"
android:required="false" />
<application
android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules"
Expand All @@ -17,7 +34,6 @@
<activity
android:name=".MainActivity"
android:exported="true"
android:label="@string/app_name"
android:theme="@style/Theme.StudioLink">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
Expand Down
8 changes: 5 additions & 3 deletions app/android/app/src/main/cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ project("api")

# target environment on the build host system
set(CMAKE_FIND_ROOT_PATH
/home/sreimers/next/third_party_android/${CMAKE_ANDROID_ARCH_ABI}
/home/sreimers/next/external/re
/home/sreimers/next/external/libsl/include
${CMAKE_CURRENT_SOURCE_DIR}/external/third_party/${CMAKE_ANDROID_ARCH_ABI}
${CMAKE_CURRENT_SOURCE_DIR}/external/re
${CMAKE_CURRENT_SOURCE_DIR}/external/libsl/include
)

set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
Expand All @@ -41,6 +41,8 @@ set(MODULES
ice
opus
turn
netroam
opensles
CACHE STRING "")

# Baresip dependencies
Expand Down
10 changes: 10 additions & 0 deletions app/android/app/src/main/java/link/studio/app/MainActivity.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package link.studio.app

import android.content.Intent
import android.content.pm.PackageManager
import android.net.Uri
import android.os.Bundle
import android.webkit.WebResourceError
Expand All @@ -9,6 +10,8 @@ import android.webkit.WebView
import android.webkit.WebViewClient
import androidx.activity.ComponentActivity
import androidx.activity.enableEdgeToEdge
import androidx.core.app.ActivityCompat
import androidx.core.content.ContextCompat

private var refused_fail = 0

Expand Down Expand Up @@ -43,6 +46,13 @@ private class MyWebViewClient : WebViewClient() {

class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
if (ContextCompat.checkSelfPermission(this,
android.Manifest.permission.RECORD_AUDIO) != PackageManager.PERMISSION_GRANTED && ContextCompat.checkSelfPermission(this,
android.Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
val permissions = arrayOf(android.Manifest.permission.RECORD_AUDIO, android.Manifest.permission.WRITE_EXTERNAL_STORAGE, android.Manifest.permission.READ_EXTERNAL_STORAGE)
ActivityCompat.requestPermissions(this, permissions,0)
}

Api.slStart(filesDir.absolutePath)
super.onCreate(savedInstanceState)
enableEdgeToEdge()
Expand Down

0 comments on commit 58639e7

Please sign in to comment.