Hello! I wanna build a tauri plugin that would start as a service on android, but I cannot make it work("Started" would log in the console but not "service started").
Here is my code:
@TauriPlugin
class TestPlugin(private val activity: Activity): Plugin(activity) {
@Command
fun start(invoke: Invoke) {
Logger.info("Started")
ServiceManager.startService(activity)
invoke.resolve()
}
}
object ServiceManager {
fun startService(context: Context) {
val intent = Intent(context, TestService::class.java)
context.startService(intent)
}
}
class TestService : Service() {
override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int {
Logger.info("service started")
return START_STICKY
}
}
# AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<application>
<service android:name=".TestService"
android:exported="false"
android:label="test" >
<property
android:name="android.app.PROPERTY_SPECIAL_USE_FGS_SUBTYPE"
android:value="proxy" />
</service>
</application>
</manifest>
Can anyone help with it or give some sample code? Thanks in advanced!