Recuperar nivel de bateria, sinal

Ola Pessoal,

como extrair do celular o sinal da antena (fraco/forte/sem sinal), o nivel da bateria (voltagem ?) e um identificador unico do aparelho (numero , emi)

obrigado.

Depende do fabricante, se ele libera para que vc implemente essas funcionalidades.

[]'s

Fala malves_info,

é um i876 motorola, mas c tiver metodo generico melhor ainda pois posso aplicar a outros devices.

penso em algo simples como double latitude = c.getLatitude(); ouble longitude = c.getLongitude(); mas sem ter que usar uma location api pra obter os dados que falei :smiley:

obrigado!

nos motorolas tem como pegar a bateria System.getProperty("batterylevel"); esse metodo retorna valores inteiros aí tem q ver na APi como está implementado no seu aparelho, pois no meu um V3 ele retorna 0,1,2e 3 3 = cheia, 2=media 1=fraca, zero=vermelha de um olhada abaixo

Java.lang Implementation
Motorola?s implementation for the java.lang.System.getProperty method supports additional system
properties to those specified in JSR 118.
The additional system properties are:
The IMEI and MSISDN properties are not available for unsigned MIDlets. For more information on this
class, go to http://java.sun.com/j2se/1.4.2/docs/api/java/lang/System.html. The following code sample
shows the java.lang implementation.
System.getProperty(?batterylevel?)
System.getProperty(?MSISDN?)
System.getProperty(?CellID?)
System.getProperty(?IMEI?)
The following information is provided from the java-tips.org web site and can be seen in its entirety at
http://www.java-tips.org/java-me-tips/midp/how-to-retrieve-system-properties-in-a-midlet.html.
This Java ME tip illustrates the retrieval of system properties in a MIDlet. MIDlets have direct access to all
four of the standard system properties defined by the CLDC specification.
CellID The device?s current Cell ID is returned during implementation.
batterylevel The application?s current battery level is returned during implementation.
Battery values are: low battery, 1,2, and 3, based on the battery level.
IMEI International Mobile Equipment Identity. The device?s IMEI number is returned during implementation.
MSISDN Mobile Station Integrated Services Digital Network. The device?s MSISDN of the device is returned
during implementation.
import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Displayable;
import javax.microedition.lcdui.Form;
import javax.microedition.midlet.MIDlet;
/* Creates the "Hello world" program in J2ME MIDP.
Note that the class must be public so that the device
application management software can instantiate it. */
public class HelloWorld extends MIDlet
{
Java ME Developer Guide for Motorola OS DRAFT Page 144
public void startApp() {
// Create a Displayable widget.
form = new Form("Hello World");
// Add a string to the form.
String msg = "My first MIDlet!";
form.append(msg);
// This app simply displays the single form created above.
display = Display.getDisplay(this);
display.setCurrent(form);
printSystemProperties();
}
/* Prints the values of the standard system properties
using the System.getProperty() call. */
protected void printSystemProperties()
{
String conf;
String profiles;
String platform;
String encoding;
String locale;
conf = System.getProperty("microedition.configuration");
System.out.println(conf);
profiles = System.getProperty("microedition.profiles");
System.out.println(profiles);
platform = System.getProperty("microedition.platform");
System.out.println(platform);
encoding = System.getProperty("microedition.encoding");
System.out.println(encoding);
locale = System.getProperty("microedition.locale");
System.out.println(locale);
System.out.println();
}
}
Java ME Developer Guide for Motorola OS DRAFT Page 145
The following table is from the Sun Developer Network (SDN) web page,
http://developers.sun.com/mobility/midp/questions/properties/index.html.
This table lists the defined system properties, drawing them from JSRs that are in the public review, final
ballot, or final state, as defined in the Java Community Process (JCP):
Java ME Defined System Properties
Table 34:Java ME System Properties
JSR Property Name Default Valuea
30 microedition.platform null
microedition.encoding ISO8859_1
microedition.configuration CLDC-1.0
microedition.profiles null
37 microedition.locale null
microedition.profiles MIDP-1.0
75 microedition.io.file.FileConnection.v
ersion
1.0
file.separator (impl-dep)
microedition.pim.version 1.0
118 microedition.locale null
microedition.profiles MIDP-2.0
microedition.commports (impl-dep)
microedition.hostname (impl-dep)
120 wireless.messaging.sms.smsc (impl-dep)
139 microedition.platform (impl-dep)
microedition.encoding ISO8859-1
microedition.configuration CLDC-1.1
microedition.profiles (impl-dep)
177 microedition.smartcardslots (impl-dep)
179 microedition.location.version 1.0
180 microedition.sip.version 1.0
184 microedition.m3g.version 1.0
185 microedition.jtwi.version 1.0
Java ME Developer Guide for Motorola OS DRAFT Page 146
195 microedition.locale (impl-dep)
microedition.profiles IMP-1.0
205 wireless.messaging.sms.smsc (impl-dep)
205 wireless.messaging.mms.mmsc (impl-dep)
211 CHAPI-Version 1.0
a. (impl-dep) indicates that the default value is implementation-dependent.

espero ter ajudado

Fmz JJjava,

vou testar agora!!

[]s

testei no i876 e nada.
dei uma olhada na api do p/ oi876 e tb nao consegui.
a Status Manager API é quem instancia objetos para recuperar nivel de sinal e bateria.

criei uma instancia desta classe e fiz uma chamada aos metodos e nada. acho que fiz alguma besteira pois nao conseguir com a api na mao…
onde tem um tutorial em portugues sobre uso de api padrao java ou msmo de terceiros, pois e´a segunda vez na vida que uso api não padrao :smiley:

obrigado e bfds a todos