2011-02-15 86 views
1

我有一個BlackBerry應用程序,它在內部閃存上創建一個文件並一次又一次地讀取它。我安裝在設備上籤了字的應用程序,但每當我啓動應用程序,我得到以下錯誤:BlackBerry「本地內容」權限彈出文件打開文件

The Application text has attempted to open local content, would you like to allow this?

現在我不希望用戶按「是」一次又一次,因爲它實際上是frustating - - 我的應用程序多次訪問該文件,因此有多個提示。

我在下面發佈了一個解決方案。但這不是一個可以接受的解決方案。我不能要求用戶在聯機和脫機時重複啓用和禁用防火牆。有更好的解決方案嗎?我使用的BlackBerry OS 4.5

 
    unacceptable solution: 
    Work around: 
    If I want to use offline mode, i have to turn firewall enabled: 
    1. Turn on the firewall (Options > Security > Firewall > Enabled) 

    For online mode, turn firewall disabled: 
    1. Turn off the firewall (Options > Security > Firewall > Disabled) 
    2. When I run my application, there will be only one pop-up asking for 
     permission to connect,allow it. 

回答

1

你可以做的是有你的應用程序檢查,看是否有在啓動時正確的權限,並提示用戶設置權限,暫時或永久。請參閱ApplicationsPermissions.invokePermissionsRequest方法。還有一個很好的asking for permissions tutorial顯示如何做到這一點。

+0

不適用於4.5 atleast,我認爲這可能適用於更高的操作系統,但肯定它不適用於我的設備(4.5)...仍在尋找解決方案:( – 2011-02-23 13:44:00