Saturday, July 27, 2013

Android -> Windows Phone 8 [Galaxy -> Lumia]

I just brought a Nokia Lumia 620 ( Lime Green :D ). As you can get the details about the phone on gsmarena,I am not going to describe it here again.


I was a hardcore android user and an android Developer.But Still I was interested in trying new things.So I choose WP8.When Comparing Hardware,both are almost same but still I got NFC,front camera,dual core processor for 13K from flipkart.
One thing I notice is that social networking is integrated into the operating system.Every main Application which is available on android is available on windows.Message and facebook chat is combined as thread.Gmail sync is good.Mails are received on the phone as they arrive on inbox.Nokia Music is good.Dedicated Camera button.No toggles to turn of bluetooth,wifi,etc.I have to go to settings to turn them on/off.Headphone is not good.I can toggle ring/vibrate from lockscreen. LockscreenNotifications are good we can choose which app to show in lockscreen.I think It is the most secure Mobile OS.

Saturday, July 13, 2013

Working With Google Map in Android

 First configure the sdk and import google play service


 install google play service from the sdk first
then import it to your workspace
add the imported library to your application
 choose any of the google APIs for your application





First extend the FragmentActivity class in your activity
public class MainActivity extends FragmentActivity


Declare these functions

     public GoogleMap mapView;
    private void setUpMapIfNeeded() {
        // Do a null check to confirm that we have not already instantiated the map.
        if (mapView == null) {
            // Try to obtain the map from the SupportMapFragment.
            mapView = ((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.mapview)).getMap();
            // Check if we were successful in obtaining the map.
            if (mapView != null) {
                setUpMap();
            }
        }
    }

    private void setUpMap() {
        // Hide the zoom controls as the button panel will cover it.
        mapView.getUiSettings().setZoomControlsEnabled(true);
        mapView.setMapType(GoogleMap.MAP_TYPE_NORMAL);
    }

and call the function

        setUpMapIfNeeded(); inside onCreate function





this on your layout xml
           
 <FrameLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <fragment
      android:id="@+id/mapview"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      class="com.google.android.gms.maps.SupportMapFragment"/>
    </FrameLayout>


this on your manifest file



<permission
    android:name="com.vivek.gpstrack.permission.MAPS_RECEIVE"
    android:protectionLevel="signature"/>
  <uses-permission android:name="com.vivek.gpstrack.permission.MAPS_RECEIVE"/>

    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="17" />
  <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
  <uses-permission android:name="android.permission.INTERNET"/>
  <uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
  <!-- External storage for caching. -->
  <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
  <!-- My Location -->
  <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
  <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
  <!-- Maps API needs OpenGL ES 2.0. -->
  <uses-feature
    android:glEsVersion="0x00020000"
    android:required="true"/>



    <application
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <uses-library android:name="com.google.android.maps" />
    <meta-data
      android:name="com.google.android.maps.v2.API_KEY"
      android:value="use your key here"/>

        <activity
            android:name="com.vivek.gpstrack.MainActivity"
            android:label="@string/title_activity_main"
            android:theme="@android:style/Theme.NoTitleBar" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>