Should we remove NativeActivity?

@prchakal
No. We can not wait Android to fix the problem. We don’t know when they can resolve it. And many devices have the problem. It is urgent.

@splhack
It includes c++ codes and java codes, so it is not a good idea to have both. And i don’t think it is a good idea to have both. It will make things more difficult.

@ricardo
Yep, we need them. We will do it after resolving this issue.

@schngrg I tested by your solution, but it can’t resolving this issue.And it is launch as landscape on these devices at the beginning.

@wenhai OK, sorry to know this.

I am neutral for Java activity or Native activity. Only new feature that I use in 3.0 Native Activity is the orientation change support (the new function applicationScreenSizeChanged), and that can be implemented easily using Java activity also (using onSurfaceChanged).

i think I am in the same situation as splhack,
using UIKit and Java view with beta2 and rc0 on top of the GL.

Please consider to provide a choice between native activity and activity,
because in my situation, our app use a lot of external sdks that require the “view” and native activity is not making my job easier.

I want you to understand the freedom to have both C++ and java/obj-c call, and
the freedom to build from android and xcode project, are both is very important, very critical.

@kusamochi
As i said, we will use NativeActivity or Java Activity. We can not provide both.

As far as i know, there is not solution to resolve it when using NativeActivity.
So we decide to use Java Activity.

Thanks guys.

@splhack
Thanks.
I have merged your pull request, and we modified templates and other tests.

Hi guys.
Would you test latest codes to checkout if it resolve the problem?
Thanks.

Hello, the Java activity does not support applicationScreenSizeChanged callback which was added in new Native Activity.

Thanks for feedback.
We will support it.

Attempting to use this so we can incorporate ScoreLoop into Cocos3.0 (it needs WebView) but ran into some difficulties http://www.cocos2d-x.org/forums/18/topics/48880

@MrSluagh

Actually, turns out those difficulties had nothing to with going back to the JavaActivity. I’ve now got the development build from yesterday running and popping Scoreloop’s terms of service webview perfectly as far as I can tell, but I’m still testing.

@zhangxm I have created a pull request for the missing callback in Java activity. It’s a small fix, just adds a JNI call to our applicationScreenSizeChanged in Android’s onSurfaceChanged. Tested on a few devices. Hope it gets merged before next RC/Final release.

https://github.com/cocos2d/cocos2d-x/pull/6265

@schngrg
Thanks.
I have merged it.

I’m not 100%, haven’t decompiled it or anything, but Steve Jackson’s Sorcery impressed me in that I was able to scroll around the “hand-drawn 3D world map” while still watching the clock in my notification bar. Does that cound as full screen for the purpose of this discussion? I would really like to emulate that sort of thing. Such a short game for 50Mb odd download. Can’t believe Inkle made it purely with Android Java libs.

Apportable described by Inkle seems to explain how they emulated iOS in that apk, hence the lack of original conent (if I may be so rude). For a moment there I thought I’d be set up with InkleWriter. Is that the time? {-)

Hi. Could you please confirm if you managed to find a solution with NativeActivity?

+1 for creating a window management abstraction. Will also help for other platforms.
You could also consider a GLES API wrapper to take care of EGL configurations, state caching, virtual resolutions etc. It will level out the un-eveness in GLES implementations across devices / platforms. An example of this : http://docs.madewithmarmalade.com/display/MD/IwGL+overview

thanks @mayurp
we will take that into account.

I have found a workaround to this problem. I have checked it with a Huawei Y300.

To solve it I have a Java class that inherits from NativeActivity, in its onCreate I have put a Dialog and when the dialog is closed I call to setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);

For example:

@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);

AlertDialog dialog = new AlertDialog.Builder(this).setMessage(“Loading”)
.setCancelable(false)
// .setPositiveButton(“OK”, new OnClickListener()
// {
// @Override
// public void onClick(DialogInterface dialog, int which)
// {
// setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
// }
// })
.create();
dialog.setOnDismissListener(new DialogInterface.OnDismissListener()
{
@Override
public void onDismiss(DialogInterface dialog)
{
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
}
});

dialog.show();
RemoveDialogDelayed(1000,dialog);
}

public void RemoveDialogDelayed(long aTime, final Dialog aDialog)
{
new Handler().postDelayed(new Runnable()
{
public void run()
{
aDialog.dismiss();
}
} , aTime);
}

And in AndroidManifest.xml the activity have to have:
android:configChanges=“orientation|keyboard|keyboardHidden|screenSize|screenLayout|uiMode”

Hope it helps.