icesimon's Blog

  • About Me
  • Archive
  • feeds

Posts match “ Cascades ” tag:

almost 9 years ago

How to debug webview inside the Cascades applications on BlackBerry 10

Developing on BlackBerry 10 is very easy in many phases.
By Native C/C++, HTML5, Adobe AIR, or Android, developers can easily bring their apps to this new platform.

I like to create "Hybrid App" on BlackBerry 10, whichcontains HTML5 and the native Cascades UI Framework.
The reason why I choose using hybrid apps are because by HTML5 I can do some drawing things, and by Cascades framework I can make my apps have uniformed UI and also the awesome native APIs!

Basically hybrid apps are using webview to load html files, but how can we debug the HTML code when them be wrapped into webview?

The answer is very easy! Use the WebInspector!

  1. Check the QML properties of WebView component, checked the "Web Inspector Enabled".

  2. Next, you can simply connect your devices / simulator to the computer, open the browser and type:

For USB connection: 169.254.0.1:1337
For Simulator of Wifi conection: IP + port 1337

  1. The view of connecting to webinspector

  2. Click into it and you can see the console!

See, is that easy?
Come and try to debug in WebInspector now :D

  • Cascades
  • Webview
  • HTML5
  • Debug
  • console
  • BlackBerry
  • Hybrid
  • May 30, 2014 17:35
  • Permalink
  • Comments
 
over 8 years ago

How to check debug messages in Cascades?

Just use some simple steps can let you check debug messages!

  1. Open the main.cpp in your project. Only need to add two code snippets!

  2. First: Insert this before int main

    void myMessageOutput(QtMsgType type, const char* msg) 
    

    {
    std::fprintf(stdout, "%s\n", msg);
    std::fflush (stdout);
    }

  3. Second:Inset snippet after Application app(argc, argv);

    qInstallMsgHandler(myMessageOutput);
    
  4. Here are the whole code snippets

    void myMessageOutput(QtMsgType type, const char* msg) 
    {
        std::fprintf(stdout, "%s\n", msg);
        std::fflush(stdout);
    }
    Q_DECL_EXPORT int main(int argc, char **argv) 
    {
        Application app(argc, argv);
        qInstallMsgHandler(myMessageOutput);
    
        // localization support
        QTranslator translator;
        QString locale_string = QLocale().name();
        QString filename = QString( "YourApp_%1" ).arg( locale_string );
        if (translator.load(filename, "app/native/qm")) 
        {
            app.installTranslator( &translator );
        }
        new YourApp(&app);
        return Application::exec();
    }
    

Enjoy all your dubeg messages! ^^

  • BlackBerry
  • Cascades
  • Debug
  • BB10
  • QML
  • c++
  • June 29, 2014 14:47
  • Permalink
  • Comments
 
over 8 years ago

Smaato - Advertisement service for BlackBerry 10 Cascades Apps

-- Updated 2014-07-04 --
If you downloaded the sample project yesterday, you need to re-download the project.
This version fix the "applicationUI.hpp" can't be found problem.
And, don't forget this or your will got an erro of "cannot find -lSmaatoSDKDevice"
The Smaato static library included within the sample is from Smaato SDK for BlackBery 10 v1.1.2. To ensure you are running the latest, please download the latest SDK for Smaato's website and replace the SmaatoSDK folder within the project.

BlackBerry announced Smaato as their new Advertisement service partner on BlackBerry 10.
I've used Smaato in my apps for a long time (since 2013/10, after Jam Asia).

Let's see how to integrated Smaato SDK into your Cascades apps!

1. Read the introduction about Smaato!

http://devblog.blackberry.com/2014/07/smaato/

2. Download the Smaato sample project from BlackBerry Github

https://github.com/blackberry/Cascades-Community-Samples/tree/master/SmaatoAdSDKSample

3. Download the Smaato SDK

http://www.smaato.com/sdks/

<1> You need to sign up or login first


<2> Go to SDK Download page


<3> Select BlackBerry 10 SDK and download it!

<4> Check the downloaded folder and extract the file "Smaato-SmaatoSDK-BB10-v1.1.3-2014-07-02-A.zip"


<5> Copy the "SmaatoSDK" folder and replace the SmaatoSDK folder within the project.


4. Build the project and see how the AD works!


5. Input your own adSpaceId and publisherId and check the advertisements in your apps!

That's it! Actually it is really an easy way to put Ads in your apps.
You can also add more filters/ restrictions to help they provide much more precisely ads for your apps.

Sometimes due to the fillrate or regional issue, you may not receive ads...
Don't worry, try to change the category of ads you'd like to show.

Enjoy this new AD Service on BlackBerry 10!

  • BlackBerry10
  • BlcakBerry
  • Cascades
  • Advertisement
  • ad
  • Smaato
  • sdk
  • github
  • Sample
  • Simon
  • July 05, 2014 00:59
  • Permalink
  • Comments
 
over 8 years ago

[Tips] 'Unresponsive’ or ‘Unable To Terminate' your bb10 app when coding?

How To Squash ‘Unresponsive’ or ‘Unable To Terminate’ Errors When Debugging your BB10 App on Device

THERE ARE TWO WAYS TO RESOLVE THESE ERRORS

1) Restart your BB10 Dev Alpha, then turn Dev Mode on (take a few mins)

2) Kill the app manually via Momentics IDE I will show you how to quickly kill the app using the following steps. Follow along. (take a few seconds)

Open Target Navigator

Window - Show View - Target Navigator

Locate Device Process

Go Under Device Ip - Select Process

Send Signal To Application

Go Under Device Ip - Select Process - Right Click - Click Deliver Signal

Terminal Process/App Manually

Select SIGTERM option - Press OK

That’s it!

After you send the SIGTERM (Signal Terminate) your unresponsive app will disappear from the BB10 device. Success! Now, build (CTRL+B), deploy (CTRL+11) and test again.

  • Cascades
  • Debug
  • Tips
  • BlackBerry
  • Unresponsive
  • Unable-to-terminate
  • depoly
  • signal
  • SIGTERM
  • July 09, 2014 22:17
  • Permalink
  • Comments
 
over 8 years ago

Create GuidePage in Cascades

As a developer, I think many other developers may think how to teach users to use my application
We provide screenshots of the apps when we upload to any app markets, some devs will also record a video to tell users who to operate.

The most common way is to put a "Guide Page" inside the app, not just "Tips", but a continuous information to let user understand the major features.

There are three kinds of implementations here.

1. Use a scrollview with a super large image

Advantage:

You can simply scroll from left to right, put a button at the last page to close this Guide Page.

Disadvantage:

The image may be too large, and hard to change / modify parts.

2. Use a scrollview with several images

Advantage:

You can simply scroll from left to right, put a button at the last page to close this Guide Page, can change parts easier than first method.

Disadvantage:

Still hard to change / modify parts.

3. Use a scrollview with custom containers

Advantage:

Custom containers are much more flexible

Disadvantage:

I don't know, haha!

Here are the sample from Github

For Cascades 10.1 /10.2 SDK

https://github.com/icetingyu/AppGuidePage

For Cascades 10.3 SDK

https://github.com/icetingyu/AppGuidePageDesignUnit

In AppGuidePageDesignUnit project, I rewrite the project with design unit to support even Q30 (Passport), not just pixel related.
If you also want to learn use design unit, you can also check this project :D

If you have any problem, just send me a mail!
bsebadmin@gmail.com

Hope you will enjoy the sample!

Simon

  • BlackBerry
  • BlackBerry10
  • Cascades
  • 10.1
  • 10.2
  • 10.3
  • guide
  • Page
  • Sample
  • Containter
  • image
  • ScrollView
  • DesignUnit
  • pixel
  • July 26, 2014 12:26
  • Permalink
  • Comments
 
over 7 years ago

Debug Tips for BB10 Headless apps.

Debug BB10 Headless Apps is really a hard topic for developers.
Before the latest Momentics update, debug is even harder..

By Momentics 2.1.2, developers can follow this instruction to debug your headless apps.

https://developer.blackberry.com/native/documentation/dev/tools/debugging_headless_apps.html

Here I am going to share my experience for debugging headless apps.
I put the logs into notification and show them in Hub!
If you have some problems on debugging headless apps on BlackBerry 10, maybe this trick can help you and save lots of time! :)

GOGOGO, keep developing on BlackBerry 10!

  • Tips
  • Momentics
  • Cascades
  • BlackBerry
  • BlackBerry10
  • headless
  • Debug
  • July 04, 2015 22:19
  • Permalink
  • Comments
 
over 7 years ago

BB10 connect problem on Mac OS X 10.11 El Capitan

Last Friday I updated my iMac to Mac OS X 10.11 (El Capitan), a nightmare for my whole weekend..

After upgraded, BlackBerry Link no longer recognize my BlackBerry 10 devices.
From Dev Alpha B to Passport.. Just keep showing "Can't connect to your BlackBerry 10 device, press restore.." etc

And then I tried to open my Momentics IDE...


What the....

I think the problem may be the USB driver or connection.
So I did some test.

  1. Reinstall Mac OS X 10.11 (El Capitan)

    Still has the same problem.

  2. Uninstall BlackBerry Link & Blend and reinstall them

    Still has the same problem.

  3. Only install BlackBerry Link

    Oh my God, it works!!

  4. I did more test, but in those tests, once you install BlackBerry Link first and then install the BlackBerry Blend, the connections will all fine!

  5. If you don't need BlackBerry Link, simply uninstall it and just use your Momentics for connecting your BB10 device to debug is also a solution.

    (But for me, I still need Link for backup/restore and Blend to type in Chinese... Can someone tell me why BlackBerry remove the Zhuyin input method on Passport!!)

Just a simple tips and work around for you guys may occur!

Happy Coding!

  • BlackBerry
  • BlackBerry10
  • BB10
  • mac
  • 10.11
  • El
  • Capitan
  • Momentics
  • BlackBerryLink
  • link
  • Blend
  • problem
  • tip
  • Cascades
  • Connect
  • October 06, 2015 07:58
  • Permalink
  • Comments
 
over 7 years ago

Keep Screen awake - BB10 Dev

Sometimes we need to keep our app always awake (not dim due to the Screen timeout).

How to make this happen?
The answer is ver simple :D
Jusy put the code into your QML file

Application.mainWindow.screenIdleMode = 1

(1 means KeepAwake, and 0 means Default).

Please be careful, this effect only works when the app is in full screen mode
Once you minimize the app (in Active Frame mode), the screen will still follow the screen timeout rule to dim.

Hope you enjoy this trick!

Simon

  • BlackBerry
  • BlackBerry10
  • Cascades
  • awake
  • dim
  • screen
  • QML
  • application
  • Tips
  • October 08, 2015 20:49
  • Permalink
  • Comments
 
over 7 years ago

Change Screen Brightness - BB10Dev

Sometimes we may need to change the brightness of screen in code.
How to make it happen?
Using the QProcess can help you to do that!

QString program = "bkltctl";
QProcess myProcess = new QProcess(this);
QStringList arguments;
arguments << "brightness" << "set_brightness" << "display" << "50"; (50 is the value you want).
myProcess->start(program, arguments);

PS. You may need to connect SINGAL readyReadStandardError(), readyReadStandardOutput() and finished(int, QProcess::ExitStatus) in order to get the output error or result. :)

Enjoy it!

  • BlackBerry
  • BlackBerry10
  • BB10
  • Cascades
  • development
  • screen
  • brightness
  • Modification
  • Tips
  • October 10, 2015 16:34
  • Permalink
  • Comments
 
about 7 years ago

Use QML to play music in Cascades

MediaPlayer

Steps:

  1. Add bb.multimedia 1.0 in qml file.

  2. Create a MediaPlayer Object.

  3. Set path of file for MediaPlayer. (Need permission for access_shared)

  4. Call the play() function of MediaPlayer. (Need permission Run when background if you want to play music in background).

BlackBerry 10 can support file format below:
AAC: audio/aac, audio/x-aac
AMR: audio/amr, audio/x-amr
FLAC: audio/flac
M4A: audio/m4a, audio/mp4
MIDI: audio/midi, audio/mid, audio/x-midi, audio/x-mid
MKA: audio/x-matroska
MP3: audio/mp3
OGG: audio/ogg
QCP: audio/x-gsm
SPMID: audio/spmid
WAV: audio/wav, audio/x-wav
WMA: audio/x-ms-wma

  • BlackBerry
  • BB10
  • Cascades
  • QML
  • MediaPlayer
  • music
  • January 31, 2016 11:13
  • Permalink
  • Comments
 
about 7 years ago

Clipboard usage in Cascades

In C++, need to import LIBS += -lbbsystem

QString text;
bb::system::Clipboard clipboard;
clipboard.clear();
QByteArray byte;
byte = text.toLocal8Bit();
clipboard.insert(“text/plain”,byte);

Remember, the Clipboard need insert QByteArray type.
We can define the String as QByteArray in order to use the Clipboard.
If you need to use some special characters, don't forget to use this line

byte = text.toLocal8Bit();

Here is the official API reference :)
http://developer.blackberry.com/cascades/reference/bb__system__clipboard.html

  • BlackBerry
  • BB10
  • Cascades
  • Clipboard
  • Tips
  • February 01, 2016 13:55
  • Permalink
  • Comments
 

Copyright © 2013 icesimon . Powered by Logdown.
Based on work at subtlepatterns.com.