M Martincg Member Licensed User Longtime User Oct 3, 2019 #1 I want a widget for an app I am writing and I've read the tutorials and tried the examples. I am concerned that to test the widget it is required to run in release mode which makes debugging more difficult, so I thought that it is probably better to create a widget and have the main app send a message to it to update what it displays. Is this a reasonable approach or am I just confused? Second question- I have seen an app which can create widgets so that when you choose to add a new option for the app it will automatically generate a widget to show the data for that option. How is that done?
I want a widget for an app I am writing and I've read the tutorials and tried the examples. I am concerned that to test the widget it is required to run in release mode which makes debugging more difficult, so I thought that it is probably better to create a widget and have the main app send a message to it to update what it displays. Is this a reasonable approach or am I just confused? Second question- I have seen an app which can create widgets so that when you choose to add a new option for the app it will automatically generate a widget to show the data for that option. How is that done?
Erel B4X founder Staff member Licensed User Longtime User Oct 4, 2019 #2 Martincg said: Is this a reasonable approach or am I just confused? Click to expand... I don't think that it is worth the efforts. It will be easier to test it with release mode. Use Log messages to better understand what happens. Martincg said: Second question- I have seen an app which can create widgets so that when you choose to add a new option for the app it will automatically generate a widget to show the data for that option. How is that done? Click to expand... I'm not sure that I understand this question. You cannot add widgets automatically. The user must add the widget. Upvote 0
Martincg said: Is this a reasonable approach or am I just confused? Click to expand... I don't think that it is worth the efforts. It will be easier to test it with release mode. Use Log messages to better understand what happens. Martincg said: Second question- I have seen an app which can create widgets so that when you choose to add a new option for the app it will automatically generate a widget to show the data for that option. How is that done? Click to expand... I'm not sure that I understand this question. You cannot add widgets automatically. The user must add the widget.
M Martincg Member Licensed User Longtime User Oct 4, 2019 #3 Thanks for your reply Erel. Erel said: I don't think that it is worth the efforts. It will be easier to test it with release mode. Use Log messages to better understand what happens. Click to expand... By Log messages do you mean writing logs to a file? Erel said: I'm not sure that I understand this question. You cannot add widgets automatically. The user must add the widget. Click to expand... That means I understand even less than I thought. Does this mean that it is necessary to install the app in two stages as far as the user is concerned. That is, you install the app which adds the widget to the list of widgets, the app closes. Then the user must drag the widget onto the home screen and some option provided on the widget brings the app to the front? I don't understand this because the widget dragged to the home screen is just an instance of the app which could be duplicated? Upvote 0
Thanks for your reply Erel. Erel said: I don't think that it is worth the efforts. It will be easier to test it with release mode. Use Log messages to better understand what happens. Click to expand... By Log messages do you mean writing logs to a file? Erel said: I'm not sure that I understand this question. You cannot add widgets automatically. The user must add the widget. Click to expand... That means I understand even less than I thought. Does this mean that it is necessary to install the app in two stages as far as the user is concerned. That is, you install the app which adds the widget to the list of widgets, the app closes. Then the user must drag the widget onto the home screen and some option provided on the widget brings the app to the front? I don't understand this because the widget dragged to the home screen is just an instance of the app which could be duplicated?
Erel B4X founder Staff member Licensed User Longtime User Oct 6, 2019 #4 Martincg said: By Log messages do you mean writing logs to a file? Click to expand... You can also monitor the logs from the IDE in release mode. Don't confuse widgets with simple shortcuts. A widget is an extension of your app. The user must add it from the widgets list. Upvote 0
Martincg said: By Log messages do you mean writing logs to a file? Click to expand... You can also monitor the logs from the IDE in release mode. Don't confuse widgets with simple shortcuts. A widget is an extension of your app. The user must add it from the widgets list.
M Martincg Member Licensed User Longtime User Oct 6, 2019 #5 Erel said: You can also monitor the logs from the IDE in release mode. Click to expand... Oh, - now I've noticed the "#BridgeLogger" message, thanks Erel. I think that I want a widget so that I can show changing information. But if a shortcut can do that then it might be suitable. I will read up on shortcuts. Things which are generally obvious can be completely misunderstood by a novice like me. The following is what I believe I understand now but didn't 2 days ago. When you write the code for a widget in your app it only tells the OS to add the representation of the widget to the widget list if it doesn't already exist. If for example you remove the widget from the list it will not remove instances of the widgets on the home screen, but starting the program again will replace it. When you actually add the widget to the home screen the OS creates a separate and simple object which doesn't have any of the code that the app has and which is not part of the app. Special methods have to be used in the app to communicate with it. If that is incorrect please tell me anyone. Upvote 0
Erel said: You can also monitor the logs from the IDE in release mode. Click to expand... Oh, - now I've noticed the "#BridgeLogger" message, thanks Erel. I think that I want a widget so that I can show changing information. But if a shortcut can do that then it might be suitable. I will read up on shortcuts. Things which are generally obvious can be completely misunderstood by a novice like me. The following is what I believe I understand now but didn't 2 days ago. When you write the code for a widget in your app it only tells the OS to add the representation of the widget to the widget list if it doesn't already exist. If for example you remove the widget from the list it will not remove instances of the widgets on the home screen, but starting the program again will replace it. When you actually add the widget to the home screen the OS creates a separate and simple object which doesn't have any of the code that the app has and which is not part of the app. Special methods have to be used in the app to communicate with it. If that is incorrect please tell me anyone.
Erel B4X founder Staff member Licensed User Longtime User Oct 7, 2019 #6 Martincg said: If that is incorrect please tell me anyone. Click to expand... More or less. The home app starts the widget service when needed and interacts with it using intents. Upvote 0
Martincg said: If that is incorrect please tell me anyone. Click to expand... More or less. The home app starts the widget service when needed and interacts with it using intents.