How to display local HTML/CSS in a webview?

How to display local HTML/CSS in a webview?

BY 08 May 2013 Native Application Development

Hello

I am new to Tizen, and I need your advice to make it work.

I created a “new tizen native project”, then I selected “empty application”.

After that I added into the “res” directory some “index.html”.

I want to figure out what is the minimum code to just display this index.html full screen when the application is launched.

I only modified two files. And I called my app “koko” because I thought it sounded well, don’t you.

This is what I tried :

> koko.cpp :
I added : using namespace Tizen::Web::Controls; So now I have :
using namespace Tizen::App;
using namespace Tizen::Base;
using namespace Tizen::System;
using namespace Tizen::Ui;
using namespace Tizen::Ui::Controls;
using namespace Tizen::Web::Controls;

And bellow I have this code, I which I only added the bold part :

bool
kokoApp::OnAppInitializing(AppRegistry& appRegistry)
{
    // TODO:
    // Initialize App specific data.
    // The App's permanent data and context can be obtained from the appRegistry.
    //
    // If this method is successful, return true; otherwise, return false.
    // If this method returns false, the App will be terminated.

    // Uncomment the following statement to listen to the screen on/off events.
    //PowerManager::SetScreenEventListener(*this);

    // Create a Frame
    kokoFrame* pkokoFrame = new kokoFrame;
    pkokoFrame->Construct();
    pkokoFrame->SetName(L"koko");
    AddFrame(*pkokoFrame);

    // LAUNCH THE WEBVIEW
    LoadUrl();

    // TODO: Add your initialization code here
    return true;
}

That is all, then I added the LoadUrl method in koko.h :

> koko.h :
public:
    void
    LoadUrl(void)
    {
        Tizen::Web::Controls::Web* pWeb = new Tizen::Web::Controls::Web();

        pWeb->LoadUrl(L"http://www.tizen.org");
    }

(Note : I tried with L”http://www.tizen.org” to be sure it worked but then I’ll change for this : L”file:///opt/usr/apps/koko/res/index.html”)

The build is ok, but when I try on the emulator, the application doesn’t even get launched. I looked at the log, I get :

ERROR / Tizen::Ui ( 2584 : 2584 ) : Tizen::Ui::_KeyEventManagerImpl::_KeyEventManagerImpl() (146). > [E_SYSTEM] pKeyMgr == null
ERROR / Tizen::Base ( 2584 : 2584 ) : result Tizen::Base::String::SubString(int, Tizen::Base::String&) const (1113). > [E_OUT_OF_RANGE] The startIndex(11) MUST be greater than or equal to 0, and less than the length of this string(11).
ERROR / Tizen::Base ( 2584 : 2584 ) : result Tizen::Base::String::SubString(int, Tizen::Base::String&) const (1113). > [E_OUT_OF_RANGE] The startIndex(11) MUST be greater than or equal to 0, and less than the length of this string(11).
ERROR / Tizen::Security ( 2043 : 2043 ) : static result Tizen::Security::_PrivilegeManager::RetrieveCipherPrivilegeEx(const Tizen::App::AppId&, Tizen::Base::String&, Tizen::Base::String&) (233). > [E_DATA_NOT_FOUND] The privilege information does not exist.
ERROR / Tizen::Security ( 2584 : 2584 ) : static void Tizen::Security::_AccessController::Initialize() (172). > Failed to retrieve privilege information
ERROR / Tizen::Security ( 2584 : 2584 ) : static result Tizen::Security::_AccessController::CheckUserPrivilege(Tizen::Security::_Privilege) (223). > [E_DATA_NOT_FOUND] The privilege information does not exist.
ERROR / Tizen::Security ( 2584 : 2584 ) : static result Tizen::Security::_AccessController::CheckUserPrivilege(Tizen::Security::_Privilege) (262). > [E_PRIVILEGE_DENIED] The application does not have the privilege to call this method.
ERROR / Tizen::Web::Controls ( 2584 : 2584 ) : void Tizen::Web::Controls::Web::LoadUrl(const Tizen::Base::String&) (89). > [E_PRIVILEGE_DENIED] The application does not have the privilege to call this method.

(I don’t understand most of the above).

Do you have any advice so It could work ??

Please help ><

Jean

Written by