Thursday, 28 May 2015

Get Android Phone Model Programmatically


Here I am going to explain how to get mobile model and brand name programmatically in android

package com.example.get_mobilename;
import android.app.Activity;


import android.content.Context;
import android.os.Bundle;
import android.widget.Toast;

public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
String model= android.os.Build.MODEL;
String device= android.os.Build.MANUFACTURER;
Toast.makeText(getApplicationContext(), modeldevice,
Toast.LENGTH_LONG).show();
}

}
Happy coding