언어 설정

Menu
Sites
Language
Shortcut Manager

Hi all,

I'm trying to use the AddShortcut Method in this way:

    String displayName = nameBuffer;
    String iconPath = App::GetInstance()->GetAppSharedPath() + L"res/screen-density-xhigh/mainmenu.png";
    String uriData = L"myapp://mydata/myitem";
    ShortcutManager::GetInstance()->AddShortcut(App::GetInstance()->GetAppId(), displayName, iconPath , uriData);

It works, and i've the shortcur on my home menu. If i Click on the shortcut, i got 

E/MENU_SCREEN(  635): item.c: item_launch(858) > cannot run service. ret [-2]

 

And i'm ok to this result, because i've to implement the virtual void Tizen::App::IAppControlProviderEventListener::OnAppControlRequestReceived. Can someone provide me an implementation sample? I've to invoke the Start() method on  AppControl* pAc = AppManager::FindAppControlN(L"tizen.internet", L"http://tizen.org/appcontrol/operation/view"); passing as first parameter in the pAc->Start function the uriData. Thank you in advance. 

 

 

Responses

7 댓글
kimi

HI,

Just try implementing like the following example -

 AppControl* pAc = AppManager::FindAppControlN("AppId", L"http://tizen.org/appcontrol/operation/view");
                                    if( pAc )
                                    {
                                        pAc->Start(&uri,null,null,null);
                                        delete pAc;
                                    }

You can launch the corresponding application with the appropriate uri data and AppControl.

If there is no uri then, use pAc->Start(null,null,null,null) or use LaunchApplication of the same class ApppManager of Tizen::Shell namespace.

 

Kimi.

Aniello Barletta

void
WebViewer::OnAppControlRequestReceived(RequestId reqId, const Tizen::Base::String & operationId, const Tizen::Base::String * pUriData, const Tizen::Base::String * pMimeType, const Tizen::Base::Collection::IMap * pExtraData)
{
     AppControl* pAc = AppManager::FindAppControlN("tizen.internet", L"http://tizen.org/appcontrol/operation/view");
     pAc->Start(pUriData,null,null,null);
}

This one works. Other problem: the shortcut overwrite the "original" app.. There's no way to avoid this?

kimi

Hi,

try using different AppControl - http://tizen.org/appcontrol/operation/main

 

Kimi.

Aniello Barletta

void
WebViewer::OnAppControlRequestReceived(RequestId reqId, const Tizen::Base::String & operationId, const Tizen::Base::String * pUriData, const Tizen::Base::String * pMimeType, const Tizen::Base::Collection::IMap * pExtraData)
{
    AppControl* pAc = AppManager::FindAppControlN("tizen.internet", L"http://tizen.org/appcontrol/operation/main");
    if( pAc ) {
      pAc->Start(pUriData,null,null,null);
      delete pAc;
      }
}

Ok, i've two shortcut on the menu screen. I create the shortcut from the following code:


    String displayName = nameBuffer;
    String iconPath = App::GetInstance()->GetAppSharedPath() + L"res/screen-density-xhigh/mainmenu.png";
    String uriData = urlBuffer;
    ShortcutManager::GetInstance()->AddShortcut(App::GetInstance()->GetAppId(), displayName, iconPath , uriData);

    this->Terminate();

If i click on the shortcut, the web browser opens on the uriData provided. If i try to create another shortcut, both the first and the second won't open the browser. If i delete the main app, the second shortcut remains. Where i'm wrong?

 

Aniello Barletta

Oh, and thank you for the prompt reply :)

kimi

Hi,

try using this AddShortcut method to eliminate duplication

 ShortcutManager::GetInstance()->AddShortcut(App::GetInstance()->GetAppId(), displayName, iconPath , uriData, false);

 

Kimi.

Aniello Barletta

I've tried, and it worked, but my problem is a little bit different.. I've to create on the home screen browser shortcut to web sites, So i've thinked the ShortcutManager solution could fit to me. But i need that every shortcut works indipendently from each other. It's possible?