Monday, February 20, 2012

Android: Push Platform logs in Kernel logs

Hi all,
Its good to write a new post after a long long time. So here I am with a very useful post about the debugging. Sometimes debugging your application could be a problem, when you don’t know whether this issue is because of platform code or kernel code. Specifically I must say, you will feel this scenario when you have to measure some time, and you need to decide whether this is coming from the kernel side or platform side. But as platform and kernel code uses different type of time-stamp, it is almost impossible to debug. So for that there is one command in the adb itself. Here are the steps :
1. Go to adb shell.
2. Type “logcat -f /dev/ksmg
3. just use dmesg or cat /proc/kmsg to see the complete logs.
Here is one prerequisite, your phone should be rooted. otherwise you won’t have permission to the above steps. I hope it will help you.

Monday, January 23, 2012

Friday, December 23, 2011

Trip to St Marry's Island and Udupi


Hi there,

Here I am with one more travel blog, Must say one of the hectic but memorable trip to Udupi. So here are the details.

How to Go 
Udupi is around 62 Km from Mangalore, which is the nearest Airport from here. Although it is very well connected to other cities through Railway as well as Buses. As I am staying in Bangalore, so I go through the Car. By Road it is around 450 Kms from Bangalore, which takes around 10-12 hrs to reach Udupi. Inspite of the long distance, you will enjoy the ride, as this road passes through Western Ghats, which gives you the closure to nature. Must say, awesome beauty and road is also good.

Where to Stay
There are many hotels, lodges near by the Udupi main city. And if you are interested in staying beach resort that is also there. Better you book your accommodation in advance. As it is not very far from the Mangalore, many people prefer to stay in Mangalore too, because there you will find more and better option. But I will suggest you to stay in Udupi itself.

What to Visit
Basically there are two places mainly for which people come here, one is the Krishna Temple and second is island(beach too).Udupi Krishna Temple is very old temple and quite popular too in the region. Although the old temple is not that big, but in that small space itself you will good architecture. Location wise it is situated in the centre of city. So even if you are there for leisure, visit this place too as it is must go place for Udupi.    
                   Second and main place is the St Marry's Island, the story behind the island is, when Vasco da gama first came to India, first he reached here, put a cross as a mark, which in turn gives this place the name "St Marry's island". To go this island, first you need to go to Malpe Harbor, there is Ferry service available to the island. From here real journey starts, I must say this is one of the most beautiful beaches I have ever seen, water is so clean, clear sky, and if you are lucky you will see few dolphins too. it takes 30 mins to reach the island, but you will enjoy each and every minute. Even though area wise it is very small, but it is good, as one side of beach have sand all over, while other have rocks, and did I mention the water clarity(:P). You can sit, roam around, play or whatever you want to do with that place. Just try to be there early, so that you can stay there for atleast 4-5 hours. And remember, last ferry will start from island at 5 PM.
                   After coming from island, you can go to the beach which is known as Malpe beach, although it is not good to take bath as so much sand and salt is there in the water. But you can spend hours just sitting there and watching sun set. And must say white sand has its own charm. I like it.

When to go
As Udupi's weather is same most of the time of year, just avoid the rainy season. Rest of the time you can go. And one more thing it is really hot in the day time, so be ready for sun burn.

Others
You will get proper and all kind of food in Udupi, but be sure what you are eating, as sometimes they serve very weird things with fancy names. And you won't find anything at the island, so if you are planning to stay for long hours, just take drinking water and some snacks too. Apart from that I don't think anything else is required. If anything required it will be your part of experience, your stories to share with others.

Monday, November 7, 2011

SystemProperties in Android: Use them in Framework c files

Hi all,
Here I am with one more android blog. We generally used Sharedpreferences in Android to share information between Activities. But what if you want to have something at the time of boot. For that there is one solution which is systemproperties, using those you can share information or values at the time of boot. So for example if you want to save some settings by user, which should be applicable at the time boot. So do following
SystemProperties.set(String key, String val) // where key is name of property
Now to retrieve it in Java files you can directly use
SystemProperties.get(String key)
But if you want it in boot time it should be in cpp files so use
property_get( String name, char* var, NULL)
/* where name is property name, var is the variable in which u want to store value last parameter is for the default value which will be assigned to var when no property set.*/
And for the java things you can check Systemproperties.java for apis for different type of data
types. Although for cpp it is only supported for string type And if you want to save any property through c files, use property_set() method.
Hope it will you too, as it was really save my day.

Saturday, October 8, 2011

Nandi Hills, Bangalore

Hi folks,

After my android blog post, here it comes one travel blog post. I hope this may continue that every weekend I could have gone to some nice place. So here it comes the night out @ Nandi Hills.

How to Reach there ?
It's around 60-65 Kms from Bangalore City. And around 25 Kms from Airport. So if you are staying in Bangalore just go to Makeri Circle, take the straight road to Airport, and just before the bridge, there is a road which is heading towards Hyderabad, take the road and after around 5 kms you will find a left turn for Nandi Hills. Its 21 Kms from there.

What to See ??
Basically this is Sun-rise point, you can admire the Scenic beauty from the top peak. And it is awesome, and hide and seek of Sun makes it more awesome. After reaching there, you won't think that "on top of cloud" is just a phrase. Apart from the view, there are few gardens and temple over there. And off-course it was part of Tipu Sultan kindom, there is one big pond and Tipu Sultan's summer place.

When to go ?
I think if you leave Bangalore around 3:30 AM, it would be great as it will take you around 2 hrs to reach there, and most importantly the doors doesn't open till 6:15 AM. So you can plan accordingly. They charge for the tickets as well as parking tickets. One more thing if you have 4 wheeler, they will allow you to go till the top, otherwise you have to walk around 1 Km. But believe me this place is not meant for Cars or other 4 wheeler. As you will enjoy each and every minute of your bike ride.

Others
You will find many shops, if you want to purchase something like snacks or something. Even at the ticket counter also there is a shop for such items. And yeah, don't forget to enjoy the chai or coffee on the Highway. While returning you can stop at McD too, which have started Breakfast, believe me I was starving while returning back. Also carry your jacket, as it will be cold in night in Bangalore whatever season it is.

In last I can say, it is must see place in Bangalore. So just give it a try.

CountDownTimer a great alternate of AlarmManager in Android

Hi Guys,
few days back I was looking for a solution to execute a functionality after some time from my activity. Generally in these cases developer uses AlarmManager to send Action or Activity and handle it in their accordingly. But there are few limitations with AlarmManager like you have to set your alarm for a fix time from boot-up or start. So to overcome this I used CountDownTimer class. This is the same class which is used in StopWatch application, so it is reliable as well as easy to use. Although it’s use is pretty straight forward and mentioned in the API. I will explain it here with the same example.
Example :
new CountdownTimer(30000, 1000) {

 public void onTick(long millisUntilFinished) {

 mTextField.setText("seconds remaining: " + millisUntilFinished / 1000);

}

 public void onFinish() {

  mTextField.setText("done!");

}

 }.start();
Here 30,000(30 sec) is the timer till it will go, 1000(1 sec) is every step to reach there. Here there are two  methods which needs to be override, first is onTick() which will be called on every step. So it means it will be called on every second in this case till 29 sec. After that onFinish() method will be called and execution control will come out of it.
So suppose if you want to start some activity after 30 sec. just put that intent and sendBroadcast() in th onFinish() method.
Hope this will help you.

Friday, August 26, 2011

Android : Calling the other package activity from the current package Activity

Hi All,
After a long time one more android blog, or you can say a new problem which I encounter. In general cases we call activity using intent within the same package. but what if we want to call some other package activity. So here is the solution. Here I will be using the name convention as Calling Activity as First Activity and Called Activity as Final Activity.
Method 1 : Using setClass() method in Intent class.
It is the same thing which you do in normal scenario but with a little tweak in it. In FirstActivity where ever you want to call other activity from other package, put following code
Intent i = new Intent();
i.setClassName("com.android.finalactivity", "com.android.finalactivity.FinalActivity");
startActivity(i);
/* Here com.android.finalactivity is the package name and com.android.finalactivity.FinalActivity is full class name. */
Now go to the AndroidManifest.xml of the FirstActivity and Add following line
activity android:name=”com.samsung.finalactivity.FinalActivity” in application tag.
It will work fine.
Method 2. Using action name
For this first go to your Final Activity and Modify the Manifest file like this :
Instead of the action android :name =”android.intent.action.MAIN” Use
action android:name=”finalApplication.intent.LAUNCH”
Now go to your FirstActivity.java and write
Intent i = new Intent("finalApplication.intent.LAUNCH");
startActivity(i);
Here no need to change AndroidManifest file for FirstApplication.
Hope it helps.