Is there a way (for scripting) to detect if a SIM card is inserted or not?
Scenario: If SIM card is removed, do this and that …
I would check native Situations app for that.
Maybe Dbus can help?
busctl introspect org.ofono /ril_0 org.nemomobile.ofono.SimInfo
NAME TYPE SIGNATURE RESULT/VALUE FLAGS
.GetAll method - isss -
.GetCardIdentifier method - s -
.GetInterfaceVersion method - i -
.GetServiceProviderName method - s -
.GetSubscriberIdentity method - s -
.CardIdentifierChanged signal s - -
.ServiceProviderNameChanged signal s - -
.SubscriberIdentityChanged signal s - -
You could listen for the CardIdentifierChanged
signal for example.
This gives me (on XA2 SFOS 4.0.15) the same output for ril_1, but I have only one SIM inserted, the other slot has an SD card.
But /usr/bin/dbus-send --system --print-reply --dest=org.ofono /ril_0 org.ofono.NetworkMonitor.GetServingCellInformation returns something when registered, otherwise not.