sAleksovski / react-native-android-widget

Build Android Widgets with React Native

Home Page:https://sAleksovski.github.io/react-native-android-widget/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Widgets do not appear on the home screen only on the device

explorer-cat opened this issue · comments

Hi, I'm using the library well
However, when you add an app from a certain point in time, the widget will not be drawn on the screen
In the emulator, the widget appears well on the home screen, but the home screen UI does not appear on the actual device because it is built and deployed

Can I see the logs when I add widgets from this library?

I updated the library to the latest version
"react-native": "0.71.6", is being used

Do you happen to have a channel where I can talk to you in real time? Our app will be launched next week, please

Can you check the logcat logs?

Do you correctly handle the WIDGET_ADDED, WIDGET_UPDATE... events?

Is the app crashing? Any logs?

It works well when you add widgets in debug mode after connecting the emulator or USB, but the widget is not visible in the app registered in the market in release mode.
I don't know how to check the logcat release mode.

I don't think I completely understand.

You add the widget on the home screen, and it does not render? What do you see?
Can you send a screenshot/video?

You can enable logs using https://stackoverflow.com/questions/25610936/enable-logcat-on-release-build-in-android-studio

SQLite.backgroundExecuteSqlBatch({"dbargs":{"dbname":"TestDB.db"},"executes":[{"qid":1111,"sql":"BEGIN","params":[]},{"qid":1111,"sql":"SELECT userInfo., members. FROM userInfo JOIN members ON userInfo.memberIdx = members.idx","params":[]}]})
2023-11-16 11:23:50.994 25170-25429 System.err com.yhdatabase.ybe W java.lang.ClassCastException: sun.net.www.protocol.file.FileURLConnection cannot be cast to java.net.HttpURLConnection
2023-11-16 11:23:50.995 25170-25429 System.err com.yhdatabase.ybe W at com.reactnativeandroidwidget.builder.widget.utils.ResourceUtils.getInputStreamFromSource(ResourceUtils.java:102)
2023-11-16 11:23:50.995 25170-25429 System.err com.yhdatabase.ybe W at com.reactnativeandroidwidget.builder.widget.utils.ResourceUtils.getBitmap(ResourceUtils.java:44)
2023-11-16 11:23:50.995 25170-25429 System.err com.yhdatabase.ybe W at com.reactnativeandroidwidget.builder.widget.ImageWidget.getBitmapFromURL(ImageWidget.java:44)
2023-11-16 11:23:50.995 25170-25429 System.err com.yhdatabase.ybe W at com.reactnativeandroidwidget.builder.widget.ImageWidget.applyProps(ImageWidget.java:27)
2023-11-16 11:23:50.995 25170-25429 System.err com.yhdatabase.ybe W at com.reactnativeandroidwidget.builder.widget.BaseWidget.(BaseWidget.java:36)
2023-11-16 11:23:50.995 25170-25429 System.err com.yhdatabase.ybe W at com.reactnativeandroidwidget.builder.widget.BaseWidget.(BaseWidget.java:40)
2023-11-16 11:23:50.995 25170-25429 System.err com.yhdatabase.ybe W at com.reactnativeandroidwidget.builder.widget.ImageWidget.(ImageWidget.java:17)
2023-11-16 11:23:50.995 25170-25429 System.err com.yhdatabase.ybe W at com.reactnativeandroidwidget.builder.WidgetFactory.getBaseWidget(WidgetFactory.java:104)
2023-11-16 11:23:50.995 25170-25429 System.err com.yhdatabase.ybe W at com.reactnativeandroidwidget.builder.WidgetFactory.buildWidget(WidgetFactory.java:71)
2023-11-16 11:23:50.995 25170-25429 System.err com.yhdatabase.ybe W at com.reactnativeandroidwidget.builder.WidgetFactory.buildChildren(WidgetFactory.java:125)
2023-11-16 11:23:50.995 25170-25429 System.err com.yhdatabase.ybe W at com.reactnativeandroidwidget.builder.WidgetFactory.getBaseWidget(WidgetFactory.java:108)
2023-11-16 11:23:50.995 25170-25429 System.err com.yhdatabase.ybe W at com.reactnativeandroidwidget.builder.WidgetFactory.buildWidget(WidgetFactory.java:71)
2023-11-16 11:23:50.995 25170-25429 System.err com.yhdatabase.ybe W at com.reactnativeandroidwidget.builder.WidgetFactory.buildChildren(WidgetFactory.java:125)
2023-11-16 11:23:50.995 25170-25429 System.err com.yhdatabase.ybe W at com.reactnativeandroidwidget.builder.WidgetFactory.getBaseWidget(WidgetFactory.java:108)
2023-11-16 11:23:50.995 25170-25429 System.err com.yhdatabase.ybe W at com.reactnativeandroidwidget.builder.WidgetFactory.buildWidget(WidgetFactory.java:71)
2023-11-16 11:23:50.995 25170-25429 System.err com.yhdatabase.ybe W at com.reactnativeandroidwidget.builder.WidgetFactory.buildChildren(WidgetFactory.java:125)
2023-11-16 11:23:50.995 25170-25429 System.err com.yhdatabase.ybe W at com.reactnativeandroidwidget.builder.WidgetFactory.getBaseWidget(WidgetFactory.java:108)
2023-11-16 11:23:50.995 25170-25429 System.err com.yhdatabase.ybe W at com.reactnativeandroidwidget.builder.WidgetFactory.buildWidget(WidgetFactory.java:71)
2023-11-16 11:23:50.995 25170-25429 System.err com.yhdatabase.ybe W at com.reactnativeandroidwidget.builder.WidgetFactory.buildChildren(WidgetFactory.java:125)
2023-11-16 11:23:50.995 25170-25429 System.err com.yhdatabase.ybe W at com.reactnativeandroidwidget.builder.WidgetFactory.getBaseWidget(WidgetFactory.java:114)
2023-11-16 11:23:50.995 25170-25429 System.err com.yhdatabase.ybe W at com.reactnativeandroidwidget.builder.WidgetFactory.buildWidget(WidgetFactory.java:71)
2023-11-16 11:23:50.995 25170-25429 System.err com.yhdatabase.ybe W at com.reactnativeandroidwidget.builder.WidgetFactory.buildWidgetFromRoot(WidgetFactory.java:41)
2023-11-16 11:23:50.995 25170-25429 System.err com.yhdatabase.ybe W at com.reactnativeandroidwidget.RNWidget.drawWidget(RNWidget.java:62)
2023-11-16 11:23:50.995 25170-25429 System.err com.yhdatabase.ybe W at com.reactnativeandroidwidget.AndroidWidgetModule.drawWidgetById(AndroidWidgetModule.java:41)
2023-11-16 11:23:50.995 25170-25429 System.err com.yhdatabase.ybe W at java.lang.reflect.Method.invoke(Native Method)
2023-11-16 11:23:50.995 25170-25429 System.err com.yhdatabase.ybe W at com.facebook.react.bridge.JavaMethodWrapper.invoke(JavaMethodWrapper.java:372)
2023-11-16 11:23:50.995 25170-25429 System.err com.yhdatabase.ybe W at com.facebook.react.bridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:188)
2023-11-16 11:23:50.995 25170-25429 System.err com.yhdatabase.ybe W at com.facebook.jni.NativeRunnable.run(Native Method)
2023-11-16 11:23:50.995 25170-25429 System.err com.yhdatabase.ybe W at android.os.Handler.handleCallback(Handler.java:942)
2023-11-16 11:23:50.995 25170-25429 System.err com.yhdatabase.ybe W at android.os.Handler.dispatchMessage(Handler.java:99)
2023-11-16 11:23:50.995 25170-25429 System.err com.yhdatabase.ybe W at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:27)
2023-11-16 11:23:50.995 25170-25429 System.err com.yhdatabase.ybe W at android.os.Looper.loopOnce(Looper.java:226)
2023-11-16 11:23:50.995 25170-25429 System.err com.yhdatabase.ybe W at android.os.Looper.loop(Looper.java:313)
2023-11-16 11:23:50.996 25170-25429 System.err com.yhdatabase.ybe W at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(MessageQueueThreadImpl.java:228)
2023-11-16 11:23:50.996 25170-25429 System.err com.yhdatabase.ybe W at java.lang.Thread.run(Thread.java:1012)
2023-11-16 11:23:51.001 25170-25428 ReactNativeJS com.yhdatabase.ybe I SQLite.backgroundExecuteSqlBatch({"dbargs":{"dbname":"TestDB.db"},"executes":[{"qid":1111,"sql":"COMMIT","params":[]}]})
2023-11-16 11:23:51.003 25170-25428 ReactNativeJS com.yhdatabase.ybe I 'params', { token: '5b842e29e55d4612bb4b983909e11ca6',
workDt: '2023-11-16',
memberIdx: '1881' }
2023-11-16 11:23:51.024 25170-25450 TrafficStats com.yhdatabase.ybe D tagSocket(6) with statsTag=0xffffffff, statsUid=-1
2023-11-16 11:23:51.242 25170-25231 WM-WorkerWrapper com.yhdatabase.ybe I Worker result SUCCESS for Work [ id=15e817dd-2f8b-49ea-a2bf-2210970ac28c, tags={ com.reactnativeandroidwidget.RNWidgetBackgroundTaskWorker } ]
2023-11-16 11:23:51.271 25170-25429 System.err com.yhdatabase.ybe W java.lang.ClassCastException: sun.net.www.protocol.file.FileURLConnection cannot be cast to java.net.HttpURLConnection
2023-11-16 11:23:51.271 25170-25429 System.err com.yhdatabase.ybe W at com.reactnativeandroidwidget.builder.widget.utils.ResourceUtils.getInputStreamFromSource(ResourceUtils.java:102)
2023-11-16 11:23:51.272 25170-25429 System.err com.yhdatabase.ybe W at com.reactnativeandroidwidget.builder.widget.utils.ResourceUtils.getBitmap(ResourceUtils.java:44)
2023-11-16 11:23:51.272 25170-25429 System.err com.yhdatabase.ybe W at com.reactnativeandroidwidget.builder.widget.ImageWidget.getBitmapFromURL(ImageWidget.java:44)
2023-11-16 11:23:51.272 25170-25429 System.err com.yhdatabase.ybe W at com.reactnativeandroidwidget.builder.widget.ImageWidget.applyProps(ImageWidget.java:27)
2023-11-16 11:23:51.272 25170-25429 System.err com.yhdatabase.ybe W at com.reactnativeandroidwidget.builder.widget.BaseWidget.(BaseWidget.java:36)
2023-11-16 11:23:51.272 25170-25429 System.err com.yhdatabase.ybe W at com.reactnativeandroidwidget.builder.widget.BaseWidget.(BaseWidget.java:40)
2023-11-16 11:23:51.272 25170-25429 System.err com.yhdatabase.ybe W at com.reactnativeandroidwidget.builder.widget.ImageWidget.(ImageWidget.java:17)
2023-11-16 11:23:51.272 25170-25429 System.err com.yhdatabase.ybe W at com.reactnativeandroidwidget.builder.WidgetFactory.getBaseWidget(WidgetFactory.java:104)
2023-11-16 11:23:51.272 25170-25429 System.err com.yhdatabase.ybe W at com.reactnativeandroidwidget.builder.WidgetFactory.buildWidget(WidgetFactory.java:71)
2023-11-16 11:23:51.272 25170-25429 System.err com.yhdatabase.ybe W at com.reactnativeandroidwidget.builder.WidgetFactory.buildChildren(WidgetFactory.java:125)
2023-11-16 11:23:51.272 25170-25429 System.err com.yhdatabase.ybe W at com.reactnativeandroidwidget.builder.WidgetFactory.getBaseWidget(WidgetFactory.java:108)
2023-11-16 11:23:51.272 25170-25429 System.err com.yhdatabase.ybe W at com.reactnativeandroidwidget.builder.WidgetFactory.buildWidget(WidgetFactory.java:71)
2023-11-16 11:23:51.272 25170-25429 System.err com.yhdatabase.ybe W at com.reactnativeandroidwidget.builder.WidgetFactory.buildChildren(WidgetFactory.java:125)
2023-11-16 11:23:51.272 25170-25429 System.err com.yhdatabase.ybe W at com.reactnativeandroidwidget.builder.WidgetFactory.getBaseWidget(WidgetFactory.java:108)
2023-11-16 11:23:51.272 25170-25429 System.err com.yhdatabase.ybe W at com.reactnativeandroidwidget.builder.WidgetFactory.buildWidget(WidgetFactory.java:71)
2023-11-16 11:23:51.272 25170-25429 System.err com.yhdatabase.ybe W at com.reactnativeandroidwidget.builder.WidgetFactory.buildChildren(WidgetFactory.java:125)
2023-11-16 11:23:51.272 25170-25429 System.err com.yhdatabase.ybe W at com.reactnativeandroidwidget.builder.WidgetFactory.getBaseWidget(WidgetFactory.java:108)
2023-11-16 11:23:51.272 25170-25429 System.err com.yhdatabase.ybe W at com.reactnativeandroidwidget.builder.WidgetFactory.buildWidget(WidgetFactory.java:71)
2023-11-16 11:23:51.272 25170-25429 System.err com.yhdatabase.ybe W at com.reactnativeandroidwidget.builder.WidgetFactory.buildChildren(WidgetFactory.java:125)
2023-11-16 11:23:51.272 25170-25429 System.err com.yhdatabase.ybe W at com.reactnativeandroidwidget.builder.WidgetFactory.getBaseWidget(WidgetFactory.java:114)
2023-11-16 11:23:51.272 25170-25429 System.err com.yhdatabase.ybe W at com.reactnativeandroidwidget.builder.WidgetFactory.buildWidget(WidgetFactory.java:71)
2023-11-16 11:23:51.272 25170-25429 System.err com.yhdatabase.ybe W at com.reactnativeandroidwidget.builder.WidgetFactory.buildWidgetFromRoot(WidgetFactory.java:41)
2023-11-16 11:23:51.272 25170-25429 System.err com.yhdatabase.ybe W at com.reactnativeandroidwidget.RNWidget.drawWidget(RNWidget.java:62)
2023-11-16 11:23:51.272 25170-25429 System.err com.yhdatabase.ybe W at com.reactnativeandroidwidget.AndroidWidgetModule.drawWidgetById(AndroidWidgetModule.java:41)
2023-11-16 11:23:51.272 25170-25429 System.err com.yhdatabase.ybe W at java.lang.reflect.Method.invoke(Native Method)
2023-11-16 11:23:51.272 25170-25429 System.err com.yhdatabase.ybe W at com.facebook.react.bridge.JavaMethodWrapper.invoke(JavaMethodWrapper.java:372)
2023-11-16 11:23:51.272 25170-25429 System.err com.yhdatabase.ybe W at com.facebook.react.bridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:188)
2023-11-16 11:23:51.272 25170-25429 System.err com.yhdatabase.ybe W at com.facebook.jni.NativeRunnable.run(Native Method)
2023-11-16 11:23:51.272 25170-25429 System.err com.yhdatabase.ybe W at android.os.Handler.handleCallback(Handler.java:942)
2023-11-16 11:23:51.272 25170-25429 System.err com.yhdatabase.ybe W at android.os.Handler.dispatchMessage(Handler.java:99)
2023-11-16 11:23:51.272 25170-25429 System.err com.yhdatabase.ybe W at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:27)
2023-11-16 11:23:51.272 25170-25429 System.err com.yhdatabase.ybe W at android.os.Looper.loopOnce(Looper.java:226)
2023-11-16 11:23:51.272 25170-25429 System.err com.yhdatabase.ybe W at android.os.Looper.loop(Looper.java:313)
2023-11-16 11:23:51.272 25170-25429 System.err com.yhdatabase.ybe W at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(MessageQueueThreadImpl.java:228)

java.lang.ClassCastException: sun.net.www.protocol.file.FileURLConnection cannot be cast to java.net.HttpURLConnection
2023-11-16 11:27:40.548 25170-25429 System.err com.yhdatabase.ybe W at com.reactnativeandroidwidget.builder.widget.utils.ResourceUtils.getInputStreamFromSource(ResourceUtils.java:102)
2023-11-16 11:27:40.548 25170-25429 System.err com.yhdatabase.ybe W at com.reactnativeandroidwidget.builder.widget.utils.ResourceUtils.getBitmap(ResourceUtils.java:44)
2023-11-16 11:27:40.548 25170-25429 System.err com.yhdatabase.ybe W at com.reactnativeandroidwidget.builder.widget.ImageWidget.getBitmapFromURL(ImageWidget.java:44)
2023-11-16 11:27:40.548 25170-25429 System.err com.yhdatabase.ybe W at com.reactnativeandroidwidget.builder.widget.ImageWidget.applyProps(ImageWidget.java:27)
2023-11-16 11:27:40.548 25170-25429 System.err com.yhdatabase.ybe W at com.reactnativeandroidwidget.builder.widget.BaseWidget.(BaseWidget.java:36)
2023-11-16 11:27:40.548 25170-25429 System.err com.yhdatabase.ybe W at com.reactnativeandroidwidget.builder.widget.BaseWidget.(BaseWidget.java:40)
2023-11-16 11:27:40.548 25170-25429 System.err com.yhdatabase.ybe W at com.reactnativeandroidwidget.builder.widget.ImageWidget.(ImageWidget.java:17)
2023-11-16 11:27:40.548 25170-25429 System.err com.yhdatabase.ybe W at com.reactnativeandroidwidget.builder.WidgetFactory.getBaseWidget(WidgetFactory.java:104)
2023-11-16 11:27:40.548 25170-25429 System.err com.yhdatabase.ybe W at com.reactnativeandroidwidget.builder.WidgetFactory.buildWidget(WidgetFactory.java:71)
2023-11-16 11:27:40.548 25170-25429 System.err com.yhdatabase.ybe W at com.reactnativeandroidwidget.builder.WidgetFactory.buildChildren(WidgetFactory.java:125)
2023-11-16 11:27:40.548 25170-25429 System.err com.yhdatabase.ybe W at com.reactnativeandroidwidget.builder.WidgetFactory.getBaseWidget(WidgetFactory.java:108)
2023-11-16 11:27:40.548 25170-25429 System.err com.yhdatabase.ybe W at com.reactnativeandroidwidget.builder.WidgetFactory.buildWidget(WidgetFactory.java:71)
2023-11-16 11:27:40.548 25170-25429 System.err com.yhdatabase.ybe W at com.reactnativeandroidwidget.builder.WidgetFactory.buildChildren(WidgetFactory.java:125)
2023-11-16 11:27:40.548 25170-25429 System.err com.yhdatabase.ybe W at com.reactnativeandroidwidget.builder.WidgetFactory.getBaseWidget(WidgetFactory.java:108)
2023-11-16 11:27:40.548 25170-25429 System.err com.yhdatabase.ybe W at com.reactnativeandroidwidget.builder.WidgetFactory.buildWidget(WidgetFactory.java:71)
2023-11-16 11:27:40.548 25170-25429 System.err com.yhdatabase.ybe W at com.reactnativeandroidwidget.builder.WidgetFactory.buildChildren(WidgetFactory.java:125)
2023-11-16 11:27:40.548 25170-25429 System.err com.yhdatabase.ybe W at com.reactnativeandroidwidget.builder.WidgetFactory.getBaseWidget(WidgetFactory.java:108)
2023-11-16 11:27:40.548 25170-25429 System.err com.yhdatabase.ybe W at com.reactnativeandroidwidget.builder.WidgetFactory.buildWidget(WidgetFactory.java:71)
2023-11-16 11:27:40.548 25170-25429 System.err com.yhdatabase.ybe W at com.reactnativeandroidwidget.builder.WidgetFactory.buildChildren(WidgetFactory.java:125)
2023-11-16 11:27:40.548 25170-25429 System.err com.yhdatabase.ybe W at com.reactnativeandroidwidget.builder.WidgetFactory.getBaseWidget(WidgetFactory.java:114)
2023-11-16 11:27:40.548 25170-25429 System.err com.yhdatabase.ybe W at com.reactnativeandroidwidget.builder.WidgetFactory.buildWidget(WidgetFactory.java:71)
2023-11-16 11:27:40.548 25170-25429 System.err com.yhdatabase.ybe W at com.reactnativeandroidwidget.builder.WidgetFactory.buildWidgetFromRoot(WidgetFactory.java:41)
2023-11-16 11:27:40.548 25170-25429 System.err com.yhdatabase.ybe W at com.reactnativeandroidwidget.RNWidget.drawWidget(RNWidget.java:62)
2023-11-16 11:27:40.548 25170-25429 System.err com.yhdatabase.ybe W at com.reactnativeandroidwidget.AndroidWidgetModule.drawWidgetById(AndroidWidgetModule.java:41)
2023-11-16 11:27:40.548 25170-25429 System.err com.yhdatabase.ybe W at java.lang.reflect.Method.invoke(Native Method)
2023-11-16 11:27:40.548 25170-25429 System.err com.yhdatabase.ybe W at com.facebook.react.bridge.JavaMethodWrapper.invoke(JavaMethodWrapper.java:372)
2023-11-16 11:27:40.548 25170-25429 System.err com.yhdatabase.ybe W at com.facebook.react.bridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:188)
2023-11-16 11:27:40.548 25170-25429 System.err com.yhdatabase.ybe W at com.facebook.jni.NativeRunnable.run(Native Method)
2023-11-16 11:27:40.548 25170-25429 System.err com.yhdatabase.ybe W at android.os.Handler.handleCallback(Handler.java:942)
2023-11-16 11:27:40.548 25170-25429 System.err com.yhdatabase.ybe W at android.os.Handler.dispatchMessage(Handler.java:99)
2023-11-16 11:27:40.548 25170-25429 System.err com.yhdatabase.ybe W at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:27)
2023-11-16 11:27:40.548 25170-25429 System.err com.yhdatabase.ybe W at android.os.Looper.loopOnce(Looper.java:226)
2023-11-16 11:27:40.548 25170-25429 System.err com.yhdatabase.ybe W at android.os.Looper.loop(Looper.java:313)
2023-11-16 11:27:40.548 25170-25429 System.err com.yhdatabase.ybe W at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(MessageQueueThreadImpl.java:228)
2023-11-16 11:27:40.548 25170-25429 System.err com.yhdatabase.ybe W at java.lang.Thread.run(Thread.java:1012)

According to the log, there is a problem with some image, and the way it is referenced. How do you use the ImageWidget?

I manage all the image files in project/assets/.

          <ImageWidget
            image={require('../../assets/widget_alert_icon.png')}
            imageWidth={16}
            imageHeight={16}
            style={{
              marginRight: 5
            }}
          />

This looks like some kind of monorepo setup.

While you are in development mode, the images are loaded from the dev server. But when you create a production build, the image should be bundled in the apk.

I think that the problem is that React Native is not bundling the image in the production app.
Is the image inside the app directory? Can you move it inside the app directory if not? Or place it next to the widget file?

Also, from your screenshots it looks like widget_alert_icon is the red circle.
If so, you can try replacing it with:

<FlexWidget
  style={{
    backgroundColor: '#ff0000',
    height: 16,
    width: 16,
    borderRadius: 8,
    marginRight: 5
  }}
/>

I successfully created a widget by processing it with an external url without loading images from the app! Thank you for your kind response!