开发者

Process does not show in android

I have an application that I wrote which is the following package "com.pack" . When i launch the app, I dont see the "com.pack" in the list of processes being shown in the device in DDMS. How is that possible does anybody know why ? Here is the code and the xml manifest file.

package com.pack;

import java.util.List;

import java.util.Timer;
import java.util.TimerTask;

import android.app.Activity;
import android.content.ComponentName;
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.graphics.PorterDuff.Mode;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.text.format.Time;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;

import com.android.internal.telephony.CallManager;
import com.android.internal.telephony.Phone;
import com.android.internal.telephony.Call;
import com.android.internal.telephony.PhoneFactory;

public class AutoVT extends Activity {

    public static final int MAKE_CALL           = 1;

    public static final int END_CALL            = 2;

    public static final int PHONE_STATE_CHANGED = 101;

    //CallManager mCM;

    Button callButton ;

    ActivityInfo info =null; 

    ComponentName component ;

    String callperiod_text;

    String waitperiod_text;

    String number;

    public int callPeriod=0;

    public int waitPeriod = 0;

    @Override
    public void onCreate(Bundle savedInstanceState) {

        Log.i("AutoVT","starting AutoVT");

        //registerForPhoneStates();

        super.onCreate( savedInstanceState );

        setContentView( R.layout.main );

        callButton = (Button)findViewById(R.id.callButton);

        callButton.getBackground().setColorFilter(0xFFFF0000,Mode.MULTIPLY);

        callButton.setOnClickListener(new OnClickListener() {

            public void onClick(View v) {

                callperiod_text   =  ( ( ( EditText )findViewById( R.id.call_period )).getText()).toString();

                waitperiod_text   =  ( ( ( EditText )findViewById( R.id.wait_period )).getText() ).toString();

                number =  ( ( ( EditText )findViewById( R.id.PhoneNumber )).getText() ).toString();

                if( !callperiod_text.equals("")&& !waitperiod_text.equals("") && ! number.equals("")) {

                    callPeriod = (Integer.valueOf( callperiod_text ))*1000;

                    waitPeriod = (Integer.valueOf( waitperiod_text ))*1000;

                    phoneHandler.sendEmptyMessage(MAKE_CALL);
开发者_运维百科

                }

            }

        });

    }

    private Handler phoneHandler = new Handler() {

        public void handleMessage(Message msg) {

            Log.i("AutoVT received some message:", msg.toString());

            switch(msg.what) {

                case PHONE_STATE_CHANGED: {

                    Log.i("AutoVT","Phone State Changed");

                    Log.i("AutoVT", mCM.getActiveFgCallState() );

                    if( mCM.getActiveFgCallState() == Call.State.ACTIVE ) {

                        Log.i("AutoVT","Call ACTIVE");

                        final Timer timer = new Timer();

                        Log.i("AutoVT","Active timer started");

                        timer.scheduleAtFixedRate( new TimerTask() {

                            int count = 0;

                            public void run() {

                                if( count++ >=1) {

                                    timer.cancel();

                                    runOnUiThread(new Runnable() {

                                        @Override
                                        public void run() {

                                            phoneHandler.sendEmptyMessage(END_CALL);

                                        }
                                    });

                                }                               
                            }
                        }, 0, callPeriod );

                    } else if( mCM.getActiveFgCallState() == Call.State.DISCONNECTED ) {

                        Log.i("AutoVT","Call DISCONNECTED");

                        final Timer timer =new Timer();

                        Log.i("AutoVT","Waiting timer started");

                        timer.scheduleAtFixedRate( new TimerTask() {

                            int count = 0;

                            public void run() {

                                if( count++ >=1) {

                                    timer.cancel();

                                    runOnUiThread(new Runnable() {

                                        @Override
                                        public void run() {

                                            phoneHandler.sendEmptyMessage(MAKE_CALL);

                                        }
                                    });

                                }                               
                            }
                        }, 0, waitPeriod );


                    }

                    break;

                }

                case MAKE_CALL : {

                    Log.i("AutoVT","In the case MAKE_CALL");

                    Intent callIntent = new Intent(Intent.ACTION_CALL_PRIVILEGED,Uri.fromParts("tel", number,null));

                    callIntent.putExtra("videocall", true);

                    callIntent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP| Intent.FLAG_ACTIVITY_NEW_TASK);

                    getApplicationContext().startActivity(callIntent);

                    break;
                }

                case END_CALL :{

                    Log.i("AutoVT","In the case END_CALL");

                    Intent callEndIntent = new Intent();

                    callEndIntent.setAction("com.android.phone.END");

                    sendBroadcast(callEndIntent);

                    break;
                }

            }

        }

    };

}

XML manifest

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.pack"
      android:versionCode="1"
      android:versionName="1.0">


    <application android:icon="@drawable/icon" android:label="@string/app_name">
        <activity android:name=".AutoVT"
                  android:label="@string/app_name">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

    </application>
</manifest>


  1. go to your android-sdk/tools directory.
  2. go in adb shell if you are in linux ./adb shell work for you.
  3. fire command dumpsys activity

and if you want to it from eclipdse then,

 DDMS -> Devices -> select your device or Emulator -> look at that window you have find
 your current running process's package name.

Thanks.


it is not process its logcate goto Windows >> Show View >> Other >> click on logcate and run your project so it will display

i think you need this

and also use

 System.out.println(); 

for message generation in logcate

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜