Isso no KeyDown da Activity??? Mas dai eu vou ainda precisar daquele lance do Manifest? e da classe RemoteControlReceiver?
<receiver
android:name=".RemoteControlReceiver"
android:priority="1000" >
<intent-filter>
<action android:name="android.intent.action.MEDIA_BUTTON" />
</intent-filter>
</receiver>
Em 21 de julho de 2014 09:01, Jhonatas Martins dos Santos <jhonatas1992@gmail.com> escreveu:
Mandei sem querer.
Mas compara o keycode com o keycode de media como KEYCODE_MEDIA_PLAY
e ver se dá certo
Abs
Em segunda-feira, 21 de julho de 2014 08h59min06s UTC-3, Jhonatas Martins dos Santos escreveu:Toshi sobreescreve o onKeyDown da activity,
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
}
Em domingo, 20 de julho de 2014 15h32min29s UTC-3, Toshi Ossada escreveu:Vlw Carlos, funcionou mas nao como eu qria, eu qria chamar o método da minha activity principal dentro do 'onClick', tentei implementer como uma inner class, mas nao deu certoEm 18 de julho de 2014 09:30, Toshi Ossada <toshi....@gmail.com> escreveu:Vlw Carlos e Geovani, irei testar assim que puder e falo se deu certo ou nao2014-07-18 8:54 GMT-03:00 Carlos Pelegrin <carlosedua...@gmail.com>:
Tem um BroadcastReceiver específico que é chato de usar.
Depende muito do device e do fone que você utiliza.
veja o exemplo:Classe BR:public class RemoteControlReceiver extends BroadcastReceiver {private String TAG = "RemoteControlReceiver";@Overridepublic void onReceive(Context context, Intent intent) {Log.e(TAG, "Action: " + intent.getAction());if (Intent.ACTION_MEDIA_BUTTON.equals(intent.getAction())) {KeyEvent event = (KeyEvent) intent.getParcelableExtra(Intent.EXTRA_KEY_EVENT);if (event.getAction() == KeyEvent.ACTION_DOWN) {Log.e(TAG, event.toString());}else if (event.getAction() == KeyEvent.ACTION_UP) {Log.e(TAG, event.toString());}}}}
Manifest:<receiverandroid:name=".RemoteControlReceiver"android:priority="1000" ><intent-filter><action android:name="android.intent.action.MEDIA_BUTTON" /></intent-filter></receiver>
Classe Activity:((AudioManager) getSystemService(AUDIO_SERVICE)).registerMediaButtonEventReceiver(new ComponentName(getPackageName(),RemoteControlReceiver.class.getName()));
Foi a única forma que consegui utilizar.Att.Carlos
Em sexta-feira, 18 de julho de 2014 08h23min07s UTC-3, Toshi Ossada escreveu:Bom dia,Estou tentando implementar um evento para quando o usuario pressionar o botão que há junto ao fone de ouvido, aquele que atende chamadas, alguem saberia q evento eu devo usar?[]'s--
You received this message because you are subscribed to the Google Groups "Android Brasil - Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to androidbrasil-...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--Kevlin Toshinari Ossada
Software EngineerTelefone: (19) 3406.3005/(19) 9 9120.0273--
You received this message because you are subscribed to the Google Groups "Android Brasil - Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to androidbrasil-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Kevlin Toshinari Ossada
Software Engineer
Telefone: (19) 3406.3005/(19) 9 9120.0273
E-mail: toshi.ohkawa@gmail.com
You received this message because you are subscribed to the Google Groups "Android Brasil - Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to androidbrasil-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.






0 comentários:
Postar um comentário