Permission delegatio

by nguyenvuthiennga » Thu, 15 Oct 2009 18:03:49 GMT


Sponsored Links
 Hi,

I am new with Android and I just started to read about security in
Android.
I have a question.

For example, there is an application A requesting to access the
internet. There's a component B in A actually use the internet and B
is declared as public. At the installation time, application A will
ask the permission to access the internet. In this example, I assume
it is granted.
Since B is public, all other applications may use it. Or we can
generally say all other application can use the internet access.

Is it correct? I hope not.

Looking forward to any reply.
Greetings,

Nga



Other Threads

1. Very simple query <INTENT>

Hi guys
I have two queries which should be really simple for you to handle :-

1. All the applications are stored in workspace. I want to call one
application from another applications button on click listener. Is
this possible using intents?

2. How can i pass data from one activity to another. I was making
object of the activity but could not pass the data.
I think there is something called Bundle which is to be added to
intent.

-- 

2. Contact API problem with save datas

Hello I'm facing a basic problem but i didn't find any tutorial in
order to help me...

I'm writing an application with sort of backup contact options. I want
that my applications works for android phones since 1.5 to 2.2

So i write a two implementation of ContactApi, one for 1.5, 1.6 and an
other for new api version.

Here is the list of problem I'm facing with.

With new api, nothing. All works fine, backing up contacts works well.
But with older api I'm not able to backing up some datas :
 * Email Datas (able to read, but not able to save)
 * IM datas (able to read, but not able to save)
 * Notes (able to read the first note, if many notes, I lost datas,
same things for backup)


Here is the code I'm using :

=======EMAIL=======
private ArrayList<Email> getEmailAddresses(String id) {
                ArrayList<Email> emails = new ArrayList<Email>();

                Cursor emailCur =
this.contentResolver.query(Contacts.ContactMethods.CONTENT_EMAIL_URI,
null, Contacts.ContactMethods.PERSON_ID + " = ?", new String[] { id },
null);
                Email email = null;
                while (emailCur.moveToNext()) {
                        // This would allow you get several email addresses
                        email = new Email();
        
email.setData(emailCur.getString(emailCur.getColumnIndex(Contacts.ContactMethods.DATA)));
        
email.setType(emailCur.getInt(emailCur.getColumnIndex(Contacts.ContactMethods.TYPE)));
        
email.setLabel(emailCur.getString(emailCur.getColumnIndex(Contacts.PeopleColumns.NAME)));
                        emails.add(email);
                }
                emailCur.close();
                return emails;
        }

private void saveEmailAddresses(ContentUris contactUri, List<Email>
emailList, String id) {
                if (emailList != null && emailList.size() > 0) {
                        ContentValues values = null;
                        ContentValues[] valueArray = new 
ContentValues[emailList.size()];
                        int i = 0;
                        for (Email email : emailList) {
                                values = new ContentValues();
                                values.put(Contacts.ContactMethods.PERSON_ID, 
id); //
                                values.put(Contacts.ContactMethods.KIND, 
Contacts.KIND_EMAIL); //
                                values.put(Contacts.ContactMethods.DATA, 
email.getData()); //
                                values.put(Contacts.ContactMethods.TYPE, 
email.getType()); //
                                values.put(Contacts.PeopleColumns.NAME, 
email.getLabel()); //

                                valueArray[i] = values;
                                i++;
                        }

        
contentResolver.bulkInsert(Contacts.ContactMethods.CONTENT_EMAIL_URI,
valueArray);

                }
        }


======== IM adress=============

private ArrayList<IM> getIM(Cursor cur, String id) {
                ArrayList<IM> imList = new ArrayList<IM>();
                String where = Contacts.ContactMethods.PERSON_ID + " = ? AND " +
Contacts.ContactMethods.KIND + " = ?";
                String[] whereParameters = new String[] { id,
String.valueOf(Contacts.KIND_IM) };

                Cursor imCur =
this.contentResolver.query(Contacts.ContactMethods.CONTENT_URI, null,
where, whereParameters, null);
                IM im = null;
                while (imCur.moveToNext()) {
                        try {
                                String imName =
imCur.getString(imCur.getColumnIndex(Contacts.ContactMethodsColumns.DATA));
                                        im = new IM();
                                        im.setName(imName);
        
im.setType(imCur.getInt(imCur.getColumnIndex(Contacts.ContactMethodsColumns.TYPE)));
        
im.setProtocol(cur.getString(imCur.getColumnIndex(Contacts.ContactMethods.AUX_DATA)));
                                        imList.add(im);
                        } catch (Exception e) {
                                Log.e(where, "Error im : ", e);
                        }
                }
                imCur.close();
                return imList;
        }

        private void saveIM(List<IM> imList, String id) {
                if (imList != null && imList.size() > 0) {
                        ContentValues values = null;
                        ContentValues[] valueArray = new 
ContentValues[imList.size()];
                        int i = 0;
                        for (IM im : imList) {

                                values = new ContentValues();
                                values.put(Contacts.ContactMethods.PERSON_ID, 
id); //
                                values.put(Contacts.ContactMethods.KIND, 
Contacts.KIND_IM); //
                                values.put(Contacts.ContactMethodsColumns.DATA, 
im.getName()); //
                                values.put(Contacts.ContactMethods.AUX_DATA,
ContactMethods.encodeCustomImProtocol(im.getProtocol())); //
                                values.put(Contacts.ContactMethodsColumns.TYPE, 
im.getType()); //

                                valueArray[i] = values;
                                i++;

                        }
                        
contentResolver.bulkInsert(Contacts.ContactMethods.CONTENT_URI,
valueArray);

                }
        }

==========Notes =======

I have no idea how to get all notes ?




Can someone help me with this ?

best regards

-- 

3. Bos kita dan ibun di ossfest

4. Android Grid problem

5. Camera 360's Ghost templates [was: Aplikasighost radar]

6. Muhammad Ridwan telah mengirim undangan untuk Anda

7. Closed - Help: Desireku Error