Discussion Forums  >  Suggestions, Ideas, Wish List

Replies: 23    Views: 88

AlanMac
Aspiring developer
Profile
Posts: 2612
Reg: Mar 05, 2012
Esher, UK
37,120
05/09/13 08:56 AM (12 years ago)

If Android else IOS

When building apps that work for Android and Apple, I sometimes find I need one solution for Apple and a different one for Android. What would be very helpful is a to have a plugin or anything we can use that detects the OS that the app is on and calls one type of screen/plugin if running on Android or another type of screen/plugin if running on IOS. For example, I might want to display an RSS feed. I would call a screen made of type "if_then_else plugin". This plugin is configured with two screens it points to - one screen set up for Android (e.g. a custom URL plugin with a link pointing to rssinclude.com) and a different screen for on IOS (e.g that uses the RSS plugin). How feasible is this idea? And how brilliant would it be? Alan
 
GoNorthWest
buzztouch Evangelist
Profile
Posts: 8197
Reg: Jun 24, 2011
Oro Valley, AZ
1,000,000
like
05/09/13 09:13 AM (12 years ago)
Hi Alan, That would be pretty cool, and it's something that's used on web pages all the time. "If IE, display it this way, else display it the right way." Or "if mobile, then give this page, else give this page." Fundamentally, you wouldn't be able to do that for an app screen itself, because the app has to be compiled with a specific set of instructions beforehand, and they're already targeted to the specific platform. iOS uses Objective C, and Android uses Java. It would be pretty hard to write a plugin that switches between platforms and programming languages. I'm not even sure that's possible. You probably could do something within a particular screen, though, like withing an HTML screen. There's probably some code that can detect the OS that HTML is being rendered on, and you could then send it one way or another. But on an individual plugin level, since the screen has to be compiled into the app, I'm not quite sure it would work. I could be totally wrong though, so I'm interested in what others will post! Mark
 
Kittsy
buzztouch Evangelist
Profile
Posts: 2251
Reg: Feb 22, 2012
Liverpool
31,360
like
05/09/13 09:36 AM (12 years ago)
Chris1 has a menu list coming out hat does this
 
GoNorthWest
buzztouch Evangelist
Profile
Posts: 8197
Reg: Jun 24, 2011
Oro Valley, AZ
1,000,000
like
05/09/13 09:39 AM (12 years ago)
Well, there we go! I stand corrected! Can't wait to see it in action. Mark
 
AlanMac
Aspiring developer
Profile
Posts: 2612
Reg: Mar 05, 2012
Esher, UK
37,120
like
05/09/13 09:51 AM (12 years ago)
Glad it's do-able, that is great. I thought it wouldn't need to do much more than detect the environment, then serve the relevant (pre-built) screen, but as nobody had done it before, I wasn't sure why. It would be great to have this a stand-alone thing, not tied to a specific menu.
 
Kittsy
buzztouch Evangelist
Profile
Posts: 2251
Reg: Feb 22, 2012
Liverpool
31,360
like
05/09/13 09:53 AM (12 years ago)
It's in the market now actually it's the advanced image menu. You could use that as your initial screen it then only shows ios, android or both depending on device. You could lift the code to mod another plugin
 
AlanMac
Aspiring developer
Profile
Posts: 2612
Reg: Mar 05, 2012
Esher, UK
37,120
like
05/09/13 09:56 AM (12 years ago)
LOL - I can lift a pint, code is a bit heavy!
 
chris1
Code is Art
Profile
Posts: 3862
Reg: Aug 10, 2012
Austin, TX
50,120
like
05/09/13 10:18 AM (12 years ago)
Yep - it's one of the new plugins in the market. If there's other plugins you need to be modified for this feature, I'd be happy to do some custom work for you.
 
AlanMac
Aspiring developer
Profile
Posts: 2612
Reg: Mar 05, 2012
Esher, UK
37,120
like
05/09/13 10:39 AM (12 years ago)
Hi Chris - sounds fantastic. I am not a coder, but I can cut and paste! I was thinking of this being very minimalist, with two config options and no display output at all. Would the blank plug-in be a candidate?
 
chris1
Code is Art
Profile
Posts: 3862
Reg: Aug 10, 2012
Austin, TX
50,120
like
05/09/13 10:44 AM (12 years ago)
I'm confused - why would you want to display a blank screen?
 
AlanMac
Aspiring developer
Profile
Posts: 2612
Reg: Mar 05, 2012
Esher, UK
37,120
like
05/09/13 11:05 AM (12 years ago)
Hi Chris, perhaps I misunderstood you. I thought the starting point would be a simple plugin that does nothing, to which you would drop in some code, with the names of the two screens to call, the intent being if I call the plugin, it in turn just calls one of the two named screens. Btw, did I mention I'm no programmer so I have no idea if this is the way to go?
 
AlanMac
Aspiring developer
Profile
Posts: 2612
Reg: Mar 05, 2012
Esher, UK
37,120
like
05/09/13 01:55 PM (12 years ago)
I'll try the plugin, it looks really good.
 
chris1
Code is Art
Profile
Posts: 3862
Reg: Aug 10, 2012
Austin, TX
50,120
like
05/09/13 05:33 PM (12 years ago)
So in other words, you want a different home screen for the different platforms?
 
WebNevees
Code is Art
Profile
Posts: 206
Reg: Oct 28, 2012
KL
11,660
like
05/09/13 07:26 PM (12 years ago)
Hi guys Could you possibly clear this up for me? I don't understand what you mean to achieve. From my half understanding this might help. Let me know. You could do two things in my mind. The best would be to create two different apps for your two OSes. Then you can fix most any problem much easier than with one app. You can update just the Android or iOS version by itself. No coding, and no mess. You can also create a new plug in (by copying and renaming, and a small bit of changes mostly renaming in the code, and packing and installing to your server if you'll need it alot) then put whatever plug in code you want for Android in the Android source code folder and whatever plug in you want in the iOS folder. Now you'll have it.
 
WebNevees
Code is Art
Profile
Posts: 206
Reg: Oct 28, 2012
KL
11,660
like
05/09/13 07:33 PM (12 years ago)
Oh. I forgot to say. Checking for OS is what I really don't get. I I am doing other checking right now in my code though. For example I have two screens in one android app, one a customURL plug in and the other a local html plug in for my maps screen. Since I don't want to display an error page when the user is offline and I want him to see the contact details and map, I have put that all in my local html screen. I check a condition every time to see if I have network connectivity and switch between plug in this way. I have also extended it for use in the control panel. Is this about what you mean to achieve? Let me know I'll send you the link to the app.
 
chris1
Code is Art
Profile
Posts: 3862
Reg: Aug 10, 2012
Austin, TX
50,120
like
05/09/13 09:32 PM (12 years ago)
@WebNeeves - that's a pretty good mod there! You should consider making a how-to or perhaps a full plugin for it? What @AlanMac is talking about (if I understand him right) is having a way of pointing to different screens based on iOS or Android. Certainly having two apps - one for each platform - is a way of doing that. But let's say you have an app with hundreds of screens, only a few of which use plugins that are iOS-only or Android-only. It would be a chore to set up two copies of the app initially, and another chore to keep both sets updated. So what he is proposing (again, if I understand correctly) is a simple way to get around this problem. You have a 'plugin' that simply autoloads another screen. The screen it will load depends on whether it is iOS or Android. It's a fairly simple concept, and an easy plugin to make. The tricky part might be in the animated transitions.
 
WebNevees
Code is Art
Profile
Posts: 206
Reg: Oct 28, 2012
KL
11,660
like
05/09/13 10:38 PM (12 years ago)
@Chris Gotcha! OK now I understand. Thanks for shedding light unto the problem. Now that you mention it as so, it becomes a real pain. With all the screens and data one might have. And thanks for the compliment about the modification, I didn't think it was so important. But if you say so I'll get to work on it. I just did this to get going with my maps screen. Thanks
 
AlanMac
Aspiring developer
Profile
Posts: 2612
Reg: Mar 05, 2012
Esher, UK
37,120
like
05/10/13 01:34 AM (12 years ago)
@WebNevees, that mod sounds pretty cool, I have an technique with an app, with pages that work offline when I release the app, then if the app goes online, the app updates and the menus are modified to different pages that work online. Your approach sounds better. @Chris1, I think you've got my idea pretty well. The two main benefits of having such a plugin not in a menu are :- 1) It could work with any existing cross platform menu (e.g buttons). 2) You don't have to replace existing menus in your existing apps to gain this functionality. If such a plugin didn't understand animated transitions, that would be easy to live with. The scenarios I'm thinking of are all where a plugin exists for ios and you need a work-around for Android. E.g. for RSS there is an plugin ios plugin, for Android I use a custom url based solution. For displaying tweets, I have one solution that is good on IOS, another that is better on Android. For photo gallery, there are a couple of IOS plugins, for Android I look to an html solution such as photoswipe. There are bound to be more scenarios. The pro's and cons of combined platform vs separate apps are eloquently articulated by others, I believe there is a place for both. Chris, I recognise your plugins are all combined, which is much appreciated. If I understand correctly, does your new Menu Image Advanced Plugin do 'if then else' functionality this already as I have described - is that right? If so I will give it a try asap. There have been a couple of references above to home screen - I am not thinking of using this there, is that a problem? I was thinking of using it for the secondary menus off the main screen. Thanks, Alan
 
chris1
Code is Art
Profile
Posts: 3862
Reg: Aug 10, 2012
Austin, TX
50,120
like
05/10/13 05:28 AM (12 years ago)
My plugin is similar in concept, different in execution. For each menu item, you can choose between iOS, Android, or both. If you choose, say, iOS, the menu row won't show up in the Android menu screen. So you would want a complimentary row for Android-only to point to a different plugin to handle that same function.
 
AlanMac
Aspiring developer
Profile
Posts: 2612
Reg: Mar 05, 2012
Esher, UK
37,120
like
05/10/13 08:14 AM (12 years ago)
Presumably you don't get gaps in the displayed menu on one or other device?
 
WebNevees
Code is Art
Profile
Posts: 206
Reg: Oct 28, 2012
KL
11,660
like
05/10/13 06:23 PM (12 years ago)
Hi again Chris, Alan: Good news: I got the plugin created to do exactly what you need. Both in Android and iOS. Transitions have been worked into it too. I will be uploading it in a couple hours. I hope it helps you and our other friends at Buzztouch Alan. @Chris: I'll hope you can take a look at it once finished in order to give me any pointers for next versions. I just hope it doesn't take too long to show up. I'll submit it to Susan today. Cheers !
 
AlanMac
Aspiring developer
Profile
Posts: 2612
Reg: Mar 05, 2012
Esher, UK
37,120
like
05/11/13 03:08 AM (12 years ago)
Well done @WebNevees, if you'd like it tested, let me know. From idea to implementation in 36 hours - I love this forum!
 
WebNevees
Code is Art
Profile
Posts: 206
Reg: Oct 28, 2012
KL
11,660
like
05/11/13 05:37 AM (12 years ago)
Ok sure, I'll get it packaged and sent over. Was working on client's project till now.
 
chris1
Code is Art
Profile
Posts: 3862
Reg: Aug 10, 2012
Austin, TX
50,120
like
05/11/13 12:39 PM (12 years ago)
Yep - I'll be happy to test if you need/want.
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.