Hi,
I created a service whose handleMessage() is triggered by a remote 
activity. works fine...

then, wanted to add a check that the remote activity has the required 
permission so added a call for 
*checkCallingPermission("android.permission.INTERNET")*; and added 
*<uses-permission 
android:name="android.permission.INTERNET"/>*  to the remote activity.

still, at the service side, checkCallingPermission() always returns -1
see code from service below.

any idea?

thanks!


    class IncomingHandler extends Handler {
        @Override
        public void handleMessage(Message msg) {            
            String dataString = msg.getData().getString("MyString");
            dataString += isCallingClientHasPermissions()? "\nAuthorized" : 
"\nNot authorized";
            Toast.makeText(getApplicationContext(), dataString, 
Toast.LENGTH_LONG).show();
        }
     }
    
    
    private boolean isCallingClientHasPermissions(){
       * int ret = 
getApplicationContext().checkCallingPermission("android.permission.INTERNET"); 
//always returns -1 :-<*
        boolean authorized = ret == PackageManager.PERMISSION_GRANTED; 
//always false :-<
        return authorized;
    }

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to