Chanon Sajjamanochai
2016-06-26 18:08:13 UTC
Hello, I am at a dead end here and don't know what else I can do.
I've created a simple NativeActivity application that does:
public class MainNativeActivity extends NativeActivity {
@Override
protected void onStart() {
super.onStart();
Point size = new Point();
//Display display = getWindowManager().getDefaultDisplay();
Display display = ((WindowManager)
this.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay();
display.getSize(size);
Log.d(TAG, "GET XXXXXXXXXXXXXXXXXX size is " + size.x + " " + size.y);
DisplayMetrics metrics = new DisplayMetrics();
display.getMetrics(metrics);
Log.d(TAG, "GET XXXXXXXXXXXX2 metrics size is " + metrics.widthPixels + " "
+ metrics.heightPixels + " density " + metrics.density + " scaled density "
+ metrics.scaledDensity);
display.getRealSize(size);
Log.d(TAG, "GET XXXXXXXXXXXXXXXXXX real size is " + size.x + " " + size.y);
DisplayMetrics metrics1 = new DisplayMetrics();
display.getRealMetrics(metrics1);
Log.d(TAG, "GET XXXXXXXXXXXX2 REAL metrics size is " +
metrics1.widthPixels + " " + metrics1.heightPixels + " density " +
metrics1.density + " scaled density " + metrics1.scaledDensity);
}
There is no native code running just an empty ANativeActivity_onCreate (I
commented everything out to determine what is causing the problem).
If I use package name com.mycompany.mypreviouspublishedapp in the manifest
and gradle files, then the result is it returns the wrong resolution most
of the time. Sometimes it gets the right resolution. Basically for a Galaxy
S6 that has a resolution of 1440 x 2560 it returns 1080 x 1920 most of the
time.
For a Galaxy Tab S2 that has a resolution of 1536 x 2048 it returns 1152 x
1536 most of the time and 1024 x 768 sometimes.
I tried to figure out what I was doing wrong, so I tried starting with a
barebones project with a random package name and saw that it was working
correctly. Then I tried changing my original project one part a time
commenting out things and making it the same as the barebones project.
Until finally the only thing different was the package name. And so I tried
changing that and IT WORKED .. on the S6 it showed 1440 x 2560 every time.
Then in the barebones project I tried changing the package name to
com.mycompany.mypreviouspublishedapp and it starts giving different results
again.
Now, I can't fix it by publishing with a new package name (even if I'd go
with that an absurd solution) because I'm trying to release an update to an
existing published app.
The app/game was previously published with Google Play Games services, so I
don't know if it is related to that.
Anyways... if anyone has any ideas it would be greatly appreciated.
I've created a simple NativeActivity application that does:
public class MainNativeActivity extends NativeActivity {
@Override
protected void onStart() {
super.onStart();
Point size = new Point();
//Display display = getWindowManager().getDefaultDisplay();
Display display = ((WindowManager)
this.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay();
display.getSize(size);
Log.d(TAG, "GET XXXXXXXXXXXXXXXXXX size is " + size.x + " " + size.y);
DisplayMetrics metrics = new DisplayMetrics();
display.getMetrics(metrics);
Log.d(TAG, "GET XXXXXXXXXXXX2 metrics size is " + metrics.widthPixels + " "
+ metrics.heightPixels + " density " + metrics.density + " scaled density "
+ metrics.scaledDensity);
display.getRealSize(size);
Log.d(TAG, "GET XXXXXXXXXXXXXXXXXX real size is " + size.x + " " + size.y);
DisplayMetrics metrics1 = new DisplayMetrics();
display.getRealMetrics(metrics1);
Log.d(TAG, "GET XXXXXXXXXXXX2 REAL metrics size is " +
metrics1.widthPixels + " " + metrics1.heightPixels + " density " +
metrics1.density + " scaled density " + metrics1.scaledDensity);
}
There is no native code running just an empty ANativeActivity_onCreate (I
commented everything out to determine what is causing the problem).
If I use package name com.mycompany.mypreviouspublishedapp in the manifest
and gradle files, then the result is it returns the wrong resolution most
of the time. Sometimes it gets the right resolution. Basically for a Galaxy
S6 that has a resolution of 1440 x 2560 it returns 1080 x 1920 most of the
time.
For a Galaxy Tab S2 that has a resolution of 1536 x 2048 it returns 1152 x
1536 most of the time and 1024 x 768 sometimes.
I tried to figure out what I was doing wrong, so I tried starting with a
barebones project with a random package name and saw that it was working
correctly. Then I tried changing my original project one part a time
commenting out things and making it the same as the barebones project.
Until finally the only thing different was the package name. And so I tried
changing that and IT WORKED .. on the S6 it showed 1440 x 2560 every time.
Then in the barebones project I tried changing the package name to
com.mycompany.mypreviouspublishedapp and it starts giving different results
again.
Now, I can't fix it by publishing with a new package name (even if I'd go
with that an absurd solution) because I'm trying to release an update to an
existing published app.
The app/game was previously published with Google Play Games services, so I
don't know if it is related to that.
Anyways... if anyone has any ideas it would be greatly appreciated.
--
You received this message because you are subscribed to the Google Groups "android-ndk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-ndk+***@googlegroups.com.
To post to this group, send email to android-***@googlegroups.com.
Visit this group at https://groups.google.com/group/android-ndk.
To view this discussion on the web visit https://groups.google.com/d/msgid/android-ndk/4302543a-bf16-406e-9336-207a10150fea%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
You received this message because you are subscribed to the Google Groups "android-ndk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-ndk+***@googlegroups.com.
To post to this group, send email to android-***@googlegroups.com.
Visit this group at https://groups.google.com/group/android-ndk.
To view this discussion on the web visit https://groups.google.com/d/msgid/android-ndk/4302543a-bf16-406e-9336-207a10150fea%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.