How can I set my ionic application for android only


#1

Hello All,

I have build sample application using ionic framework. I want to run this application in desktop browsers only but it shows like android device layout same like this application : http://ionicmaterial.com/demo/

Right now for local testing and running I am using this command and it shows both layout ios and android. I am using this command : “ionic serve -l”. If i will not give option -l then it shows in whole page. I want to load my application looks like this only http://ionicmaterial.com/demo/

Which configuration I need set. Can anybody please help me to solve this problem?

-Saurabh


#2

i would give you the advice not to use ionic for a web-app.
I tried it for a production project in the past. and you will run into usability issues on the different browsers you need to hack around.

use angularjs and one of the fancy layouts out there.
https://material.angularjs.org/latest/#/


#3

Mostly I have done code. Its hard to move now on angularjs which you suggested above in your comment?

Please give me as of now solution, how can I show my application for android browser only. Its simple study demo application. It would not be production url for more than 100 people. So I dnt want to change a lot of things.

Looking for your answer on my original question.


#4

in the demo… there is no cordova running in the background.

you can open your app in browser without cordova (no native apis available).
the demo pages loads the external app in an iframe and set the height and size to simulate phone handling.

Ionic does the same in their documentation and here:
http://play.ionic.io


#5

Are you trying to have it display in a browser only Android or make it an app on Android? If you want to use it on Android, just make an app instead of making it a web app. Ionic uses Angular so you shouldn’t be changing much of your code.


#6

I am trying to do display in a browser only Android, Its not possible?


#7

Thanks for reply. I have created whole application. Is this change will effect my application functionality and all. Yes I want to show my application in iFrame of other webpage. Is this possible?


#8

@swade

I am trying to do display in a browser only Android, Its not possible?


#9

sry but i do not understand want you want exactly… are you showing your app on a desktop browser but in android style… or do you want to run it on android in a browser or as an android app.


#10

Add platform-android on your body tag, that will display the application as if it was android regardless of whether they are on android or not.

@skpatel you need to frame your questions better and understand that Ionic is not intended for the web, if not for this application then for your next one you shouldn’t use Ionic if it’s purely for the desktop web browser.

You will NOT be able to access any cordova plugins from the web browser.


#11

Thanks for your reply, But I want to make application as like android which should be run in browser not in mobile devices. When I started this application at that time i thought ionic framework gives me what I want. This demo application creates positive impression in my mind.

http://ionicmaterial.com/demo/

What you suggest now, what should I use if I want to make my web browser application look like android, which framework suits best for me.?

I appreciate your efforts.


#12

I want to show my app on desktop browser but in android style as like this demo

http://ionicmaterial.com/demo/


#13

So you want Material Design, there is a clear distinction between Android and Material Design. You can use Google’s CSS/JS here http://www.getmdl.io/


#14

It will give me same android application type look in desktop browser? Forget about material design. I want to make that layout type web application which looks like android application. (I said as like demo application. I do not want material design as of now.)

Is http://www.getmdl.io/ will server my purpose?


#15

Sorry, I can’t help you, it’s not clear what you want, as per that example my link will suit your needs.


#16

@delta98
I do not think so this is hard to understand, I said in my question and comments clearly that

“I want to show my application in desktop browser, but this application looks like android application”

What I want that same thing has been describe here, only difference is that material design.

I am not able to see any demo/samples on http://www.getmdl.io/ website which looks like my needs.

I hope this time it is clear enough for you.


#17

So you want to be able to have an ionic app run in the browser, have the android design, but also run in an iframe like the ionicmaterial.com demo?

Again, I don’t think the question is clear.


#18

Thanks for your reply. So you mean that " ionicmaterial.com demo" is running in iFrame?
If yes then I want the same thing.

I was thinking that ionicmaterial.com demo is running in that way so I can feel its android application look and feel in desktop browser.

Sorry for misunderstood the way “ionicmaterial.com demo” is working. Is it possible to run my application same like ionicmaterial.com demo application with iFrame?

I appreciate your efforts and thanks for helping me.


#19

Yes, it is possible, but again, it’s not the purpose of ionic.

<iframe src="path/to/your/app"></iframe>

Then you just need some css to stye the iframe.


#20

Thanks for your reply.

I will try to do the same in my application. Is there any more device setting or attribute where I need to specify as android platform?