How to make a widget?

Is there any way to make a widget that will work with Ionic app? If so, how to make it on both iOS and Android?

1 Like

Define “widget” please.

something like this weather widget:

but in my case just a simple card with few buttons

I think you can make a custom component (in your case, a card with a few buttons) and then use that component wherever you need to :

  <ion-content>
     <my-component></my-component>
     ...
  </ion-content>

This doesn’t exist in Cordova land. See here:

No, these work only inside Ionic apps.

Oh, custom components don’t work on native devices?

That question makes no sense. What should a “native device” be?
Custom components only work in the app they are used. Custom components are a HTML construct, that only works in HTML context.

oh no! so it means the answer is NO?

Sorry, I guess I meant to ask : would a custom component render on a device using the ionic app?

dude we are talking about widgets, could you please go somewhere else or someone split your questions into another topic?

Well the whole point of that sub discussion was to clarify if custom components would be the solution to your issue, because that’s how I would have initially gone about it.

As far as I know, there is no concept of a ‘widget’ in Ionic

so why do you start discussion about this when you have no clue about topic, nor you understand correctly what a widget is?

As far as I know, for Android, yes, the answer is No. Not possible with Ionic directly.
You can create it in native code and maybe attach it to your Android Ionic app.

Not in the context of the question. As widgets require native code, it is not possible to render a custom component in a webview that doesn’t exist.

1 Like

I do know what a widget is. I have some familiarity with android apps and dragging and dropping widgets to the UI. When I read your problem though, I thought the simplest solution would be to create a custom component that you can insert wherever you want.

When you’re working with a framework, you don’t always get exactly what you want : you need to use workarounds sometimes, which is what I was trying to suggest

ok but if I write widget using native code the app will be usable only on one platform, right?

Yes, you will have to do that per native platform.

I was experimenting with today widgets with Ionic for iOS some time ago, but didn’t finish the project as I encountered memory constraints I couldn’t fulfill with the Cordova Webview (<20 MB). So in my opinion similar situation.

1 Like

Hi

Additional reading material and terminology

Rgds

Tom

1 Like

Hey have a look at Microsoft project ace
That might solve your problem

Regards
Sid