Xamarin.Forms (UWP and Android) directory selection outside of AppData - android

I've been pulling my hair out all day. I'm converting my WPF app to Xamarin.Forms (UWP, IOS and Android). I'm currently focused on UWP and Android (don't have an apple devices yet) and I got a lot of the program running but I ran into a huge snag with reading files that are not in my sandbox directory. Currently, my app allows you to choose a folder with images and you can move through them. To test out the reading functionality, I've placed the images into the "LocalState" directory and bingo, my code is working beautifully. Now the program doesn't have a default folder and when I originally created it in WPF, the user would have a pop up and they would choose their own folder but I cannot for the life of me get a similar function for Xamarin. Every time I try something, I get an "access denied". I've seen Android apps allow you to pick a folder for emulators and I'm 100% sure that you can setup UWP to do permissions with StorageApplicationPermissions but I just cannot get this to work for Xamarin.Forms. Please help me!

OK, Android first it is easier. You need to setup in the manifest permissions to read and write SD-card. On Marshmallow and later you need to ask for the permission at the runtime (you need to do that from the native project).
On UWP the easiest thing to do would be to set the broadfileaccess in the manifest. Other than that you pointed out to the proper APIs, just you need to run them natively.
In general native code is called by using dependency injection. If it gets too complicated you may consider to create Xamarin.Forms project as a shared project where you can use conditional compiling instead of dependency injection which is quite simpler.

Related

How to create a system app for custom ROM

We have a custom ROM for a device we are making and what I want to do is make our own custom Settings app to replace the settings app that comes already built in android.
I cant really find any documentation on how to even create a system app. It does not appear you can create it in Android Studio, I tried looking on the AOSP site and didnt find anything there related to creating system apps. The few things I did find were on here where you would put android:sharedUserId="android.uid.system" in your manifest and then has to be signed with the same key as the ROM but after that I cant find anything.
The settings app I want to create would need access to the framework.jar to be able to use the hidden framework API's.
Does anyone have any information or know where I can find this information on how to go about actually creating a system app?
You may want to research how to make a Device Tree Overlay (dto). Basically it is your code, reformatting the base code, into what you want. https://source.android.com/devices/architecture/dto?hl=en
Since you said you use Gradle, you should put first build you apk and put them in you vender folder, and next important thing is to create a mk/bp file to tell the Android build system how to deal with this pre-built apk.
P.S. If you system app highly depends on Android hidden api, make sure you have the right version of framework.jar in you Android Studio project, or, as what I alway did, create apps directly in AOSP, in this case, you can just check the code structure of the original Settings app in AOSP
this tutorial may help you.

Writting React Native with android and iOS code in the same code base?

Looking through the documentation (https://facebook.github.io/react-native/) it seems you need 2 different files ones with file ending in .ios the other .android
I find it hugely confusing now I'm starting to write code do I need 2 repos to write this code
Yes, you do need to write to the specific platform you are working on at the time. If you are working on iOS / Xcode, then the .ios files will automatically be the once run when compiled, and vice versa.
If you are not writing any platform specific code, you can copy the code from whatever components are working on in your current platform over to the other platform, and they should work fine there.
You could use some strategy to share the same code base.
I found a project where it was made:
Mobile, desktop and website Apps with the same code -
https://github.com/benoitvallon/react-native-nw-react-calculator

android app adding content during runtime

Hello I am trying to build an app which will hold "other app's"
For example MY app will hold different apps of different ClIENTS.
Now i want to make it so that 1 client has the option to only download his part, BUT he still has to use MY main app. (in other words i don't want to reference to another APK, cause then he can start his app without using mine(i think))
And the download option should be at runtime, cause else he has to download everything in one go.
I have thought about using jar files as library files, but what i found so far is that you have to add them in Eclipse (else they are not found)
I also thought about building the app with the jar files in it, and then leave them out when i compile the app. Then my client can download those files afterwards. But i am guessing that will cause reference errors?
So the questions are;
Is it possible?
How to go about?
The main idea is that i don't want to make one HUGE app where as my client will only use his part of it.
Thanks in advance
It can be achieved in android, and some big platform apps could let the 3rd party developers to develop plugins for them. The main idea is try to create your own DexClassLoader to replace the default one, the custom DexClassLoader could load classes from apkfile.
Try to look through this article for details.
Same with this question.
It seems this is a difficult topic. I can only give you some point.
Since you don't want to make a huge app, then you have to build CLIENTs as separate APKs. But if you don't define CLIENT's activity as MAIN and DEFAULT in manifest, after install CLIENT app, user could not find CLIENT app from system menu (launcher). You can define a private intent name for CLIENT app's activity, this way, only your main app could start CLIENT app's activity.

Custom Android MMS/SMS application from source code?

Okay here's the deal:
I want to download the full source of the MMS/SMS application that ships with Android phones. I want to be able to modify it, and add a little custom functionality to it.
I am developing using Eclipse, and I'm on Windows 7. I have noticed that there is now a Git for Windows, but I am pretty lost in it and not sure how to integrate everything with Eclipse.
Basically, I want to just get it to the point where I have all the source code visible in Eclipse and be able to see the app run JUST like the built-in texting/MMS app that is already on my phone. Then I'll know that I can modify it and proceed.
Any ideas?
Thanks!
There's a mirror of the SMS/MMS app on GitHub here. Just import that to Eclipse and customise away.
Unless you want to customize and use it only on your own phone (without publishing), this is not a good idea. This is because it uses classes that are hidden from the sdk. By default you won't even be able to build the apk via eclipse, but there is a way. The reason why this is a bad idea is that the hidden apis are not guaranteed to remain the same through different api-levels and your app can stop working with the next android update, and might also not work on previous api-levels. In-fact your app might not even work on selected phones running the same api-level.

Dokan (DokanNet.dll) on Android/Monodroid - Code Migration Issue

Context:
I have an windows desktop app(c#) which loads the dokan libraries , creates a new file system/drive each time it runs, and then deploys financial data files & copywrite protected files in the newly created drive - Allowing only limited process (declared by me) to have access to these files in newly created file system(using dokan).
Now we are migrating the same C# code to android. Though the code doesn’t give Errors, (while running apk)the new drive is not created. While i could debug only to an extent (suddenly get out of debugging mode)
Assumptions for the issue:
Permission issues:
Question:
Does Dokan work with Android? How to go about this, if it’s a permission issue? In market place, most of the devices installing my app may not be "rooted"!!
Has anyone implemented new file system/drive using DokanNet on Android/Monodroid and faced with similar issues? Solutions???
When using a tool it's a good idea to have some basic understanding of how it works. Dokan works by installing Windows filesystem driver. On Android there's no concept of drives and mounting anything to the filesystem is not possible (without building custom kernel and installing it on device). Consequently your idea is DOA on Android and you need to look for other ways to deal with your data.

Categories

Resources