I was recently part of a project at IdentityMine where worked on a Xamarin application for the Amazon Fire TV Android platform. We faced some challenges which we love to address. One of which was the backend speed; however, this feature was out of our scope. Still, the client application needed to interact with the backend speed. Otherwise, with no data, there is no application.
I wrote a post about the learning experiences for the IdentityMine blog. If you are interested in client side development you might want to read it.
Showing posts with label Android. Show all posts
Showing posts with label Android. Show all posts
Thursday, December 3, 2015
Tuesday, May 12, 2015
Bridges connect the world - iOS and Android on Windows 10. What?
![]() |
| Bridge to Astoria, OR. Nov 2014 Photo from our road trip to Portland |
The keynote showed how an existing iOS game was ported to Windows 10 without much effort. The shown one-stop porting solutions for Android and iOS raised the concern why anyone should bother to develop natively for Windows 10 anymore and created quite some confusion and uncertainty in the Windows developer community. A few developers at //build were really worried about those announcements as some of their business is mainly porting iOS and Android apps to Windows Phone.
I think at the moment there's just too less knowledge to make decisions based on the announcements and assumptions floating around. There were two sessions at //build about Project Astoria for Android and Project Islandwood for iOS. Keep in mind both projects are in a alpha/beta stage and aren't publicly released at the moment so there's no public hands-on experience and independent in-depth analysis available yet. It's also worth noting that Project Astoria allows one to build Windows apps for phones but not for all Universal Windows Platforms at the moment. More information is expected during Summer 2015 and you could also try to sign up for an early access program for Astoria and Islandwood. There's also a good post by my friend Alan from AdDuplex. Peter Bright published a good Ars Technica article as well.
In my opinion there's one particular really good use case:
Share existing business logic across platforms and build the UI natively for the platform.
This way a common cross-platform app core is reused and the UI is built natively on top of that layer to provide the best UX. Porting an app completely might work for games with a custom UI and some simple apps, but advanced apps usually leverage too much platform-specific features for a one-stop port to work at all and a great app adapts to the UX of the platform.
Sharing core business logic is actually a common use case I see with our larger clients who want to bring their existing apps to Windows or Windows Phone. In the projects I've been involved over the last few years, the shared portion was usually implemented in C/C++ as it is still one of the best cross-platform options since most platforms support C/C++ in some way. Right now it is still quite an effort to get the custom C/C++ libs from other platforms adapted for Windows Phone compilation/linking, even with elevated API access rights. The cross-platform C++ Clang support in Visual Studio 2015 allows us to just recompile the Android or iOS C/C++ code and could help us a lot for such scenarios.
After writing this blog post I came across this excellent post by the Visual C++ team which describes just that. And this post which provides more details about the Visual Studio 2015 cross-platform C++ features.
As I see it, Xamarin will be the best choice for green field cross-platform projects to share as much code as possible and still provide the best UX. The new Visual Studio 2015 tooling for Windows 10 could help to make the reuse of existing iOS and Android business logic easier for Windows 10 when there's not a desire for a green field.
On the last day of //build I had a nice breakfast and roundtable with an executive of the Windows Dev Platform and of course we talked about the //build announcements. There was actually the same vision about the easier reuse of business logic. I think we made it clear that quite some confusion was created in the dev community around Islandwood, Astoria but we were told Microsoft will release more information to make the vision for those porting tools clearer.
In the end I think there's no need to be worried. Porting tools have never been a one-stop solution so I'm confident Islandwood and Astoria won't be the holy grail either. As usual a keynote also contains a good portion of marketing and software development is never that easy, so always consume such announcements with a grain of salt and wait for final decisions until the expected is delivered for real-world scenarios.
If those tools help us to make the porting of existing iOS and Android apps easier and the Store provides the apps which users are looking for, it's good for all Windows developers in the end.
It's just a matter of adapting to leverage the new tooling and helping clients to create great apps.
Don't Worry, Be Happy!
Labels:
Android,
cross platform,
ios,
uwp,
Visual Studio,
vs2015,
windev,
windows 10
Friday, November 14, 2014
Native Android Application Development with C++ and Visual Studio 2015
Visual Studio 2015 ships the new C++ cross platform support which currently provides native C++ library compilation for Android and Windows platforms. iOS compiler support is supposed to be added as well.
That's not all. VS 2015 even provides a new project type called "Native-Activity Application" for Android app development. This pure C/C++ Android application model is mainly used for game development using full screen OpenGL rendering.
The Native-Activity Application project type allows developers to write native Android apps with C++ and even to run and debug those in the Android emulator only by using Visual Studio 2015.
No Xamarin, no Apache Cordova needed, just VS 2015 and pure C/C++.
How it works
It's pretty straightforward to get started.
Just install Visual Studio 2015 including its Secondary installer which adds the required Android development tools.
Start VS 2015 and select the Visual C++ -> Cross Platform -> Native-Activity Application (Android) project type:
The generated template code provides the base native Android app code including simple code for cycling the back buffer clear color inside the engine_draw_frame function.
For this sample here I decided to make the Hello World of 3D computer graphics: a rainbow colored rotating cube. Here's how you can achieve this as well:
Add the cube definitions to the beginning of the main.cpp:
And replace the // Initialize GL State statements at the end of the engine_init_display function with this:
Finally replace the engine_draw_frame function:
You also might want to modify the angle increment so the cube rotates a bit faster, like engine.state.angle += 1.f;
Make sure the project is set to compile as x86 in order to use VS' own Android emulator.
Then F5 and enjoy the magic of the rotating cube.
Now try to add a breakpoint in your engine_draw_frame function. Yes, there's native debugging support for Android apps in Visual Studio 2015. Times are definitely changing at Microsoft.
Sample code
You can download the complete VS 2015 sample solution here.
More resources
This blog post is a nice overview of the new Visual C++ cross platform features.
This short Ch9 video gives a quick intro to the new Visual Studio 2015 C++ cross platform support.
NeHe is a quite old resource for OpenGL tutorials but mostly still useful.
That's not all. VS 2015 even provides a new project type called "Native-Activity Application" for Android app development. This pure C/C++ Android application model is mainly used for game development using full screen OpenGL rendering.
The Native-Activity Application project type allows developers to write native Android apps with C++ and even to run and debug those in the Android emulator only by using Visual Studio 2015.
No Xamarin, no Apache Cordova needed, just VS 2015 and pure C/C++.
How it works
It's pretty straightforward to get started.
Just install Visual Studio 2015 including its Secondary installer which adds the required Android development tools.
Start VS 2015 and select the Visual C++ -> Cross Platform -> Native-Activity Application (Android) project type:
The generated template code provides the base native Android app code including simple code for cycling the back buffer clear color inside the engine_draw_frame function.
For this sample here I decided to make the Hello World of 3D computer graphics: a rainbow colored rotating cube. Here's how you can achieve this as well:
Add the cube definitions to the beginning of the main.cpp:
static GLint vertices[][3] =
{
{ -0x10000, -0x10000, -0x10000 },
{ 0x10000, -0x10000, -0x10000 },
{ 0x10000, 0x10000, -0x10000 },
{ -0x10000, 0x10000, -0x10000 },
{ -0x10000, -0x10000, 0x10000 },
{ 0x10000, -0x10000, 0x10000 },
{ 0x10000, 0x10000, 0x10000 },
{ -0x10000, 0x10000, 0x10000 }
};
static GLint colors[][4] =
{
{ 0x00000, 0x00000, 0x00000, 0x10000 },
{ 0x10000, 0x00000, 0x00000, 0x10000 },
{ 0x10000, 0x10000, 0x00000, 0x10000 },
{ 0x00000, 0x10000, 0x00000, 0x10000 },
{ 0x00000, 0x00000, 0x10000, 0x10000 },
{ 0x10000, 0x00000, 0x10000, 0x10000 },
{ 0x10000, 0x10000, 0x10000, 0x10000 },
{ 0x00000, 0x10000, 0x10000, 0x10000 }
};
GLubyte indices[] = {
0, 4, 5, 0, 5, 1,
1, 5, 6, 1, 6, 2,
2, 6, 7, 2, 7, 3,
3, 7, 4, 3, 4, 0,
4, 7, 6, 4, 6, 5,
3, 0, 1, 3, 1, 2
};
And replace the // Initialize GL State statements at the end of the engine_init_display function with this:
// Initialize GL state. glDisable(GL_DITHER); glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST); glClearColor(1.0f, 0.41f, 0.71f, 1.0f); // Hot pink! :D glEnable(GL_CULL_FACE); glShadeModel(GL_SMOOTH); glEnable(GL_DEPTH_TEST); glViewport(0, 0, w, h); GLfloat ratio = (GLfloat)w / h; glMatrixMode(GL_PROJECTION); glLoadIdentity(); glFrustumf(-ratio, ratio, -1, 1, 1, 10);
Finally replace the engine_draw_frame function:
static void engine_draw_frame(struct engine* engine) {
if (engine->display == NULL) {
// No display.
return;
}
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glTranslatef(0, 0, -3.0f);
glRotatef(engine->state.angle * 0.25f, 1, 0, 0); // X
glRotatef(engine->state.angle, 0, 1, 0); // Y
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_COLOR_ARRAY);
glFrontFace(GL_CW);
glVertexPointer(3, GL_FIXED, 0, vertices);
glColorPointer(4, GL_FIXED, 0, colors);
glDrawElements(GL_TRIANGLES, 36, GL_UNSIGNED_BYTE, indices);
eglSwapBuffers(engine->display, engine->surface);
}
You also might want to modify the angle increment so the cube rotates a bit faster, like engine.state.angle += 1.f;
Make sure the project is set to compile as x86 in order to use VS' own Android emulator.
Then F5 and enjoy the magic of the rotating cube.
Now try to add a breakpoint in your engine_draw_frame function. Yes, there's native debugging support for Android apps in Visual Studio 2015. Times are definitely changing at Microsoft.
Sample code
You can download the complete VS 2015 sample solution here.
More resources
This blog post is a nice overview of the new Visual C++ cross platform features.
This short Ch9 video gives a quick intro to the new Visual Studio 2015 C++ cross platform support.
NeHe is a quite old resource for OpenGL tutorials but mostly still useful.
Labels:
Android,
C++,
cg,
Computer graphics,
OpenGL,
Visual Studio
Subscribe to:
Posts (Atom)


