kopia lustrzana https://github.com/meshtastic/Meshtastic-Android
remote binding to our service now works
rodzic
140c1561c3
commit
0cca88575d
|
@ -53,13 +53,17 @@
|
|||
android:name="com.geeksville.mesh.SoftwareUpdateService"
|
||||
android:enabled="true"
|
||||
android:exported="false"
|
||||
android:permission="android.permission.BIND_JOB_SERVICE" />
|
||||
android:permission="android.permission.BIND_JOB_SERVICE"></service>
|
||||
|
||||
<!-- This is the public API for doing mesh radio operations from android apps -->
|
||||
<service
|
||||
android:name="com.geeksville.mesh.MeshService"
|
||||
android:enabled="true"
|
||||
android:exported="true" />
|
||||
android:exported="true">
|
||||
<intent-filter>
|
||||
<action android:name="com.geeksville.mesh.Service" />
|
||||
</intent-filter>
|
||||
</service>
|
||||
|
||||
<!-- This is a private service which just does direct communication to the radio -->
|
||||
<service
|
||||
|
|
|
@ -180,13 +180,15 @@ class MainActivity : AppCompatActivity(), Logging {
|
|||
debug("Binding to mesh service!")
|
||||
// we bind using the well known name, to make sure 3rd party apps could also
|
||||
logAssert(meshService == null)
|
||||
// FIXME - finding by string does work
|
||||
val intent = Intent(this, MeshService::class.java)
|
||||
intent.action = IMeshService::class.java.name
|
||||
|
||||
// This is the remote version that does not work! FIXME
|
||||
//val intent = Intent(IMeshService::class.java.name)
|
||||
//intent.setPackage("com.geeksville.mesh");
|
||||
// bind to our service using the same mechanism an external client would use (for testing coverage)
|
||||
val intent = Intent()
|
||||
intent.setClassName("com.geeksville.mesh", "com.geeksville.mesh.MeshService")
|
||||
|
||||
// The following would work for us, but not external users
|
||||
//val intent = Intent(this, MeshService::class.java)
|
||||
//intent.action = IMeshService::class.java.name
|
||||
|
||||
isBound = bindService(intent, serviceConnection, Context.BIND_AUTO_CREATE)
|
||||
logAssert(isBound)
|
||||
}
|
||||
|
|
Ładowanie…
Reference in New Issue