Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Unity 3D + Blackberry 10 + SQLite Examples

Discussion in 'BlackBerry' started by MohanadHamed, Apr 14, 2014.

  1. MohanadHamed

    MohanadHamed

    Joined:
    Sep 18, 2013
    Posts:
    3
    Hi All,

    I have been able to query from sqlite database in BlackBerry 10.

    For Mac and PC you can connect to to sqlite easily as in the following code (suppose that your database is located directly inside assets directory):

    Code (csharp):
    1.  
    2.  
    3. private IDbConnection dbcon;
    4.  
    5. public void OpenDB(string p)
    6. {
    7.  
    8.     connection = "URI=file:" + Application.dataPath + "/sample.sqlite"; // this will work on MAC and PC but will not work on BB10
    9.  
    10.     dbcon = new SqliteConnection(connection);
    11.  
    12.     dbcon.Open();
    13.  
    14. }
    But for BlackBerry 10 I have done the following tricks to access database:
    1- Create a folder with name "StreamingAssets" and paste your database directly inside its root.
    2- Use the path Application.streamingAssetsPath instead of Application.dataPath as in the following sample code:
    Code (csharp):
    1.  
    2.  
    3. private IDbConnection dbcon;
    4.  
    5. public void OpenDB(string p)
    6. {
    7.  
    8.     connection = "URI=file:" + Application.streamingAssetsPath + "/sample.sqlite"; // this will work  successfully on BB10 device
    9.  
    10.     dbcon = new SqliteConnection(connection);
    11.  
    12.     dbcon.Open();
    13.  
    14. }
    Enjoy,
    Mohanad Hamed,
    Sr. Mobile Developer
    RaheebGames