FORUMS PROFESSIONNELS
WINDEV
,
WEBDEV
et
WINDEV Mobile
Accueil
|
Messages récents
|
Connexion
|
Déconnexion
|
Français
Accueil
→
WINDEV Mobile 2024
→
Celular Sim Card Serial
Celular Sim Card Serial
Débuté par adrianoboller, 24 nov. 2014 12:01 - 3 réponses
Connectez-vous…
adrianoboller
#1
Membre enregistré
3 651 messages
Popularité : +175 (223 votes)
Posté le 24 novembre 2014 - 12:01
import android.app.Activity
;
import android.content.Context
;
import android.content.Intent
;
import android.content.SharedPreferences
;
import android.content.SharedPreferences.Editor
;
import android.os.Bundle
;
import android.telephony.TelephonyManager
;
import android.util.Log
;
import android.widget.Toast
;
import android.provider.Settings.Secure
;
PUBLIC static string
CelularSimCardSerial
(
)
{
TelephonyManager tm
;
tm
= (
TelephonyManager
)
getApplicationContext
(
)
.
getSystemService
(
Context.TELEPHONY_SERVICE
)
;
string
num
=
tm.getSimSerialNumber
(
)
;
RETURN
(
num
)
;
}
Signaler
0
0
adrianoboller
#2
Membre enregistré
3 651 messages
Popularité : +175 (223 votes)
Posté le 24 novembre 2014 - 12:02
import android.app.Activity
;
import android.content.Context
;
import android.content.Intent
;
import android.content.SharedPreferences
;
import android.content.SharedPreferences.Editor
;
import android.os.Bundle
;
import android.telephony.TelephonyManager
;
import android.util.Log
;
import android.widget.Toast
;
import android.provider.Settings.Secure
;
PUBLIC static string
CelularGetDeviceId
(
)
{
TelephonyManager tm
;
tm
= (
TelephonyManager
)
getApplicationContext
(
)
.
getSystemService
(
Context.TELEPHONY_SERVICE
)
;
string
num
=
tm.getDeviceId
(
)
;
RETURN
(
num
)
;
}
Signaler
0
0
adrianoboller
#3
Membre enregistré
3 651 messages
Popularité : +175 (223 votes)
Posté le 24 novembre 2014 - 12:02
import android.app.Activity
;
import android.content.Context
;
import android.content.Intent
;
import android.content.SharedPreferences
;
import android.content.SharedPreferences.Editor
;
import android.os.Bundle
;
import android.telephony.TelephonyManager
;
import android.util.Log
;
import android.widget.Toast
;
import android.provider.Settings.Secure
;
//Android Manisfest
//<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
//Requires READ_PHONE_STATE uses-permission
PUBLIC static string
CelularDadosGerais
(
)
{
TelephonyManager tm
;
tm
= (
TelephonyManager
)
getApplicationContext
(
)
.
getSystemService
(
Context.TELEPHONY_SERVICE
)
;
//SimCard
int
simState
=
tm.getSimState
(
)
;
string
SimStateStatus
=
""
;
SWITCH
(
simState
)
{
CASE
(
TelephonyManager.SIM_STATE_ABSENT
)
:
SimStateStatus
=
"SimState: ABSENT"
;
BREAK
;
CASE
(
TelephonyManager.SIM_STATE_NETWORK_LOCKED
)
:
SimStateStatus
=
"SimState: NETWORK_LOCKED"
;
BREAK
;
CASE
(
TelephonyManager.SIM_STATE_PIN_REQUIRED
)
:
SimStateStatus
=
"SimState: PIN_REQUIRED"
;
BREAK
;
CASE
(
TelephonyManager.SIM_STATE_PUK_REQUIRED
)
:
SimStateStatus
=
"SimState: PUK_REQUIRED"
;
BREAK
;
CASE
(
TelephonyManager.SIM_STATE_UNKNOWN
)
:
SimStateStatus
=
"SimState: UNKNOWN"
;
BREAK
;
CASE
(
TelephonyManager.SIM_STATE_READY
)
:
SimStateStatus
=
"SimState: READY"
;
BREAK
;
}
//Numero da Linha 1
string
NumCelular1
=
tm.getLine1Number
(
)
;
//Numero da Linha 2
//String NumCelular2 = tm.getLine2Number();
//Retorna o ID único dispositivo, por exemplo, o IMEI para o GSM eo MEID ou ESN para celulares CDMA.
string
IMEI
=
tm.getDeviceId
(
)
;
//Get SIM Serial Number - Retorna o número de série do SIM, se for o caso.
string
SIMSerial
=
tm.getSimSerialNumber
(
)
;
//Retorna a identificação de assinante original, por exemplo, o IMSI para um telefone GSM.
string
SubscriberId
=
tm.getSubscriberId
(
)
;
//Get SIM Country ISO Code - Retorna o código do país ISO equivalente para o código de país do fornecedor SIM.
string
SIMCountryISO
=
tm.getSimCountryIso
(
)
;
//Retorna o número da versão do software para o dispositivo, por exemplo, o IMEI / SV para telefones GSM.
string
SoftwareVersion
=
tm.getDeviceSoftwareVersion
(
)
;
//Get Network Country ISO Code - Retorna o código de país ISO equivalente do MCC do atual operador registado (Country Code Mobile).
string
NetworkCountryISO
=
tm.getNetworkCountryIso
(
)
;
//Retorna o nome numérico (MCC + MNC) do atual operador registado.
string
networkOperator
=
tm.getNetworkOperator
(
)
;
//Retorna o nome alfabética do atual operador registado
string
NetworkOperatorName
=
tm.getNetworkOperatorName
(
)
;
//Retorna o MCC + MNC (código do país + código de rede móvel celular) do provedor do SIM.
string
Operator
=
tm.getSimOperator
(
)
;
//Retorna o nome do provedor de serviço (SPN).
string
OperatorName
=
tm.getSimOperatorName
(
)
;
//Recupera o identificador alfabético associado com o número de correio de voz.
string
VoiceMailAlphaTag
=
tm.getVoiceMailAlphaTag
(
)
;
//Retorna o número de correio de voz.
string
VoiceMailNumber
=
tm.getVoiceMailNumber
(
)
;
//Resultado
string
RetornoNumCelular
=
NumCelular1
+
"; "
+
IMEI
+
"; "
+
SIMSerial
+
"; "
+
SubscriberId
+
"; "
+
SIMCountryISO
+
"; "
+
SoftwareVersion
+
"; "
+
NetworkCountryISO
+
"; "
+
networkOperator
+
"; "
+
NetworkOperatorName
+
"; "
+
Operator
+
"; "
+
OperatorName
+
"; "
+
VoiceMailAlphaTag
+
"; "
+
VoiceMailNumber
+
"; "
+
SimStateStatus
;
RETURN
(
RetornoNumCelular
)
;
}
Signaler
0
0
COULOLIB PHILIP
#4
Posté le 24 juillet 2020 - 22:32
Bonsoir,
merci de m'aider.
Lorsque j'ajoute cette function java à win mobile 23, J'ai cette erreur à la compilation:
Echec de la création de l'application Android <C:\Mes Projets Mobile\TestApiSMS\Exe\TestApiSMS.apk>.
Ligne de commande : "C:\Program Files\Java\jdk1.8.0_172\bin\java.exe" "-Dorg.gradle.appname=C:\Mes Projets Mobile\TestApiSMS\Android\Gen" -classpath "C:\WINDEV Mobile 23\Personnel\Android\Gradle\lib\gradle-launcher-2.14.1.jar" org.gradle.launcher.GradleMain assembleDebug -b "C:\Mes Projets Mobile\TestApiSMS\Android\Gen\build.gradle"
Erreur retournée :
:compileDebugJavaWithJavac - is not incremental (e.g. outputs have changed, no previous execution, etc.).
C:\Mes Projets Mobile\TestApiSMS\Android\Gen\src\com\masociete\testapisms\wdgen\GWDCPCOL_TESTAPISMS.java:109: error: <identifier> expected
PUBLIC void CelularGetDeviceId()
^
C:\Mes Projets Mobile\TestApiSMS\Android\Gen\src\com\masociete\testapisms\wdgen\GWDCPCOL_TESTAPISMS.java:109: error: invalid method declaration; return type required
PUBLIC void CelularGetDeviceId()
^
2 errors
:compileDebugJavaWithJavac FAILED
Signaler
0
0
→ Revenir à WINDEV Mobile 2024
WINDEV 2024
WEBDEV 2024
WINDEV Mobile 2024
WINDEV (précédentes versions)
Français
English
Español
Portuguesa
Fermer cette fenêtre
Type de recherche
Uniquement les sujets
Tous les messages
Période de recherche
Date indifférente
Moins d'une heure
Moins de 24 heures
Moins d'une semaine
Moins d'un mois
Moins d'un an
Annuler
Aperçu de votre message
Ajouter une image
Importer une image depuis une URL
Envoyer une image depuis un fichier de votre disque
Déposez ici un fichier ou cliquez sur "Parcourir..."
ou
Annuler
0%
WLangage
SQL
XML, HTML
JAVA, Javascript
Texte