OpenLayers android - java

I'm currently working on a map/navigational project for Android, and I chose OpenLayers because it claimed to support mobile development and the examples worked well on my Android phone.
I made a basic map prototype with one marker, a popup from the marker, and a layer switch control. All of this works as intended on both my PC and my Android, except for one weird issue with Android. I'm the .html file and all dependencies through a WebView in my app, and there are some weird issues coming up. For one, whenever I tap something like my marker or the zoom controller, an orange box appears briefly around it, and sometimes it doesn't register the tap.
To clarify, I have touch navigation enabled on my map, and all events for the popups are on-touch and working for the most part. But the orange boxes and occasional failure to register a tap are really ruining any degree of polish that the app has. Just wondering if anyone else has encountered this at before, and possibly has a fix?

whenever i see this type of behavior, i.e. orange crisscrossed boxes in openlayers, it is many times caused by failure to locate icon graphics files. try creating a marker whose icon file does not exist where it should and see if that is the "orange box" that you describe.
if so, then you should check any broken links (mouseovers, especially).

Related

How Do I Make Android WebView Load Page Modal Elements?

I'm trying to make a really simple app for a friend to display his bar's ordering website in an app for when they reopen with the social distancing measures in place. The web app already exists, so this is really a simple matter of displaying the content in a WebView.
I've got the page loading, the content is visible, the styling is done - The only problem is that it doesn't seem to be loading all the elements. There's a line of filters at the top which just display as 3 dots (i.e. loading), and when I click any of the items on the menu, nothing happens. There should be a window pops up asking for a table number etc... If I open this in the Chrome browser on my phone, rather than a webview in the app it works perfectly so I know it isn't the website.
I've done the following;
setJavaScriptEnabled(true);
setJavaScriptCanOpenWindowsAutomatically(true);
setSupportMultipleWindows(true);
I've also turned off safe browsing in the manifest in case that was blocking anything. I have also given the app permissions to use the internet. I can't figure this one out at all and nothing online seems to be helping!
Admittedly I'm a tester (automated, but still), so coding isn't my best suit. I may be missing something really simple here. Any ideas?
Scratch that. For anyone who's interested, I needed to add this line;
setDomStorageEnabled(true);
For such a simple thing it proved impossible to find info on, I just enabled everything until something worked! So hopefully you don't have to do the same if you're looking at this.

Android 5: Icons turn black after keyboard disappears

We have an Android application which works well on Android 4.1+ till Android 7.
Only in Android 5.0 and 5.1 we experience a difficult problem (on all devices + emulators).
The icons we use in our application turn completely black after hiding the software keyboard (when you are finished typing something in a textbox).
They stay black, even after restarting the application.
But after restarting the device (or closing the application by taskmanager), the icons are back normal (till you hide the keyboard again).
I don't find anything unusual in the code or icons and since it works in Android 4,6,7 it seems related to just Android 5.
Does someone has some idea at what the cause could be?
Disabling hardware-acceleration didn't have any effect.
This problem mainly occurs if you are using some other format of images like jpeg , use only png images also you might want to have a look at this answer

Android / Java: Show GUI on "off-screen" (Always-On Display...)

I saw new Android devices coming out, that show things (clock etc.) once the display "turns off". That feature is called an Always-On Display, and since my Samsung Galaxy S6 edge already features an AMOLED screen, and a night-clock, I believe there is a way, to make it show something, when the display is "turned off". Is there a way using Java on Android, to display something, once display is meant to turn off? (Like just a normal GUI, I could do the rest then.)
Like, to tell your app, to show something, when the screen turns off, that is still visible somehow? (without root permissions)
That would be useful, thanks in advance.
UPDATE:
I found some apps on the Google Play Store, which seem do to, what I want (not that specialized though):
https://play.google.com/store/apps/details?id=com.thsoft.glance&hl=de
https://play.google.com/store/apps/details?id=com.orthur.always_on_display&hl=de
So it is definetely possible, I just need to know, how.
If you are not using root, then you can only use the Android APIs. Here is a list for example for the display: http://developer.android.com/reference/android/view/Display.html
I don't see anything there for the Ambient Display mode or Always-On.
Samsung provides APIs also for the features of it's phones here: http://developer.samsung.com/galaxy Here I can find the Look API that has something close to what you want, but for Edge.

How to get the name of the app by position?

I am just creating a quick application in which there would be a floating icon on the home and the user have to just drag and drop that icon to the app and then it will show a alert window.
I know how to create the floating icon using some maths and windowmanager but don't know how should i get the name of the app on which the floating icon is dropped. I have thought of some ways to archive this, but don't know how to implement it....
By Getting the position of the touch when ACTION_UP Trigger is occurred and then checking what's the app is by comparing it with its position.
But there is a problem in this way, because i don't know how to get the position of launching icons on the homepage.
Help me to archive this task. Please tell me How can i get the position of launching icon(like facebook, google play) on the homepage . Also it would be very helpful if you can suggest me other ways of doing this.
I know this can be done because winners of techcrunch hackathon have
made the same application. A short video of this can be found here, in
case you might want to look,
http://techcrunch.com/2015/09/20/disrupt-sf-2015-hackathon-winners/
i don't know how to get the position of launching icons on the homepage.
That is not possible in general, outside of perhaps the accessibility APIs.
Please bear in mind that there are > 1 billion Android devices in use. Those span thousands of device models, representing hundreds or thousands of home screen implementations. Users can also install third-party home screen implementations (e.g., from the Play Store) and use those.
There is no requirement that a home screen have "launching icons" that meet your expectations. I could write a home screen whose app launcher consisted of text hyperlinks, for example. Or, I could write a home screen that is designed to be used by an external keyboard, where launching apps is triggered by keypresses rather than icons.
There is no requirement that a home screen have some sort of API that, given some X/Y coordinate on some arbitrary piece of that home screen, would tell you an app that is represented by something visual at that X/Y coordinate.
You are welcome to try using the accessibility APIs to find details of a widget at the desired X/Y coordinate on the current screen. However, from there, you would have to make guesses as to whether or not that is a launcher icon and, if so, what app it would represent. This approach is likely to be unreliable, except for specific scenarios that you have hard-coded. Hard-coding is what the team you cited appears to have done, based on the prose on the TechCrunch site.

how does android understand which home screen is being viewed by the user?

I wanted to understand how does the Android OS figure out which home screen the user is viewing currently and render the appropriate icons and widgets on that screen based on the user's left or right swipe on the touch screen of the device.
The OS must save a state of the screen and IDs or something relative to the objects placed on the screen to retrieve the state each time the screen becomes visible.
From my research I understand that Android OS treats all the 7-8 homescreens on devices as one single host.
Also my question might seem vague, but the reason why I am asking is because it seems reasonable that app widgets on android devices, update not only when the phone is awake but also only when the app widget itself is visible. I know that Google has declined the enhancement request by many others but I don't think that is good enough. Link here.
That is the reason why I am trying to give it a shot to understand and implement it for my app with whatever Android knows about the state of the home screens.
Any help or insight is much appreciated. Also the experts out there let me know if you think this can be even implemented for one off apps at all?
Well, as the link you posted clearly states, there's no way to know.
Also, if you consider the fact that "Home" is just an application like all the others, it makes even less sense to have a unified API for that. A lot of people use Launcher Pro or similar applications, which would probably not implement it.

Categories