📜 ⬆️ ⬇️

Samsung Bada Application Development - Part 1

Recently, Samsung has introduced a new mobile platform Bada and released a smartphone on this platform, Samsung Wave. For the developer, its meaning is that it provides a standard set of APIs on top of a GNU / Linux-based system or its own proprietary OS.

The first part of the article tells you where to start, a review of the Bada SDK is made, its features, pitfalls, solutions to problems are described - everything is based entirely on one’s own experience. In the second part, you will be told about the packaging of the application (the so-called deployment), the Samsung Apps store, and the sale of the application on Bada with the author's comments and tips.

Those wishing to play with Bada: code will have to be written in C / C ++, without garbage collection and other benefits of civilization. If it does not scare you, please under the cat.

Get the SDK

First of all, you need to register at developer.bada.com and officially become a Bada-developer. After successful registration, links to the “SDK installer
IDE and Simulator / Target SDK ”(354 mb) and“ Language pack 1 installer ”(170 mb). I think from the names and help on the download page it’s obvious to everyone what each file is for — the platform itself and the support of the Wave simulator. At the time of this writing, the SDK version is 1.0.0b3. The SDK currently works only under Windows, however, as will become clear later, Samsung will not be hard to port it to GNU / Linux and other UNIX-like operating systems. Everything is installed without any problems.
')
SDK analysis

Samsung generally relied on open technology. The company bought the CodeSource solution, which in turn is a build of Eclipse Mylyn and the GNU Toolchain. The latter means that the code is compiled by GCC (aka MinGW) version 4.4.1. Samsung's “secret” plugins added to Eclipse.

A computer simulator is used for debugging. Let me remind you that the simulator, in contrast to the emulator, executes code that is native to the computer, and not the device being debugged. This means that for more or less firm confidence in the performance of the application, you need to go bankrupt by the appropriate hardware. Hopefully, in the future, the simulator will be replaced with an emulator.

The SDK includes documentation in PDF (/ Documents), which is only suitable for pushing presentations to real developers or to capture the common essence of the API. I recommend using the Bada API Reference .

Hello, World!


In fact, it will be easier to first see numerous examples of applications (/ Samples). Koreans were not lazy and created 42 different mini-programs that demonstrate this or that functionality. Import the sample you like, then build it and run it. I note that you first need to just collect, and then run, otherwise the IDE will curse that there are no binaries. Probably, this is a bug: in other cases it is enough just to run the application, the modified code will be automatically recompiled.

The simulator runs on my Aspire 5920g for about 10 seconds, in the GDB debug mode it takes 20 seconds. It is frustrating that with each new application launch it is necessary to restart the simulator, otherwise the IDE swears that it is already running. As for the simulator itself, it is very austere: when you click on the joystick, we get to the main menu, consisting of icons of applications that have ever been launched and settings. When you try to launch an application from the menu, nothing comes out - most likely, this was done on purpose. Using the context menu of the simulator, you can create events (there are quite a lot of them, which is not - even a magnetic sensor can be controlled), take screenshots and change the size of the “smartphone” window.

bada API

The first thing that occurred to me was that once the language of the C / C ++ platform is worth trying to port numerous code to Bada. However, the port may not turn out at all, or turn into a war with API. The thing is that Bada POSIX is not fully implemented, everything seems to be basic, but, for example, there are no POSIX threads (this is written in the FAQ ). Part of the situation with pthreads can fix my open source project and MIT license for CodePlex . Standard C header files are implemented in libc-newlib, a special library for ARM embedded solutions. But STL works fine. Also, no one forbade the use of Boost. The full picture is in the discussion of the article.

My own Bada API really reminded me of C # /. NET. Judge for yourself: all classes are inherited from Object, for example, String, File, Directory, Int64. Object has a method called GetHashCode (). The names are quite common. It's great, isn't it? Of the unpleasant moments, we should note the absence of ToString () and the inconsistency of GDB when trying to view an instance of String. The debugger can show only the first character and the length of the string. The API runs on Unicode and is completely asynchronous, C ++ exceptions are supported, but not used. In general, there were pleasant impressions: the classes and methods are carefully documented, with examples of use, clear names and thoughtful namespaces.

The file system API is simple and straightforward. Each application is assigned a private home directory / Home. From the resource folder / Res can be read, respectively, resources. See the Bada File System for details.

Bada applications are multi-threaded. But at the same time Bada is pseudo-interrogative. This has already been written, and I will not repeat, just give a link to the Application UI Guide .

Privacy and Security

The developers have carefully approached this problem, if not fanatically. Privilege system involved. For example, to create a drawing in the / Media folder, you need the LOCAL_CONTENT privilege. At the same time, it is fundamentally impossible to access the incoming SMS / MMS / EMail of the smartphone owner or use IO to write to directories other than home ones. In the latter case, a trick is possible with the Osp :: Content :: ContentManagerUtil CopyToMediaDirectory / MoveToMediaDirectory methods. However, creating folders outside the home directory is not possible.

Interfaces


Bada XML . . 3 — (Form), (Popup) (Panel, ScrollPanel). :

Popup popup;
popup.Construct(L"IDP_POPUP_NAME");
Button *button = static_cast<Button *>(popup.GetControl(L"IDC_BUTTON_PUSHME"));


— . .

. ?

, . IDE Project/Privilege Check , . . developer.bada.com My Applications . - , ,

#define MYAPPNAME SuperBadaApp

, . XML , ID . Bada- Eclipse . Target-Release. . , , .


Bada SDK, , , . , Bada API. !

Source: https://habr.com/ru/post/101196/


All Articles