2011-09-22 4 views
0

J'ai une application que j'ai écrit qui est le paquet suivant "com.pack". Lorsque je lance l'application, je ne vois pas le "com.pack" dans la liste des processus affichés dans l'appareil dans DDMS. Comment est-ce possible que quelqu'un sache pourquoi? Voici le code et le fichier manifeste XML.Le processus ne montre pas dans android

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; 
       } 

      } 

     } 

    }; 

} 

manifeste XML

<?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> 
+0

ne traite pas son logcate goto Windows >> Afficher la vue >> Autre >> cliquez sur logcate et exécutez votre projet afin qu'il affiche –

Répondre

1
  1. aller dans votre répertoire android-sdk/tools.
  2. allez dans shell ADB si vous êtes dans Linux ./adb shell travailler pour vous.
  3. commande feu dumpsys activity

et si vous voulez à partir eclipdse puis,

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

Merci.

0

il est traite pas son logcate goto de Windows >> Voir Voir >> Autres >> cliquez sur logcate et exécutez votre projet afin qu'il affiche

i think you need this

et également utiliser

System.out.println(); 

pour la génération de messages dans logcate