Olá, tudo bem?
Então preciso criar uma conexão bluetooth, igual ao que já vem instalado no celular.
Que pareie com outros celulares ou dispositivos que tenham bluetooth instalado.
Desde já agradeço.
Criar conexão bluetooth android
P
1 Resposta
P
Como não ouve resposta eu me virei e criei está conexão, que ativa somente o bluetooth, mas testei e quando cliquei no botão ativar bluetooth ele deu erro e fechou o app.
Se alguém poder testar agradecerei muito URL para download: http://www.4shared.com/android/SL4CgyOO/Bluetooth.html?
package br.com.android;
import android.app.Activity;
import android.bluetooth.BluetoothAdapter;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
public class BluetoothActivity extends Activity {
protected static final int REQUEST_ENABLE_BT = 0;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Button btativa = (Button) findViewById(R.id.btativa);
btativa.setOnClickListener(new View.OnClickListener() {
BluetoothAdapter mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
public void onClick(View v) {
// TODO Auto-generated method stub
if (!mBluetoothAdapter.isEnabled()) {
Intent enableBtIntent = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE);
startActivityForResult(enableBtIntent, REQUEST_ENABLE_BT);
}
}
});
}
}
Criado 11 de agosto de 2012
Ultima resposta 12 de ago. de 2012
Respostas 1
Participantes 1
Alura O que é Firebase? Para que serve, principais característica e um Guia dessa ferramenta Google O poder do Firebase! Saiba como a plataforma pode impulsionar suas aplicações web e mobile, descobrindo tudo neste artigo completo.
Casa do Codigo Kotlin com Android: Crie aplicativos de maneira facil e... Por Kassiano Resende — Casa do Codigo