Archive: January, 2012

How to use System Services in Android

import android.app.Activity;
import android.content.res.Configuration;
import android.hardware.Sensor;
import android.hardware.SensorEvent;
import android.hardware.SensorEventListener;
import android.hardware.SensorManager;
import android.os.Bundle;
import android.util.Log;
import android.view.Window;
import android.view.WindowManager;

// implement SensorListener
public class Compass extends Activity implements SensorEventListener { //

1

  SensorManager sensorManager; //

2

  Sensor sensor;
  Rose rose;

  /** Called when the activity is first created. */
  @Override
  public void onCreate(Bundle savedInstanceState) { //

3

    super.onCreate(savedInstanceState);

    // Set full screen view

4

    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
        WindowManager.LayoutParams.FLAG_FULLSCREEN);
    requestWindowFeature(Window.FEATURE_NO_TITLE);

    // Create new instance of custom Rose and set it on the screen
    rose = new Rose(this); //

5

    setContentView(rose); //

6

    // Get sensor and sensor manager
    sensorManager = (SensorManager) getSystemService(SENSOR_SERVICE); //

7

    sensor = sensorManager.getDefaultSensor(Sensor.TYPE_ORIENTATION); //

8

    Log.d("Compass", "onCreated");
  }

  // Register to listen to sensors
  @Override
  public void onResume() {
    super.onResume();
    sensorManager.registerListener(this, sensor,
        SensorManager.SENSOR_DELAY_NORMAL); //

9

  }

  // Unregister the sensor listener
  @Override
  public void onPause() {
    super.onPause();
    sensorManager.unregisterListener(this); //

10

  }

  // Ignore accuracy changes
  public void onAccuracyChanged(Sensor sensor, int accuracy) { //

11

  }

  // Listen to sensor and provide output
  public void onSensorChanged(SensorEvent event) { //

12

    int orientation = (int) event.values[0]; //

13

    Log.d("Compass", "Got sensor event: " + event.values[0]);
    rose.setDirection(orientation); //

14

  }

  @Override
  public void onConfigurationChanged(Configuration newConfig) {
    super.onConfigurationChanged(newConfig);
  }

}

=======================================================\
import android.content.Context;
import android.graphics.Canvas;
import android.widget.ImageView;

public class Rose extends ImageView { //

1

  int direction = 0;

  public Rose(Context context) {
    super(context);

    this.setImageResource(R.drawable.compassrose); //

2

  }

  // Called when component is to be drawn
  @Override
  public void onDraw(Canvas canvas) { //

3

    int height = this.getHeight();  //

4

    int width = this.getWidth();

    canvas.rotate(direction, width / 2, height / 2); //

5

    super.onDraw(canvas); //

6

  }

  // Called by Compass to update the orientation
  public void setDirection(int direction) { //

7

    this.direction = direction;
    this.invalidate(); // request to be redrawn

8

  }

}

=======================================================


		
		
		 		     
		     

What are the factors considered for SEO in 2012

SEO is an evolving process. It doesn’t remain static for a year at a time ever. The Internet and the way that consumers use it changes all of the time and SEOs must respond to that. In addition, Google and Bing alike are getting better at delivering higher quality results – in essence at the expense of poor quality ones. This is great for users and great for search professionals whose processes are focused on quality.

SEO is an evolving process. It doesn’t remain static for a year at a time ever. The Internet and the way that consumers use it changes all of the time and SEOs must respond to that. In addition, Google and Bing alike are getting better at delivering higher quality results – in essence at the expense of poor quality ones. This is great for users and great for search professionals whose processes are focused on quality.

Here’s what I believe will matter the most in SEO in 2012.

Factors considered for SEO in 2012

Content
Not just text content, but images and videos as well. Producing content that isn’t only unique but that is original to your website will give you a smiley face from the search giant. The search landscape was turned upside down by the Panda algorithm update and Google continues to release updates all geared towards identifying poor quality websites.

A content strategy is essential for SEO in 2012.

Social Media
Both Google and Bing are using social factors in their ranking algorithms. SEOs and brands alike have to respond. It’s not just about ‘having a profile,’ either. It’s about encouraging an audience to engage with you – a genuine one. Social isn’t something that can be manipulated.

Brand
This works with social to a large degree. I’m not trying to say that only major brands or companies who advertise on TV will ever succeed in search. Far from it. But Google has placed emphasis on an online brand presence for some time now and I believe that as the search engines move to clear up spam and poor quality results, this will play a bigger part. Things like the number of people who search for your online etc will be important and I also believe that a Google Places listings and social media presence will help to ‘verify’ your website as a brand.

Users
How users interact with your site does matter and will matter more. Factors such as load speed have been confirmed to matter. But so too do factors like how long people stay on your site before returning to search. If a user clicks on your website after searching for something and then bounces right back to the search results to find an alternative within a matter of seconds, this a clear indicator (if it happens a lot) to the search engines that you are not delivering what users searching this keyword are looking to find. That, surely, raises questions as to whether your website is one they would want to rank highly for that keyword. This should certainly be something you take into account when doing your keyword research. Consider the relevancy of your keyword choices.

Microdata
The launch of standardized microdata in the form of Schema.org in June 2011 was notable. Google recently released 10 videos on how to implement Schemas and the search engine seems to be placing ever more importance on the use of it. Given how much additional information (e.g. review stars, maps, lists etc) that are beginning to show for increasing numbers of searches, Schema is increasingly essential in maximizing how much SERP real estate you can claim.

Links
They still matter. That’s been the case for years and will continue to be the case in SEO in 2012. However, the search engines are getting better and better at identifying ‘genuine’ links and penalizing paid or spammy links.

This is, of course, not an exhaustive list. And by the beginning of 2013, SEO could be a whole different landscape all over again! But that’s why we love it, right?

What do you think will matter most in SEO in 2012?

Back to Top
UA-37233306-1