I am building an app which runs in the background and I want to display a short text but only when for example the user is checking images on Instagram. So I need to check if Instagram is in use and then put the message in some kind of if statement.
How do I check if a specific app is currently used in the foreground? I searched around but can only find old posts with codes that are not supported anymore.
I am new to building apps so can someone please explain me how to accomplish this?
Related
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.
This would be my first post ever on stackoverflow.com
I have found many many of the answers to my questions but this one question i cannot figure out.
I know that it is possible to invoke few android commands via either java code or other html code and was wondering if it is possible for a my website to set an image on my site as their wallpaper on their android phone.
To better explain this is what im doing.
My website will have say for example 50 images of something and when the user clicks on one of those photos the website will ( if possible ) invoke the android " set as background " Process.
Currently it is set to just download to their phone and then the user goes and selects the photo as their wallpaper from their download folder on their phone.
Thank You in advance
Vick S.
Interesting question. In Android, java runtime environment is what being run inside OS, and in order to execute commands you wish to make, rooting to OS is only way, and this can be done in java. So, if I were in your shoes, I'd drop the idea of rooting command line to android via HTML - but look over onto java side.
In other words...yes, it is possible. But, end-users will already have their phone/mobile pre-set to guard against that rooting commands, but to ask for permission from owner. If owner clicked yes, then you are in game. The hardest part about this is the complexity requiring bunches of efforts to code such rooting functions.
But, this could something as a starting point, at least? Running Shell commands though java code on Android?
Good luck!
I am a total noob on this site so please be patient. I am trying to initiate a Video Chat/Call without any user interaction or confirmation.
I found this:
Uri imUri = new Uri.Builder().scheme("xmpp").authority("gtalk").query("call;type=video").appendPath(email).build();
Intent IM = new Intent(Intent.ACTION_SENDTO);
IM.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
IM.setData(imUri);
startActivity(IM);
from here: https://stackoverflow.com/a/8024626/1184256
This gets me very close, but I then have to click an "Invite" button to continue. Is there a way I can emulate a KeyEvent to click this button or skip the popup window entirely with root access?
I don't even necessarily need to use Google Video Chat if someone has found a different way to initiate a Video call to a certain contact via Skype, Vtok,Fringe, ooVoo or whatever without user interaction.
I have also found OpenTok which after building a sample server and client on my site I have found that it works on desktop browsers but not in Android browsers. Please don't steal/use my apiKey or sessionId.
I have also found libjingle which will allow me to use Google Talk's peer-to-peer voice and video chat. I am thinking this will be the way to go, but it means building a video chat app from the ground up and wrapping it around these libraries... yeah. Anybody done this already?
I know this is essentially a duplicate thread, but I have searched for days and days for an answer and this is the closest I have come to getting this done.
BTW the reason I need this without user interaction is for a Telepresence robot, thus there won't be anybody actually holding/using the phone when I initiate this call.
Please HELP!
You'd have to actually change the built in android app (Talk?) that receives this intent to automatically accept these types of intents. There's no way to do it from a standalone app for security reasons.
I don't think that live video streaming will work natively in Android Browsers, since they dont support WebRTC (Yet) and do not support flash. With that said, OpenTok has an Android SDK in beta that lets you stream live video from android phone to browser, another android phone, or even an iOS phone as long as everyone is connected to the same session. Like you said, this does not work over the browser and you would have to build a native app.
So I'm building an android application, I want the users to be able to press a button that opens a window/activity. I need the activity to allow the user to browse the pictures saved on the phone and be able to select those that they want. Once they select the pictures and press "ok" the pictures need to be copied to a directory for my application to access them from. So basically does anyone know of any code or help to do this and where would i be able to save user data for my app specifically on the android device. Thanks and let me know if you need any clarification!
It looks like you are expecting someone to complete your task. Instead of giving solution I would like to suggest you a way to do this, there on you can go and search and find a solution which will make you learn lot of things. Here are some articles where you can have some reading to start with.
Searching files on the android system.
Create a view where he can invoke search and select files
Storing files on internal storage
Now you need to do some homework and start hitting the keyboard, I'm sure you can do this easily
I have been looking at the android source and developing some apps. However for my next app, I need information about the cell phone. Similar to what you see when you go into "Field Test" mode. However I have not been successful to get RadioInfo.java to work. Is there a way to hack RadioInfo.java so that I can use it in my app OR is there a way to get the data that is displayed in "Field Test" Mode. I have looked at the telephony api include the telephony.internal but so far they do not provide as much grained information as I would want.
I have been asking around on the net but so far I can't find this information.
You will not get very far I am afraid as the underlying file is attempting to interact with the baseband chip through an internal api that you will not get access to for an application.