Android-dev.it Community

 
Annunci

:arrow: Benvenuto!, se non sei ancora un utente registrato: puoi registrati qui, oppure effettua il login
:arrow: Apri un forum sul tuo nuovo smartphone Android e collabora con noi! (dettagli)

www.agendadigitale.org
Image


Sponsor
It is currently Fri May 18, 2012 3:31 pm

All times are UTC + 1 hour


 Topics   Replies   Views   Last post 
No new posts Новый: базы для хрумера - профессиональный софт для СЕО.

by Renatafe on Fri May 18, 2012 3:14 pm in Amministrazione

0

1

Fri May 18, 2012 3:14 pm

Renatafe

No new posts Apri un forum sul tuo nuovo smartphone Android!

[ Go to page: 1, 2, 3 ]

by MYMNTWEME on Fri May 18, 2012 12:01 pm in Amministrazione

26

12403

Fri May 18, 2012 12:01 pm

MYMNTWEME

No new posts Pace is undoubtedly the vital affordable Jerseys Wholesale d

by barnettmmolive2012 on Wed May 16, 2012 7:36 am in Amministrazione

1

44

Wed May 16, 2012 7:36 am

barnettmmolive2012

No new posts Problema di compatibilità app

by deran on Tue May 15, 2012 10:44 am in Sviluppo e programmazione in Android

4

186

Tue May 15, 2012 10:44 am

deran

No new posts Applicazione inserimento eventi

by mauro21 on Mon May 14, 2012 9:20 pm in Sviluppo e programmazione in Android

0

22

Mon May 14, 2012 9:20 pm

mauro21




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: Accesso al registro chiamate
PostPosted: Fri Dec 31, 2010 2:29 pm 
Offline
User avatar

Joined: Fri Dec 25, 2009 4:51 pm
Posts: 3
Cellulare Android: Samsung Galaxy i7500
Operatore: Wind
Punti Android: ?
Buongiorno a tutti,

vorrei sviluppare un'applicazione android che tra le altre cose possa accedere a tutte le informazioni del registro chiamate (numero del chiamante, data, ora, durata...). Mi sapreste dire dove trovare queste informazioni? C'è già una classe con dei metodi predisposti o se siano scritti in un file.

Grazie in anticipo. Buon anno!!


Top
 Profile  
 
 Post subject: Re: Accesso al registro chiamate
PostPosted: Fri Dec 31, 2010 4:17 pm 
Offline
Moderatore
User avatar

Joined: Thu Dec 27, 2007 3:51 pm
Posts: 986
Cellulare Android: HTC Dream
Operatore: TIM
Punti Android: 1320
Ciao,
puoi fare tutto quello che desideri e gestire le chiamate entranti/uscenti utilizzando le API fornite dalla classe CallLog di Android: ***URLs are hidden from guests, please register and login to view the hyperlink***
***URLs are hidden from guests, please register and login to view the hyperlink***
Se devi anche gestire le funzioni telefoniche, puoi invece usare la classe TelephonyManager: ***URLs are hidden from guests, please register and login to view the hyperlink***


Top
 Profile  
 
 Post subject: Re: Accesso al registro chiamate
PostPosted: Mon Jan 03, 2011 10:36 am 
Offline
User avatar

Joined: Fri Dec 25, 2009 4:51 pm
Posts: 3
Cellulare Android: Samsung Galaxy i7500
Operatore: Wind
Punti Android: ?
Grazie, ma ho trovato solo un metodo che dovrebbe restituire l'ultima chiamata in uscita.

A me invece interesserebbero anche quelle precedenti, in pratica tutte quelle presenti nel registro chiamate.


Top
 Profile  
 
 Post subject: Re: Accesso al registro chiamate
PostPosted: Fri Jan 14, 2011 12:17 pm 
Offline
User avatar

Joined: Thu Dec 27, 2007 7:09 pm
Posts: 659
Cellulare Android: HTC Dream
Operatore: TIM
Punti Android: 758
vinlos wrote:
Grazie, ma ho trovato solo un metodo che dovrebbe restituire l'ultima chiamata in uscita.

A me invece interesserebbero anche quelle precedenti, in pratica tutte quelle presenti nel registro chiamate.

In effetti c'è solo un metodo che ti restituisce l'ultima chiamata, ma CallLog.Calls è una classe di tipo ContentProvider che contiene tutto il database delle chiamate.
Guarda il codice di PhoneIntent.java dell'applicazione che trovi ***URLs are hidden from guests, please register and login to view the hyperlink*** per come fare a navigare sulla lista delle chimate tramite un cursor:
Code:
private String dumpCallLog() {
     String result = "Call log empty";
     String[] projection = new String[] {
       BaseColumns._ID,
       CallLog.Calls.NUMBER,
      CallLog.Calls.TYPE
     };
      Cursor managedCursor = managedQuery(
               CallLog.Calls.CONTENT_URI,
                    projection,
                    null,
                    CallLog.Calls.DEFAULT_SORT_ORDER );
      int numberColumn = managedCursor.getColumnIndex( CallLog.Calls.NUMBER );
      int typeColumn = managedCursor.getColumnIndex( CallLog.Calls.TYPE );
     while ( managedCursor.next() ) {
      String number = managedCursor.getString( numberColumn );
        String type = managedCursor.getString( typeColumn );
      String dir = null;
      try {
        int dircode = Integer.parseInt( type );
        switch( dircode ) {
         case CallLog.Calls.OUTGOING_TYPE:
            dir = "OUTGOING";
            break;

         case CallLog.Calls.INCOMING_TYPE:
            dir = "INCOMING";
            break;

         case CallLog.Calls.MISSED_TYPE:
            dir = "MISSED";
            break;
        }
      } catch( NumberFormatException ex ) {}
      if( dir == null )
         dir = "Unknown, code: "+type;
      result = dir+","+number;
      Log.d( LOG_TAG, "Number: "+number+" Type: "+dir );
     }
     managedCursor.close();
     return result;
    }

_________________
***URLs are hidden from guests, please register and login to view the hyperlink***


Top
 Profile  
 
 Post subject: Re: Accesso al registro chiamate
PostPosted: Fri Jan 14, 2011 12:25 pm 
Offline
Moderatore
User avatar

Joined: Thu Dec 27, 2007 3:51 pm
Posts: 986
Cellulare Android: HTC Dream
Operatore: TIM
Punti Android: 1320
Ciao,
trovate altri snippet di codice utili sull'argomento qui: ***URLs are hidden from guests, please register and login to view the hyperlink***


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

Topic Tags

API, CallLog, TelephonyManager


All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
SitemapIndex SitemapIndex RSS Feed RSS Feed Channel list Channel list
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
phpBB SEO

All trademarks and logos used in this site are of properties of their respective owners.