Click here to Skip to main content
14,921,505 members
Home / Discussions / Android
   

Android

 
SuggestionMessage Closed Pin
18-Dec-17 7:10
MemberMember 1358308318-Dec-17 7:10 
SuggestionMessage Closed Pin
18-Dec-17 7:15
MemberMember 1358308318-Dec-17 7:15 
QuestionQuery about swipe issue in expandable listview in android Pin
Jinal Patel26-Oct-17 23:20
MemberJinal Patel26-Oct-17 23:20 
QuestionRe: Query about swipe issue in expandable listview in android Pin
David Crow30-Oct-17 4:21
MemberDavid Crow30-Oct-17 4:21 
Questionandroid speech to text application Pin
Oluawayemi26-Oct-17 15:29
MemberOluawayemi26-Oct-17 15:29 
AnswerRe: android speech to text application Pin
Richard MacCutchan26-Oct-17 22:10
mveRichard MacCutchan26-Oct-17 22:10 
GeneralRe: android speech to text application Pin
Oluawayemi30-Oct-17 15:16
MemberOluawayemi30-Oct-17 15:16 
QuestionWhy my Android application can't run. Pin
hmanhha20-Oct-17 6:57
Memberhmanhha20-Oct-17 6:57 
I Use Android Studio to write my application using telephonymanager .
The manifest is here.

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.myapplication">
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
    <uses-permission android:name="android.permission.CHANGE_NETWORK_STATE"/>
    <uses-permission android:name="android.permission.READ_PHONE_STATE"/>
    <uses-permission android:name="android.permission.ACCESS_COARSE_UPDATES"/>
    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        <activity android:name=".MainActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>



I have remember to add permission.
And The Main Activity Java code is here

package com.example.myapplication;

import android.content.Context;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.telephony.TelephonyManager;
import android.widget.TextView;

public class MainActivity extends AppCompatActivity {
TextView tv;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

tv=(TextView)findViewById(R.id.tv);
TelephonyManager TM =(TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE);
String IMEI= TM.getDeviceId();
String SubcriberNumber = TM.getLine1Number();
String ISO = TM.getSimCountryIso();
String Operator = TM.getNetworkOperator();
String SimoperatorName = TM.getSimOperatorName();

int Phone=TM.getPhoneType();
String StrPhoneType;
switch (Phone)
{
case (TelephonyManager.PHONE_TYPE_CDMA):
StrPhoneType ="CDMA Phone";
break;
case (TelephonyManager.PHONE_TYPE_GSM):
StrPhoneType ="GSM Phone";
break;
case (TelephonyManager.PHONE_TYPE_NONE):
StrPhoneType ="NONE";
break;
}
boolean isRoaming =TM.isNetworkRoaming();
String info = "Phone Detail";
info+= "\n IMEI Number"+ IMEI;
info+= "\n Sub Number"+ SubcriberNumber;
info+= "\n ISO Number"+ ISO;
info+= "\n Operator "+ Operator;
info+= "\n SIM Operator Name " + SimoperatorName;
//info+= "\n Phone type " + StrPhoneType;
info+= "\n Is Roamming " + isRoaming;
tv.setText(info);




}
}


But the App can't run.
Please help
AnswerRe: Why my Android application can't run. Pin
David Crow22-Oct-17 17:07
MemberDavid Crow22-Oct-17 17:07 
SuggestionRe: Need help with optimisation Pin
David Crow6-Oct-17 3:13
MemberDavid Crow6-Oct-17 3:13 
Questionhow to write POST methdod to PHP Pin
sadaiyappan_5-Oct-17 23:42
Membersadaiyappan_5-Oct-17 23:42 
QuestionRe: how to write POST methdod to PHP Pin
Richard MacCutchan6-Oct-17 1:11
mveRichard MacCutchan6-Oct-17 1:11 
AnswerRe: how to write POST methdod to PHP Pin
sadaiyappan_6-Oct-17 18:54
Membersadaiyappan_6-Oct-17 18:54 
GeneralRe: how to write POST methdod to PHP Pin
Richard MacCutchan6-Oct-17 22:02
mveRichard MacCutchan6-Oct-17 22:02 
GeneralRe: how to write POST methdod to PHP Pin
sadaiyappan_6-Oct-17 22:05
Membersadaiyappan_6-Oct-17 22:05 
GeneralRe: how to write POST methdod to PHP Pin
Richard MacCutchan6-Oct-17 22:13
mveRichard MacCutchan6-Oct-17 22:13 
QuestionRe: how to write POST methdod to PHP Pin
David Crow7-Oct-17 14:45
MemberDavid Crow7-Oct-17 14:45 
AnswerMessage Closed Pin
9-Oct-17 21:00
MemberMember 134557939-Oct-17 21:00 
QuestionShow a ProgressDialog inside a Fragment that is injected in a Tab Pin
Vimalsoft(Pty) Ltd30-Sep-17 5:54
professionalVimalsoft(Pty) Ltd30-Sep-17 5:54 
QuestionRe: Show a ProgressDialog inside a Fragment that is injected in a Tab Pin
David Crow2-Oct-17 3:09
MemberDavid Crow2-Oct-17 3:09 
AnswerRe: Show a ProgressDialog inside a Fragment that is injected in a Tab Pin
Vimalsoft(Pty) Ltd2-Oct-17 7:11
professionalVimalsoft(Pty) Ltd2-Oct-17 7:11 
QuestionRe: Show a ProgressDialog inside a Fragment that is injected in a Tab Pin
David Crow2-Oct-17 7:14
MemberDavid Crow2-Oct-17 7:14 
AnswerRe: Show a ProgressDialog inside a Fragment that is injected in a Tab Pin
Vimalsoft(Pty) Ltd2-Oct-17 7:25
professionalVimalsoft(Pty) Ltd2-Oct-17 7:25 
QuestionRe: Show a ProgressDialog inside a Fragment that is injected in a Tab Pin
David Crow2-Oct-17 7:30
MemberDavid Crow2-Oct-17 7:30 
AnswerRe: Show a ProgressDialog inside a Fragment that is injected in a Tab Pin
Vimalsoft(Pty) Ltd2-Oct-17 7:37
professionalVimalsoft(Pty) Ltd2-Oct-17 7:37 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.