Forum Replies Created
-
AuthorPosts
-
On Android and iOS I normal create a hidden folder using the dot in front (.myfolder) on Android this is normally in the root of external storage, on iOS you can have trouble getting your app through iTunes review depending on where you store data and how much you store, they dont like you storing lots in the Documents directory as that is part of the default iCloud backup, so I use NSCachesDirectory.
I created modules for my specific needs on Monkey1 and slight modified brl/filesystem module to get it to work on both platforms correctly, I will try and post the modules if helpful.
Yes unfortunately you have to add it to the target, I haven’t found anyway of of creating the delegate on the fly.
Nice thanks.
Hi, yeah just a delagate and callback for the response
Monkey123456789101112131415161718192021222324Class MyApp Extends App Implements PermissionDelegateMethod OnCreate:Int()Permission.CheckPermissions(Self, True, True, True, False)Return 0End MethodMethod OnRender:Int()Cls 255, 255, 200Return 0End MethodMethod OnUpdate:Int()Permission.Update()Return 0End MethodMethod OnPermissionsReply:Void(allAllowed:Bool)Print "OnPermissionsReply: " + Int(allAllowed)EndEndHI, if you are building for Android SDK 23+ you have to request permissions from the user not just in the manifest.
This is the java module code I created for Monkey1 to deal with this:
Monkey123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778import android.support.v4.content.ContextCompat;import android.support.v4.app.ActivityCompat;import android.Manifest;import android.content.pm.PackageManager;class PermissionNative extends ActivityDelegate implements ActivityCompat.OnRequestPermissionsResultCallback {private boolean done;private boolean result;public void CheckPermissionsNative(boolean calendar, boolean camera, boolean location, boolean storage){done = false;if(Build.VERSION.SDK_INT >= 23){BBAndroidGame.AndroidGame().AddActivityDelegate(this);AskForPermissionsNative(calendar, camera, location, storage);}else {done = true;result = true;}}public void AskForPermissionsNative(boolean calendar, boolean camera, boolean location, boolean storage){Activity activity = BBAndroidGame.AndroidGame().GetActivity();List<String> requestedPermissionsList = new ArrayList<String>();if(calendar == true && ActivityCompat.checkSelfPermission(activity, Manifest.permission.READ_CALENDAR) != PackageManager.PERMISSION_GRANTED){requestedPermissionsList.add(Manifest.permission.READ_CALENDAR);}if(camera == true && ActivityCompat.checkSelfPermission(activity, Manifest.permission.CAMERA) != PackageManager.PERMISSION_GRANTED){requestedPermissionsList.add(Manifest.permission.CAMERA);}if(location == true && ActivityCompat.checkSelfPermission(activity, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED){requestedPermissionsList.add(Manifest.permission.ACCESS_FINE_LOCATION);}if(storage == true && ActivityCompat.checkSelfPermission(activity, Manifest.permission.READ_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED){requestedPermissionsList.add(Manifest.permission.READ_EXTERNAL_STORAGE);}if(requestedPermissionsList.size() >0){String[] requestedPermissions = new String[requestedPermissionsList.size()];requestedPermissions = requestedPermissionsList.toArray(requestedPermissions);ActivityCompat.requestPermissions( activity, requestedPermissions, 0);}else {done = true;result = true;}}public boolean CheckPermissionsDoneNative(){return done;}public boolean CheckPermissionsResultNative(){return result;}@Overridepublic void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {switch (requestCode) {case 0: {done = true;if (grantResults.length > 0) {result = true;for (int i=0; i<permissions.length; i++) {if (grantResults[i] != PackageManager.PERMISSION_GRANTED) {result = false;}}} else {result = false;}return;}}}}Hi, take a look at other modules that use c libs:
http://monkeycoder.co.nz/forums/topic/tinyaes-wrapper/
Thanks
Is it possible to set a pushbutton label text to wrap?
Nice job!
@hezkore, looking at your emsdk log looks like you need git installed to get the latest tagged release, git is install on my machine and it updates to 1.37.9 fine.
I doubt you need Java and I am running the latest itch.io M2 release v1.1.07, I also have the latest Emsdk with emscripten 1.37.9, I see yours is 1.37.1
I dont get those warnings so maybe the Emsdk install is not happy, this my result:
em++ -v
emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 1.37.9
clang version 4.0.0 (emscripten 1.37.9 : 1.37.9)
Target: x86_64-pc-windows-msvc
Thread model: posix
InstalledDir: C:\emsdk-portable\clang\e1.37.9_64bit
INFO:root:(Emscripten: Running sanity checks)I had that error until I ran “emsdk activate –global latest” from admin command prompt from within the emsdk-portable folder. Then I added mserver-v86c to the monkey2 devtools folder.
I just installed Emscripten on Windows10, I had to run Command Prompt as Administrator to run ’emsdk activate –global latest’ which setup all the env stuff.
Then rebuild all the modules with Emscripten enabled.
Ted2Go is coming along nicely! is Folding still on the roadmap?
-
AuthorPosts