Open PsycoTodd opened 8 years ago
I have the same problem when I work on my apps, hope there will be an answer soon.
Currently, it's not possible to ask user for permission in VR mode. Runtime permission is handled by Android, and as any other system activities, apps are not aware of them (or allowed to handle them on behalf of the system). However, there is a way to avoid crashes. You can set your targetSdkVersion to < 23. As described on http://inthecheesefactory.com/blog/things-you-need-to-know-about-android-m-permission-developer-edition/en, "When we call a function that requires a permission user revoked on application with targetSdkVersion less than 23, no any Exception will be thrown. Instead it will just simply do nothing. For the function that return value, it will return either null or 0 depends on the case."
If your application cannot run without some critical permissions, it would make sense to check those permissions when it starts. You can prompt users to enable those permissions and retry. The way to check permissions at runtime is documented here: http://developer.android.com/training/permissions/requesting.html
I ran into the same problem today: My app has to work with Marshmallow/API 23/my S7 (but without the Oculus store for now!) and access to the external storage is the most important part but the app crashes as soon as the permissions popup pops up. I know, you can change the permissions in the app settings yourself but I wouldn't exactly call that user friendly. :/ Any updates about this (is it planned?), maybe even an ETA?
What also would be interesting to know: Is there any way to show a popup (e.g. for an error message, not necessarily a dialog) with the framework?
Oculus store will handle this for our apps. Oculus will request the permissions I think. However if you disable the permissions in Oculus store, the apps, which launch from it, would crash as well :( On Apr 21, 2016 10:04, "Nathipha" notifications@github.com wrote:
I ran into the same problem today: My app has to work with Marshmallow/API 23/my S7 (but without the Oculus store for now!) and access to the external storage is the most important part but the app crashes as soon as the permissions popup pops up. I know, you can change the permissions in the app settings yourself but I wouldn't exactly call that user friendly. :/ Any updates about this (is it planned?), maybe even an ETA?
— You are receiving this because you commented. Reply to this email directly or view it on GitHub https://github.com/Samsung/GearVRf/issues/467#issuecomment-213018458
sorry for the late reply. we've all been pretty swamped with the upcoming samsung developer's conference and a hopefully upcoming 3.0 release of gvrf. one thing that might help make this go quicker is to have an example that reproduces the problem. it seems like there's a lot of new, annoying code that has to be written for prompting for an android permissions dialog, but there's also quite a few permissions that don't need a dialog. is there an example of this being handled with other oculus mobile applications? (a quick search didn't reveal any, which is kind of surprising). we want to help you out, but could use some help to help you :) thanks.
Oh, is there already an ETA for 3.0 and are there any plans to add new methods to not only render 2D but now also 3D stuff only using the framework?
These links helped me: http://developer.android.com/training/permissions/requesting.html https://github.com/codepath/android_guides/wiki/Understanding-App-Permissions
In my case it was the "read external storage" permission. Since the app won't be on the Oculus store too soon (or maybe not even at all), I have to make it work on its own. Here's my code: http://pastebin.com/Ef4w8bNC
I also tried moving the "super.onCreate(savedInstanceState);" part to the starten() method to do the whole permissions thing before the framework actually starts up but that didn't work either.
Gvrf 3.0 will be a snapshot of the tree when a few more things are checked-in. The key features i want in are support for multiple lights (in), support for shadows with multiple lights (in progress), and android studio support (up for review now). I'm giving my talk about gvrf at the samsung developer's conference on wednesday. I'm hoping all that will be in by then.
You should be able to load full 3d models via gvrContext.loadModel(); see the jassimp sample. We do need to revamp our samples. They all should still work, but many of them can probably be done with less code by now.
I'm expecting someone to start looking into this permissions issue on monday.
Okay, thanks for the info, looking forward to it.
Does the framework currently support dialogs like these?: http://developer.android.com/guide/topics/ui/dialogs.html
Ad 3d model: I mean more like actually draw one using coordinates at runtime - not a complete, closed mesh with triangles but a continuous line that connects a bunch of points in the right order in 3D space.
@Nathipha I looked into your pastebin code, it was very close! I was able to make gvr-vuforia sample work with the following modifications on top of your code. Let me know if you are able to resolve your issue. Thanks!
In VuforiaSampleActivity:
protected void onCreate(Bundle icicle) {
super.onCreate(icicle);
Log.d(TAG, "onCreate");
script = new VuforiaSampleScript();
setScript(script, "gvr_note4.xml");
getPermission();
}
private void starten()
{
datasetStrings.add("StonesAndChips.xml");
vuforiaState = VUFORIA_INITIALIZING;
vuforiaAppSession = new VuforiaApplicationSession(this);
vuforiaAppSession.setZPlanes(NEAR_Z_PLANE, FAR_Z_PLANE);
vuforiaAppSession.initAR(this);
}
Re: 3d model, you can create a mesh at runtime and set the drawMode in its GVRRenderData to points, lines, or triangles. you should also be able to update the vertices and indices on the fly as well. (though, currently, our method of updating is not that efficient, but Vittal is working on changing that). would that do what you're looking for?
@Nathipha Was Teresa's response about the permissions helpful? Do you need more assistance?
Considering that the permissions dialog is a system one (meaning we can't just swap it out with something else) I think your approach is the correct one - make sure you get all the dangerous permissions you need beforehand. super.onCreate definitely must be called from your onCreate. Delaying the setScript call until you get the permissions request result should work. Let us know.
For whatever it is worth I combed through the Oculus forums - I can't say I found anything helpful regarding this issue.
Sorry for the late reply.
@teresa-mao The gvr-vuforia sample runs fine for me (there were no permission popups) without changing anything - at least the camera pass through part, not sure what else it's supposed to do. With your changes (call starten() before getPermission()) it at least shows the permission dialog properly (without the error messages), thanks. You have to reopen the app afterwards though but I guess that can't be avoided until gvrf 3.0.
@thomasflynn Once everything's drawn, I don't have to change it again. I had to look up the name: What I need is a 3D polyline. Ah, I see, thanks. So: Create a GVRMesh and setVertices, then use the GVRRenderData (what number is GL_LINE_STRIP?). Is there a sample for the GVRRenderData part and how to add it to the scene?
@liaxim Yes. it helped. It still isn't the best solution but it might be better than having the user change the setting himself - at least until the new version hits. Yes, just a general question: Does the framework currently support dialogs like these (more talking about the yes/no one without EditText fields): http://developer.android.com/guide/topics/ui/dialogs.html
@Nathipha I don't think we support out of the box these dialogs. We will investigate what it would take. In the meantime, you can always inflate a frameLayout and build your own thing. You might find the gvr-events and gvr-renderableview samples useful.
@Nathipha You can just use GLES20.GL_LINE_STRIP. I don't think we have samples that use non-default drawMode.
For a app development, android 6.0 need to get the permission from the system. Such as camera access and SD card reading permission. However, current oculus app seems not provide way to ask for permission in the VR environment. The app download from Oculus or Samsung store app will be granted with all the permissions it needs. However, the user can manually disable the permissions from application manager later. In this case the app will crash when loading from Oculus home.
Feels like that currently without permissions that one VR app needs, it will crash and there is no way to ask for the permissions in VR app.
Let me know what you think, thank you!
Todd