opengl-esandroid-ndkhomescreencocos2d-x-3.xhome-screen-widget

System overlay window with Android NDK C++, inc. OpenGL-ES for graphics


I am very experienced with Visual C++ and I am just starting to program native Android C++ apps with Visual Studio 2015 C++.

I need to do a homescreen overlay-style app, presumably by using a TYPE_SYSTEM_OVERLAY window and SYSTEM_ALERT_WINDOW permission.

  1. Is it possible to do this with the NDK? Will all required API calls be available to use?
  2. Am I correct to assume that I won't be able to use OpenGL-ES to display my graphics in the window (since it isn't full-screen)? I would love to be able to use cocos2d-x for graphics, input etc but I have a feeling that won't be possible at all.
  3. Is it just going to be too difficult to use NDK for this type of app, and should preferably just sit down and learn Java and SDK? (last question is probably a bit opinional)

Solution

  • On Android, anything you can do with Java, you can do with the NDK, because you can simply use JNI. If you are making many calls into Java from the NDK, you should consider creating an JNI wrapper class, which reduces the calling mechanism to fewer lines.

    Although I haven't tried it, there is nothing in the Android documentation to suggest that GLSurfaceView cannot be used with a particular type of window layout.