BlackBerry Forums Support Community
              

Closed Thread
 
Thread Tools
Old 05-23-2008, 05:32 AM   #1
ajj_dev@yahoo.com
Knows Where the Search Button Is
 
Join Date: May 2008
Model: 7100
PIN: N/A
Carrier: Sprint
Posts: 31
Default how to set ApplicationPermissions manually

Please Login to Remove!

hi,
In my application i am using ApplicationPermission below is the code for the reference.

ApplicationPermissions ap =
ApplicationPermissionsManager.getInstance().getApp licationPermissions();
form.deleteAll();
Application.getApplication().addKeyListener(this);
Phone.addPhoneListener(this);
ap.addPermission(ApplicationPermissions.PERMISSION _PHONE);
ap.addPermission(ApplicationPermissions.VALUE_PROM PT);
ApplicationPermissionsManager.getInstance().invoke PermissionsRequest(ap);


as soon as i run my application it prompts me to select the permission i want to avoid this prompt screen and assign the permission manually.

any one know solution for this??

thanks
ajj
Offline  
Old 05-23-2008, 08:39 AM   #2
arunk
Talking BlackBerry Encyclopedia
 
arunk's Avatar
 
Join Date: Mar 2008
Model: 8310
PIN: N/A
Carrier: Airtel
Posts: 229
Default

Hi,

You cant change and save permission programatically ..

You can change it and request the user to save it..

if the user manually save the permissions, it will return true and otherwise false.

What I am doing in my application is, I will request and if the return value is false exit the application.

or if the return value is false you can again request..(until the user save it)


I have already posted a thread regarding this.. you can refer that to get more results...

Last edited by arunk; 05-23-2008 at 08:40 AM..
Offline  
Old 05-23-2008, 08:40 AM   #3
CELITE
Thumbs Must Hurt
 
Join Date: Dec 2005
Model: 8310
Carrier: Rogers
Posts: 138
Default

You cannot manually set the permissions yourself. That would defeat the purpose of a security notification system (the user prompts).


*EDIT* Oops you beat me to it *EDIT*

Last edited by CELITE; 05-23-2008 at 08:43 AM..
Offline  
Old 05-23-2008, 10:32 AM   #4
ajj_dev@yahoo.com
Knows Where the Search Button Is
 
Join Date: May 2008
Model: 7100
PIN: N/A
Carrier: Sprint
Posts: 31
Default i want the user to change and save the permission

hi,
In my application,i want the user to change and save the permission,
initially all the permission but be in deny state and later user can request the permission and if the return value is false exit the application.

can u give me sample code implementation for requesting the permission

thanks
ajj




Quote:
Originally Posted by arunk View Post
Hi,

You cant change and save permission programatically ..

You can change it and request the user to save it..

if the user manually save the permissions, it will return true and otherwise false.

What I am doing in my application is, I will request and if the return value is false exit the application.

or if the return value is false you can again request..(until the user save it)


I have already posted a thread regarding this.. you can refer that to get more results...
Offline  
Old 05-26-2008, 01:29 AM   #5
arunk
Talking BlackBerry Encyclopedia
 
arunk's Avatar
 
Join Date: Mar 2008
Model: 8310
PIN: N/A
Carrier: Airtel
Posts: 229
Default

Code:
private void requestApplicationPermissions() {
                        //      Set permissions for the application
                try{
                    ApplicationPermissions ap1 = ApplicationPermissionsManager.getInstance().getApplicationPermissions();
                    ApplicationPermissions ap2 = new ApplicationPermissions();
                    boolean needPermission=false;
                    if(ap1.getPermission(ApplicationPermissions.PERMISSION_PHONE)!=ApplicationPermissions.VALUE_ALLOW ){
                        needPermission=true;
                        ap2.addPermission(ApplicationPermissions.PERMISSION_PHONE);                                               
                    }
                    if(ap1.getPermission(ApplicationPermissions.PERMISSION_EVENT_INJECTOR)!=ApplicationPermissions.VALUE_ALLOW ){
                        needPermission=true;
                        ap2.addPermission(ApplicationPermissions.PERMISSION_EVENT_INJECTOR);
                        ap2.addPermission(ApplicationPermissions.PERMISSION_IDLE_TIMER);
                        ap2.addPermission(ApplicationPermissions.PERMISSION_CHANGE_DEVICE_SETTINGS);
                    }
                    if(needPermission){
                        Dialog.inform("Please save the permissions manually");
                        boolean permission=ApplicationPermissionsManager.getInstance().invokePermissionsRequest(ap2);
                        if(!permission){
                                                        Status.show("Application is exiting",3000);
                            myApp.exitApplication();
                        }
                    }
            }catch(Exception e){
                        System.out.println("Exception while setting permissions"+e);                       
                }         
        }

Last edited by arunk; 05-26-2008 at 01:32 AM..
Offline  
Old 05-26-2008, 02:40 AM   #6
ajj_dev@yahoo.com
Knows Where the Search Button Is
 
Join Date: May 2008
Model: 7100
PIN: N/A
Carrier: Sprint
Posts: 31
Default

hi arunk,

Thanks for the code my application is working fine now.

sincerely
ajj
Offline  
Old 05-27-2008, 04:12 AM   #7
airan
Knows Where the Search Button Is
 
Join Date: Nov 2007
Model: 8800
PIN: N/A
Carrier: Airtel
Posts: 20
Default

I am not even able to compile the code when i use ApplicationControl classes. Is there anything specific i need to do ? I am using JDE 4.2.0
__________________
Thanks
Amit
Offline  
Old 05-27-2008, 05:57 AM   #8
arunk
Talking BlackBerry Encyclopedia
 
arunk's Avatar
 
Join Date: Mar 2008
Model: 8310
PIN: N/A
Carrier: Airtel
Posts: 229
Question

To use Application permissions you have to use

JDE 4.2.1 or higher.
Offline  
Old 05-27-2008, 11:33 PM   #9
airan
Knows Where the Search Button Is
 
Join Date: Nov 2007
Model: 8800
PIN: N/A
Carrier: Airtel
Posts: 20
Default

Thnx Arun,
compiles now ... Can u tell me which permissions to use for SMS send and HTTP send ?
__________________
Thanks
Amit
Offline  
Closed Thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


Polycom Vvx 601 VoIP 16 Line Business Phone 4.3

Polycom Vvx 601 VoIP 16 Line Business Phone 4.3" HD Touchscreen PoE With Stand

$28.95



Nextiva X-835 SIP Color Deskset VoIP Phone Black New In Box picture

Nextiva X-835 SIP Color Deskset VoIP Phone Black New In Box

$44.99



PANASONIC KX-NT553 Business IP Handset VoIP Office Phone picture

PANASONIC KX-NT553 Business IP Handset VoIP Office Phone

$49.99



Yealink SIP-T21P E2 IP Phone with Stand PoE Warranty VoIP Tested picture

Yealink SIP-T21P E2 IP Phone with Stand PoE Warranty VoIP Tested

$21.98



Panasonic KX-NT553-B IP Phone (VoIP) picture

Panasonic KX-NT553-B IP Phone (VoIP)

$45.00



Vtech ErisTerminal VSP861 Touchscreen Color Desktop - Voice-Over-IP VOIP Phone picture

Vtech ErisTerminal VSP861 Touchscreen Color Desktop - Voice-Over-IP VOIP Phone

$14.99







Copyright © 2004-2016 BlackBerryForums.com.
The names RIM © and BlackBerry © are registered Trademarks of BlackBerry Inc.