This commit is contained in:
parent
a3f5575101
commit
b7be587276
|
|
@ -17,7 +17,7 @@ android {
|
||||||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
||||||
|
|
||||||
ndk {
|
ndk {
|
||||||
abiFilters.addAll(listOf("armeabi-v7a", "arm64-v8a"))
|
abiFilters.addAll(listOf("armeabi-v7a", "arm64-v8a", "x86", "x86_64"))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,7 @@ public class MyApplication {
|
||||||
|
|
||||||
public static void initPTT() {
|
public static void initPTT() {
|
||||||
if (pNative != null) return;
|
if (pNative != null) return;
|
||||||
|
try {
|
||||||
pNative = new pttNative();
|
pNative = new pttNative();
|
||||||
|
|
||||||
pNative.pttNativeSetPackageName(pageName);
|
pNative.pttNativeSetPackageName(pageName);
|
||||||
|
|
@ -41,5 +42,8 @@ public class MyApplication {
|
||||||
pNative.pttNativeSetTTSCallback();
|
pNative.pttNativeSetTTSCallback();
|
||||||
|
|
||||||
pNative.pttNativePocTaskStart();
|
pNative.pttNativePocTaskStart();
|
||||||
|
} catch (Throwable e) {
|
||||||
|
Log.e("PTT_INIT", "Failed to init PTT: " + e.getMessage());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,11 @@ import java.util.List;
|
||||||
public class pttNative {
|
public class pttNative {
|
||||||
private static String TAG = "pttNative";
|
private static String TAG = "pttNative";
|
||||||
static {
|
static {
|
||||||
|
try {
|
||||||
System.loadLibrary("ptt");
|
System.loadLibrary("ptt");
|
||||||
|
} catch (Throwable e) {
|
||||||
|
Log.e(TAG, "Failed to load ptt library: " + e.getMessage());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static char Char2ASCII(char c)
|
public static char Char2ASCII(char c)
|
||||||
|
|
|
||||||
|
|
@ -7,14 +7,27 @@ import timber.log.Timber
|
||||||
|
|
||||||
class MyApplication : Application() {
|
class MyApplication : Application() {
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
private var instance: MyApplication? = null
|
||||||
|
fun getAppInstance(): MyApplication = instance!!
|
||||||
|
}
|
||||||
|
|
||||||
override fun onCreate() {
|
override fun onCreate() {
|
||||||
super.onCreate()
|
super.onCreate()
|
||||||
|
instance = this
|
||||||
|
|
||||||
// Initialize Timber and File Logging
|
// Initialize Timber and File Logging
|
||||||
LogManager.init(this)
|
LogManager.init(this)
|
||||||
|
|
||||||
|
try {
|
||||||
// Initialize PTT Module
|
// Initialize PTT Module
|
||||||
PTTMyApplication.init(this)
|
PTTMyApplication.init(this)
|
||||||
|
Timber.tag("MyApplication").i("PTT Module init sequence finished")
|
||||||
|
} catch (e: Throwable) {
|
||||||
|
// Catch UnsatisfiedLinkError or other PTT init failures
|
||||||
|
Timber.tag("MyApplication").e(e, "PTT Module failed to start (Expected on non-ARM simulators)")
|
||||||
|
}
|
||||||
|
|
||||||
Timber.tag("MyApplication").i("Application onCreate - Logging system and PTT started")
|
Timber.tag("MyApplication").i("Application onCreate - Logging system ready")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue