I have a simple HTML+JavaScript app that compiles okay in the Adobe PhoneGap Build service. I use Hydration there. I can also run locally with the Adobe PhoneGap Desktop App. But multiple things defined by config.xml seem to have no effect in either case:
The app icon, of which I have multiple defined for each platform, isn't used. Instead it's the Adobe PhoneGap icon (this could just be due to Hydration?)
The splash screens, also defined for each platform, are not used. I tried adding SplashScreenDelay to no effect.
No plugin seems to work. I can't even get something simple like device.platform (provided by org.apache.cordova.device) to return a value.
The Adobe PhoneGap Build service is supposed to pull the plugins via npm as part of the compilation, right? Does the Desktop App do the same? Am I missing a step somewhere?
Pastebin: config.xml (Mostly stock, just added com-admob-plugin and SplashScreenDelay)
Remember, in order for the config.xml file to be parsed it MUST BE IN THE SAME DIRECTORY AS INDEX.HTML!!! Otherwise the PhoneGap Build service will just compile your application with the presets. Moreover, read this for more information.
Related
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.
I am developping an app on Ionic version 3.9.2, for android tablets. I am working under windows 10 with Visual Studio Code.
In my plaform folder, I have only one device : my physical Android device.
The way I process to fix some CSS details is that I simply launch a
ionic serve command, find my HTML element, and update the main.css file located in the www/build folder (I am not using SCSS).
This works okay until I decide to check if everything looks good on my android tablet : I will launch a cordova run android, and then all the CSS changes are lost - even if I go back on my browser, and launch a new ionic serve.
Please note that I am talking about very basic styles, like colors and font size, not platform-specific styles.
I am not sure this behavior is because of the target device itself; it's looks like the changes will be included successfully on my testing platform until I decide to change the platform, and then the new platform will erase my changes because it's taking over the building process.
Is that possible ?
Maybe should I stop switching between those 2 commands ?
Or maybe should I edit both CSS files (www/build/main.css and platforms/android/assets/www/build/main.css) at the same time, which require a lot more work ?
Any help appreciated.
Oh of course, I shouldn't edit this CSS file.
Instead, edit the right SCSS file inside the SRC folder.
Thanks for your answer.
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
I have recently upgraded to Cordova 3.5 and noticed that on most app start ups (iOS & Android) I would get a xxx is undefined where xxx = any of the plugin variables. i.e. device, confirm, etc.
After days of digging I found that the problem lies with the BASE tag I was using in my index.html document. I use this tag to identify my domain so I can use relative paths in my scripts. If you do not do this then relative paths will be derived locally from the app. You do not need the BASE tag if all of your paths have your domain in them.
Apparently the BASE tag now causes the app to not be able to find the plugin javascript source that is local. I tried placing the BASE tag elsewhere in the document and it did resolve it for iOS but not for Android.
This also causes problems with apps that are paused. You may get your app to start fine but once it restarts, your BASE element is already defined and all further looks for the plugin javascript will be derived from that BASE.
SOLUTION - I rewrote my application to remove the BASE element.
Sharing with others so they do not bang their head against the wall for days like I did. Cheers.
I've been working on a Phonegap project (Android and iOS) for 2 months now. Everything works fine and is surprisingly fast once you play around for a while.
Except one thing. I fail to understand how Phonegap handles icons. After a while I have noticed that the "res" folder for my iOS project wasn't being used, instead it was using icons in "platform/ios/projectName/Resource/icons". I've moved all my icons/splash screen in there, linked all of it in my xcode project and everything work fine.
Now I'm struggling with Android, hacking my way in that "drawable" folder of the Android platform folder, failing to understand the role of the config.xml in all of this.
Anyway here are my questions:
What is the purpose of the icon references in "www/config.xml" if when it comes to building for a platform, it ignores those paths and actually looks for icon/splash screen elsewhere?
What is the purpose of the res folder/subfolder naming, if the build function just blindly copies everything in each platform folder (having blackberry references/png in iOS config/folders).
Where should I put the android splash screen image and what's the correct naming? (when i copy the one from "www/res/screen/android" into the "drawable" folder, the build fails for incorrect naming).
Basically, what's the Phonegap expected workflow for icons & splashscreens?
The references listed in config.xml are for Phonegap Build. This link might help:
http://devgirl.org/2013/09/12/phonegap-icons-and-splash-screens-help/