Android Question Emulator versus actual Android device issues

Bryan

Member
Licensed User
Longtime User
I am having two issues or problems relating to running my app on Bluestacks Android emulator and my actual hardware device Samsung Note 8. In both cases my app works as it should on the Bluestacks emulator but has problems on my Note 8. My emulator runs Android 4.0.4 and is modeled after a Samsung GT-N7000. My Note 8 is running 4.1.2 rooted.

The first issue relates to calling CancelScheduledService from my Main App. I have a Widget that uses
StartServiceAt("", DateTime.now + 60 * 1000, True) which is put under Sub Service_Start. I have two buttons for my widget. With a button click event from my widget I call StartService("").
With another button click event from my widget I call CancelScheduledService(""). From my main app I needed the ability to also cancel a scheduled service. So, I have CancelScheduledService("MyWidget_Service") called with a button click event sub.
With the Bluestacks emulator the widget's scheduled service gets properly canceled by calling CancelScheduledService("MyWidget_Service") from my main app as well as my widget's button click event that also calls CancelScheduledService("").
With my Samsung note 8 the service does not get canceled when calling CancelScheduledService("MyWidget_Service") from my main app. It keeps running. If I add StopService(MyWidget_Service") right after CancelScheduledService("MyWidget_Service") in my main app then I can get the Scheduled service to finally terminate. I don't think I should have to do that. I can't figure out what is causing this issue.

The second issue I have discussed with Erel somewhat. I was suppose to send him an example that shows this problem. I did not yet because I discovered that this issue or problem only shows up on my Note 8 and not when my app is running on the Bluestacks emulator.
I have a label placed over the top of an Imageview object for my home screen widget made in designer. The Imageview has a graphic image loaded in designer. The label that is placed over the Imageview has a transparent background so as to show the imageview graphic. Text is put into the label from the widget's code. The text is black in color.
Now if my widget is displayed on my home screen and I happen to open an app which covers over my widget and then close the app the text in my widget's label disappears. This happens only on my Note 8 and not in the emulator.
During screen rotation on my note 8 this will also happen but I detect the rotation (Landscape or Portrait) and call rv.updatewidget which corrects the issue and displays the text on the label again. This uses a 500 millisecond timer to do this. Checking every 500 millisecond for a screen rotation. I can't really rotate the screen on an emulator like on an actual device so I don't know if the emulator would have the same problem.
So, these two problem seem have something to do with my Note 8 I don't know why. You would think I have more problems using an emulator. My manifest is below if that helps at all. I have all APIs downloaded with Android SDK manager 14 to 19.

B4X:
AddManifestText(
<uses-sdk android:minSdkVersion="14" android:targetSdkVersion="19"/>
<supports-screens android:largeScreens="true"
    android:normalScreens="true"
    android:smallScreens="true"
    android:anyDensity="true"/>)
SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")
SetApplicationAttribute(android:theme, "@android:style/Theme.Holo.Light")
SetApplicationAttribute(android:theme, "@style/Theme.Tclstyle1")
SetApplicationAttribute(android:uiOptions, "splitActionBarWhenNarrow")
SetActivityAttribute(main, android:windowSoftInputMode, adjustPan|stateHidden)
 

Bryan

Member
Licensed User
Longtime User
That's exactly the way I understand it. I don't want to stop the service just cancel the scheduled service that runs once every minute. I can cancel the scheduled service in the bluestacks emulator without a problem from my main activity by calling CancelScheduledService("MyWidget_Service"). It does not work on my actual device (Samsung Note 8). I haven't figured out why yet.
My widget consist on 1 image view which has a graphic image loaded by designer. This imageview has 2 imageview buttons, and a 1 label (transparent) placed on top of it. The widget has 2 other imageviews used as buttons and another label.
Something I maybe don't understand that I am seeing in my log is that everytime I press any of the widget buttons I am seeing
** Service (MyWidget_Service) Start **. Should this be happening? I don't know if this I a problem or not. Why would the widget keep getting a Service start on button presses. Once the widget service starts shouldn't it stay running. I know the android OS can kill services over time needed.

Anyways, The other problem with disappearing label text on my note 8 I haven't been able to figure out what is causing it yet. Again this does not happen on the bluestack emulator. I way wondering if it is some setting I had made on my note 8 that could be the cause of it. I changed several display settings but have not cured the problem.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…