LG G3 quick circle case app

Using LG G3 circle case SDK to create a demo application

What is the circle case?

LG provides a special case for it's G3 model. This case allows users to use the NFC technology, wireless charging with Qi standard (only for European market) and also has a circle hole on it's upper case side. This hole allows users to control about 1/3 of their display with a customized GUI app.

LG G3 SDK

LG released a small SDK for developers to access the functions of their circle case. To sum it up, there is a hidden magnet inside the case and a small sensor behind the screen part. So the SDK just provides a receiver for detecting opening/closing of the case.
       

public class QCircleActivity extends Activity {

 // [START]declared in LGIntent.java of LG Framework
 public static final int EXTRA_ACCESSORY_COVER_OPENED = 0;
 public static final int EXTRA_ACCESSORY_COVER_CLOSED = 1;
 public static final String EXTRA_ACCESSORY_COVER_STATE = "com.lge.intent.extra.ACCESSORY_COVER_STATE";
  public static final String ACTI;

       // . . .

        private BroadcastReceiver mIntentReceiver = new BroadcastReceiver() {
  @Override
  public void onReceive(Context context, Intent intent) {  

   //Receives a LG QCirle intent for the cover event
   if (ACTION_ACCESSORY_COVER_EVENT.equals(action)) {

    //Gets the current state of the cover
    mQuickCoverState = intent.getIntExtra(EXTRA_ACCESSORY_COVER_STATE,
      EXTRA_ACCESSORY_COVER_OPENED);

    if (mQuickCoverState == EXTRA_ACCESSORY_COVER_CLOSED) { // closed
     //Set window flags
     setQuickCircleWindowParam();
    } 
    else if (mQuickCoverState == EXTRA_ACCESSORY_COVER_OPENED) { // opened
      //Call FullScreenActivity
      Intent callFullscreen = new Intent(mContext, FullScreenActivity.class);
      startActivity(callFullscreen);
      
      //Finish QCircleActivity
      QCircleActivity.this.finish();
    }
   }
  }
 };

       // . . .
}


For the GUI part: You can use all the layout widgets but you will only see the part inside the circle hole. This can be easily remedied by any type of layout with exact margin values.
       


<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_gravity="top|center_horizontal"
    android:background="#000000">

    <RelativeLayout
        android:id="@+id/cover_main_view"
        android:layout_width="@dimen/physical_width_of_quickcircle"
        android:layout_height="@dimen/physical_height_of_quickcircle"
        android:layout_gravity="center_horizontal"
        android:background="@drawable/background">

        <!-- ... -->
    >/RelativeLayout<

</RelativeLayout>


Result of the testing

I wanted to try the circle case feature, so I decided to write a quick game. It uses accelerometer and vibration, and for storing the game scores I used Sugar ORM. The aim of the game is navigate the ship through as many gates as possible. After each passed gate the game speeds up. The User has to lean the device to control the movement of the rocket.

I also put it on Google Play Store and you can see some screenshots below.

Android app on Google Play


Comments

Popular posts from this blog

Counting dice and train wagons using computer vision

Play table

Skate tricks recognition using gyroscope