Thursday, July 5, 2012

Android can be hijacked

From the yesteryears i remember that Windows can be hijacked and is virus prone and now a days even Apple removed a line that "Mac is not virus prone" as was attacked by a trojan. The latest in the trend is Android Application Stack which is now proved to be hijacked....checkout this link:
Researchers create "clickjack rootkit" for Android that hijacks apps

Monday, July 2, 2012

Google I/O 2012

Google seems to be the one company which is driving world single handedly to the new horizon. This is how Google is driving the world


Google I/O 2012 Keynote Day 1: http://www.youtube.com/watch?v=VuC0i4xTyrI
Google I/O 2012 Keynote Day 2: http://www.youtube.com/watch?v=tPtJd6AzU8c


Wish i could have joined Google one day

Wednesday, June 27, 2012

How to route a mono sound from an android device to a handset/handfree

Today i was doing an RnD to route a mono sound from an android device to a handsfree/handset and after googling many things and trying out a few i was able to come up with a simple solution using BluetoothHandsfree profile.


Here is a code snippet:
<manifest>

<uses-permission android:name="
android.permission.MODIFY_AUDIO_SETTINGS" />
</manifest>

.................

BluetoothAdapter mBluetoothAdapter;
mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
if (mBluetoothAdapter == null) {
toast("Device does not support Bluetooth");
} else {
toast("Bluetooth is supported");
if (!mBluetoothAdapter.isEnabled()) {
toast("Requesting for Bluetooth");
Intent discoverableIntent = new Intent(
BluetoothAdapter.ACTION_REQUEST_DISCOVERABLE);
discoverableIntent.putExtra(
BluetoothAdapter.EXTRA_DISCOVERABLE_DURATION, 300);
startActivityForResult(discoverableIntent, REQUEST_ENABLE_BT);
} else {
toast("Bluetooth Enabled");
}
}

mBluetoothAdapter.getProfileProxy(getApplicationContext(),
mProfileListener, BluetoothProfile.HEADSET);

private BluetoothProfile.ServiceListener mProfileListener = new BluetoothProfile.ServiceListener() {
public void onServiceConnected(int profile, BluetoothProfile proxy) {
if (profile == BluetoothProfile.HEADSET) {
mBluetoothHeadset = (BluetoothHeadset) proxy;
Log.i(tag, "***** Headset proxy obtained *****");
AudioManager audioManager = (AudioManager) getSystemService(AUDIO_SERVICE);

audioManager.setMode(AudioManager.MODE_IN_CALL);
audioManager.startBluetoothSco();
audioManager.setBluetoothScoOn(true);

short[] soundData = new short[8000 * 20];
for (int iii = 0; iii < 20 * 8000; iii++) {
soundData[iii] = 32767; // High Note
iii++;
soundData[iii] = 32767; // High Note
iii++;
soundData[iii] = -32768; // Low Note
iii++;
soundData[iii] = -32768; // Low Note
}

AudioTrack audioTrack = new AudioTrack(
AudioManager.STREAM_VOICE_CALL, 8000,
AudioFormat.CHANNEL_OUT_MONO,
AudioFormat.ENCODING_PCM_16BIT, soundData.length
* Short.SIZE, AudioTrack.MODE_STATIC);
audioTrack.write(soundData, 0, soundData.length);
audioTrack.play();
}
}

public void onServiceDisconnected(int profile) {
if (profile == BluetoothProfile.HEADSET) {
mBluetoothHeadset = null;
Log.i(tag, "***** Headset Disconnected *****");
}
}
};

After running this code in an activity a buzz sound can be listened in a headset/handsfree.




How to install node using Brew

This article talks about some simple steps to follow to install node using Brew . Though there are many other ways to do it but the method ...