iOS and Android programming - android

I have developed a few Android applications and am currently working on developing an iOS application from scratch. Is there any method by which I can focus on developing my iOS application in such a way that I can reuse some of its components or features for developing the same application on the Android platform?

Is there any method by which I can focus on developing my iOS
application in such a way that I can reuse some of its components or
features for developing the same application on the Android platform?
You can if you use web technologies (HTML, CSS, Javascript). You can do that if you build a web-based app or a hybrid app, i.e. one that uses web-based content running inside a native shell. Look into PhoneGap if you're interested in building a hybrid app -- it offers a quick way to get started. There are also some cross-platform frameworks like Titanium that purport to offer write once/run on several platforms functionality.
If you want to build an app that's fully native on both platforms, you won't be able to reuse application logic. iOS and Android use different frameworks written in different languages running on different hardware, and apps on each platform work somewhat differently as well. Even so, what you can re-use is whatever work you put into the infrastructure that drives the apps. Most apps rely on some sort of server infrastructure to supply or collect data, and that server component can easily serve apps running on either platform.

If you are developing the same application, then you can use j2objc to translate your java (non-UI or hardware/platform specific) code to objective-c.
From the description:
J2ObjC is an open-source command-line tool from Google that translates
Java code to Objective-C for the iOS (iPhone/iPad) platform. This tool
enables Java code to be part of an iOS application's build, as no
editing of the generated files is necessary. The goal is to write an
app's non-UI code (such as data access, or application logic) in Java,
which is then shared by web apps (using GWT), Android apps, and iOS
apps.

Related

How to get my android app to work on apple devices

So I created an app on android studio and now my boss wants me to get it to work on Apple devices.
Is there a short cut to get an Android App to work on Apple devices ie iPhones, iPads and so on.
I really don't wanna create a whole other version for Apple devices.
Impossible. An option is to create hybrid application using Xamarin or Flutter which will run on both iOS and Android. That means you need to migrate you current implementation to hybrid app.
There are several options to do it and each of them has pros and cons so choose wisely.
Hybrid App
A hybrid app allows you to build a cross-platform mobile application with web technology. There are plenty of options you can use like Ionic, PhoneGap or React Native. But since you have built an Android app with the native code I assume, those existent features need to be rewritten in order to run on an iOS device.
Xamarin/Flutter
They are both create a native-like experience. The advantage of them comparing with hybrid app technology is the performance would be better in general. But again, it doesn't mean that you can just create an iOS app without changing any code, you'll still need to rewrite most of part in your app.
Kotlin Native
As an android developer, you're probably familiar with Kotlin. It's officially supported by Android team and It's 100% interoperable with Java. Kotlin can also be compiled to run on multiplatform including iOS. By this way, you'll be able to reuse a lot of existing Kotlin code on both Android and iOS so you don't need to use a new language to rewrite all the functionalities you had done on Android. The cons are It's an experimental feature so It's young and could change on the future and the reusability doesn't mean that you don't need to learn iOS platform.

Decide concerning the technology I should use for developing an Android app based on an eCommerce domain

I need to develop an application related to C2C communication in which manufacturers can directly start communicating with retailers for bulk orders and maintain the order in an easy and fast way. Please suggest what framework i can use. For example: Native android developement, PhoneGap, Appcelerator Titanium.
PhoneGap: I have read that you cannot provide rich interactive applications and that it's not good in communicating with Android native apis.
Appcelerator Titanium: I need to purchase it and it requires a lot of money to develop an application.
Native development API: I have to provide a lot of time and it will be hard to communicate with my database and my web application using web services and it will be for the Android apps only
Which should I use for my app?
I'd say it depends on:
Your skills...
HTML: PhoneGap, Titanium (our Alloy MVC uses XML)
JS: Titanium, PhoneGap
JAVA: JAVA
Your plans...
One platform: Android
Multiple platforms: Titanium, PhoneGap
Your requirements...
Good UX: Titanium, Android
Titanium is open source and free (appcelerator.org) but we do provide paid (starting at $39/month) services, including Arrow, which is great to quickly build mobile web services to connect apps with any remote data source.
When you only want to develop an Android app you should use the native API. It offers most features, the better documentation (IMO) and is easier (and therefore cheaper) to maintain. Additionally it should be easy to communicate with databases and/or web APIs.
The only advantage Titanium offers is the multiple platform support. But when you only want to develop for Android use the native APIs.

Building the app for Web also

Can Nativescript build apps for web as well?
As Ionicframework and similar uses Cordova to build Android and iOS the same code there can be served by an HTTP server to the mobile or desktop browsers.
Will that be possible with the apps built with Nativescript, using same code base for web version of the app?
Nowadays Angular integration is on the way, and using Angular for the mvc kind of things (like data bindings, events etc.) and using Native for the device apis, platform apis and native gui would help in an unequaled way.
Angular parts can be used in the browser as well when built for it. What to do with the xml written for the gui templates in Nativescript, they could be converted to proper html for web built of the app, as Nativescript itself already uses a unified gui api for different platforms, that could be possible. And lastly, native calls made in NativeScript would be ignored in the web build.
It would be great to build for Android, iOS, and Web with the same exact code base.
tl;dr: No
Longer: The big difference between the Cordova/Phonegap based technologies (such as Ionic and Supersonic) and the Dynamic Runtime based technologies (such as NativeScript, React Native and Titanium) is that the first uses a HTML approach where the application is run by WebKit/Blink in a WebView. Looking on the Dynamic Runtime technologies there's no HTML Engine running your app, but rather native views and widgets. The framework (in this case NativeScript) is "just" a bridge between Javascript and the native language of the device.
However, depending of how you architecture your code, you can create Javascript which will be usable in both a NativeScript environment as well as in a browser environment.
Edit: The above means that you could reuse some of your code. There'll still be NativeScript specific code.
Edit2: There's an ongoing project to enable usage of Angular 2 in NativeScript. Please see current status in the issue: https://github.com/NativeScript/NativeScript/issues/103 Also note that the Telerik NativeScript core developer Valentin Stoychev is saying
The idea [is] to enable as much code reuse as possible between your web and mobile apps.
So: Yes on code reuse - no on exact same codebase.
Adding to the (correct) response of Emil - I do not think it is possible to have any significant portion of the app shared (even for the logic part) since {N} apps mostly utilize the Nativscript observable implementation which would probably 'leak' into your models / view models.
Having said that, I suggest you to monitor the work happening on integrating Angular2, which would probably mean a larger code sharing potential (with Angular2 web apps)

When to use a web framework and when to code with native language for android app

It's been a time that I developp on android using the native language on Eclipse ADT and Android Studio.
Mastering most of the "standard" stuff (services, broadcaster, accelerometer, online/offline apps, local and remote databases, ntf scanning, socket.io libraries etc...), I wanted to find new ways to architect my apps, and I ve finally found new ways to code, using Web Frameworks to make compiled applications.
Suddenly I was wondering, when to use which technolgy, for example :
ionic framework (with angular included & cordova)
phonegap & cordova
native language
other frameworks or ways to code
Thanks for advance
All about technology depend on your application, depend on time and your app complexity. If you are going with Cross platform apps, unquestionably cross platform is going to be more robust in the time to come. There is a simple rule for Cross platform apps, “write once use several times”. Same code can be used on multiple platforms but this requires a lot of customization to be able to match each platform’s individual requirements. HTML5 seems to be ruling the market due to its dynamic usage for building apps with different run times, patterns and frameworks. The PhoneGap framework whose name was changed lately by “Apache Cordova” is the best amongst all other tools. In this framework the developers write the mobile app in HTML, CSS and JavaScript....More about PhoneGap

Titanium or PhoneGap for Mobile Web Application?

I am going to create a mobile web application that will run on all web enabled mobile browsers. It will involve searching and booking of hotels and flights. We already have a desktop applocation developed in JavaEE, MySQL for the same.
What do you suggest I should use - PhoneGap or Titanium for this task?
What are the advantages and disadvantages to use each?
And what technologies should I know or learn to use each of these?
Phonegap
What is PhoneGap Trying To Accomplish?
The purpose of PhoneGap is to allow HTML-based web applications to be deployed and installed as native applications. PhoneGap web applications are wrapped in a native application shell, and can be installed via the native app stores for multiple platforms. Additionally, PhoneGap strives to provide a common native API set which is typically unavailable to web applications, such as basic camera access, device contacts, and sensors not already exposed in the browser.
To run a PhoneGap application on a native emulator/simulator, developers will generate a project for each of the native platforms they wish to support, configure that project’s “web root” directory in Xcode, Eclipse, or whatever native toolchain is needed, and then run the project using that tool.
Strengths of the PhoneGap Approach
Any native platform that supports a web view or web runtime can be a PhoneGap platform.
Anyone who can write HTML, CSS, and even a small bit of JavaScript can wrap up a web page in a native app and distribute it as such. The barrier to entry in using PhoneGap to package web pages as native apps is extremely low.
Weaknesses of the PhoneGap Approach
The quality of the user interface in a PhoneGap application will vary based on the quality of the web view and rendering engine on the platform. The Webkit-based rendering engine on iOS is strong, and provides the best performance. The Android web view is functional, but has some notable limitations.
PhoneGap also cannot be extended with native user interface. The end developer’s application its self lives inside a web view, and user interface is rendered in HTML.
Titanium
What is Titanium Trying to Accomplish?
The goal of Titanium Mobile is to provide a high level, cross-platform JavaScript runtime and API for mobile development (today we support iOS, Android, and the browser, with BlackBerry 10 and Windows Phone coming soon and eventually, respectively). Titanium actually has more in common with MacRuby/Hot Cocoa, PHP, or node.js than it does with PhoneGap, Adobe AIR, Corona, or Rhomobile. Titanium is built on two assertions about mobile development:
There is a core of mobile development APIs which can be normalized
across platforms. These areas should be targeted for code reuse.
There are platform-specific APIs, UI conventions, and features which
developers should incorporate when developing for that platform.
Platform-specific code should exist for these use cases to provide
the best possible experience.
Strengths of the Titanium Approach
Get access to a wide array of native features and functionality out of the box, from user interface components to socket interfaces to notification system integration.
Weaknesses of the Titanium Approach
Titanium platform is only available on what have been deemed the most critical mobile platforms at present: iOS, Android, and the web.
Some user interface components do not yet perform as well as their native counterparts under some circumstances, such as very large table views with highly customized layouts.
Source Link : Comparing Titanium and PhoneGap
Hope this helps.
Both Phonegap and Titanium are free for developing mobile application and to develop apps using Titanium, you should need basic knowledge in javascript since it is simple javascript combined with Titanium API while we can use most of web technologies like HTML, Javascript, CSS etc. It's purely depend on what type of application you want to create. More simply if you want to create simple app that does not contain graphs and drawings you can simply use Titanium but if your app contains graphs you should use Phonegap.

Categories

Resources