I'm curious about this. I have an app called GoSMS PRO and an app called Contacts+ installed in my phone. They both popup an alert notification when a text message is received. However, GOSMS PRO always beats Contacts+'s popup. I was wondering how this was happening in a programming perspective? Is there a way to give a certain app more preference than the other.
From security and permission side every app from Google Play has similar privilege, if they are not signed by the certificate of device manufacturer. This also means that none of the app will get extra preference.
Some time app do many type of checking/initialization/loading before showing their UI and when this type of things happens apps take longer period to load or display UI.
Most common things people do
Creating and initializing database
Reading database.
User validation (reading file)
Device state scanning(network)
Most common case is database access. I wonder if the app reading Content Provider before showing UI it might take long time depending on your device hardware and number of contacts.
Key strategy would be showing the UI right way and load data in background. Android has lots of Asynchronous api, just to avoid this type of scenario.
Related
I made a small Google Home App and my service returns a response with a SimpleMessage + Card.
It works perfectly when running the app in the console.actions.google.com simulator. I get the card all good.
But when I test talking to the Google Home, it only sends the text, no trace of the Cards anywhere.
However If i talk to the Google home app on my phone, it does send the card correctly.
Is there something to enable to be able to receive cards sent by Google Home? Is it possible at all?
There is no way to make cards that were sent while the user is talking via Google Home visible, but there are several techniques that you, as a developer, can use if cards are necessary.
First of all - good design suggests that cards should be use to supplement the conversation, not be the focus of the conversation. Make sure the voice conversation itself is important and use the visual elements only when necessary. If your action is overly visual - it may be better suited as a mobile or web app, rather than an Action.
If your device requires a screen, then you can set this in the Action Console when you configure your question. This will, however, prevent it from being used on a Google Home device.
If you don't want to go this route, and want to allow it to be used on a smart speaker, but still take advantage of a screen where it is available, you have a few options.
First is that you can just send the cards. As you've discovered, they won't show up, but they won't cause any problems.
If you want to act slightly differently if a screen is available, you can check for the surface capabilities that the user's Assistant is capable of at that moment. If you're using the node.js library, you can have a command such as
let hasScreen = app.hasSurfaceCapability(app.SurfaceCapabilities.SCREEN_OUTPUT)
to determine if a screen is available and take action based on the variable hasScreen. If you're using JSON, you need to check the array at surface.capabilities or data.google.surface.capabilities to see if "actions.capability.SCREEN_OUTPUT" is one of the available surfaces.
If not, and you get to a point in the conversation where you feel you need to send a visual result, you can also request to continue the conversation on a device that does support screen output.
First, you'll need to make sure that they have a screen available. You'll do this with the node.js library with something like
const screenAvailable = app.hasAvailableSurfaceCapabilities(app.SurfaceCapabilities.SCREEN_OUTPUT);
or by checking the availableSurfaces.capabilities or data.google.availableSurfaces.capabilities parameters in JSON.
If one is available, you can request to continue the conversation there with something like
app.askForNewSurface(context, notif, [app.SurfaceCapabilities.SCREEN_OUTPUT]);
where context is the message that will be said on the Google Home, and notif is the notification that will appear on their mobile device (for example) to let them continue the conversation. If using JSON, you'll need to use a actions.intent.NEW_SURFACE next intent.
Either way, the user will get a notification on their mobile device. Selecting the notification will start up the Assistant on that device and your Action will be called again with parameters that let you check if they are on the new surface. If so - you can send the card.
I've seen some "app locking" solutions in the Google Play store and I was wondering how those apps work. I'd like to build something similar.
I realize that this might require some special permission or maybe request the app to be added as device administrator.
Is there some broadcast that is triggered just before an app is launched that I can intercept and do some action (e.g. launch an activity that will request the user to fill a password)? I've read some lengthy discussions how this is not a good idea and the only idea is to have a background service that will continuously poll the running processes and check for changes, but I think retrieving this list every second and checking it for chances is not good for the battery and I think other app locking apps out there must be using a different approch.
If possible, without the need for a rooted phone.
I would like to secure settings tab on lenovo tablet device with a password. What is a simple way of going about this? Code is welcome too (I think I might need to code but if you think an google play marketplace app would solve my problem please post your suggestion below).
Edit: I have researched and posted on lenovo forums already which I always do before posting here and it takes them a week just for simple question sometimes to respond.
Please if iam too vague say so below because -2 does not help me one bit.
Here's more more information for why iam trying to do this:
I work at a K-12 system with high students always testing my wits.
Without the password kids/students can add their own account or change settings for the tablet doing things that could hurt the school system legally (download playboy, using the devices to distribute viruses and malware, and the list goes on
Unfortunately for the purposes of what you're doing, Android doesn't really allow for keeping the "primary user", so to speak, out of the settings application. I'm not personally aware of any existing "lock" type applications, but they might exist; you might be better off asking on Android Enthusiasts for that.
There are a few hack-y type things you can do programmatically, however, without modifying the OS. The one I've seen work the most effectively for similar tasks is to code a Service with a Thread more or less continuously polling the ActivityManager for a list of running tasks (getRunningTasks()), checking on fixed intervals (perhaps once a second?) then, if the unwanted Activity is detected in the foreground (I believe that the Settings app component name is android.app.Settings), Launch a Password Activity. If the user successfully authenticates, simply finish() the password Activity. Otherwise, start the home activity (effectively clearing the Activity stack) with an android.action.HOME intent
I am starting an application for child monitoring. This would involve mainly the logging of the SMS messages sent and received and logging other activities that may be of interest to the parents. It will also be nice to have something like access control lists for these, too.
Now, as far as I know:
It is not possible to make an app "not uninstallable".
It is not possible to prompt for a password to uninstall an app.
It is not possible to assure that your app is "always" running even if it's getting killed with something like Task Killer, although I think you can respawn the application at given time intervals.
So, any ideas on how to overcome these problems?
There is no way to work around these problems directly without creating your own build of the Android OS. Android always assumes the current user is the owner of the phone and should always be allowed to do whatever they need to do.
It's easy to see why the functionality you need isn't available if you replace "child monitoring" with "malicious data logging" in your question; if Android allowed an app to prevent the user from removing it, it would clearly be open to abuse.
The only thing I can think to do is to have your keep a log of when it is running. This would allow a parent to seen when the app had been running when they viewed the log of the collected data. So if the child had disabled the app the parent would know, but they wouldn't know what had been missed. Although you'd had to be able differentiate between when the phone was switched off and when the app just wasn't running which might not be straightforward.
What you said is true.
Also remember that applications like Task Killer have some sort of blacklist/ignore list so re spawning your app might not make it work.
PS: Without a rooted phone, there is no way you can save your app from a geek kid :)
I was thinking about writing a similar app and considered the same exact scenario. "What if the kid uninstalls the app?"
The only solution I was able to come up with was to have the app periodically ping a server with the a unique ID. Affectively having the app "Check in" with the server a few times a day. Kind of like when prisoner goes on parole. The app is the prisoner and the server is the Parole officer :)
If the app misses a checkin you could treat this as a potential uninstall. However, this could be caused by a lack of network connectivity. I'm sure you could come up with some interesting ways to flag and treat missed checkins. Maybe you could have the app send an SMS checkin or something instead of over HTTP. Then you wouldn't have to depend on Network connectivity.
Once you figure out how to translate missed checkins to an uninstall, you could shoot out an email to the interested party (i.e. the kids parent).
With this option in place, the parent can then have a "Conversation" with their kid before giving them the phone. Something along the lines of:
- "This phone's got parental controls on it. Yes, you do have the ability to uninstall them. However, if you uninstall them I'll know about it and I'll take the phone away."
I think there's definitely a market for this. Need some type of web-interface/dashboard for that parents can log into for monitoring too.
Hope this helps & best of luck.
Cheers!
Does anyone know if there's a way to either keep the user from uninstalling an app from an Android phone or reinstall it on removal? Before you flame me, please know that I have an app that's intended to be installed on the phone by a parent/employer/etc. and has a password-protected settings screen; the user would need to enter the password to remove the app.
What if you have it send an email alert to a registered email address on uninstall?
On the topic of email notification when your service is uninstalled--
A lot of security software runs multiple processes which monitor each other, so that it's more difficult to shut the system down. You could do something similar with two services installed, each monitoring to see if the other is installed. If something goes wrong, they can send off the e-mail.
Not without modifying the kernel, or reducing the user priviledges on the device. Think of it as a Linux computer, where the cell phone user has root.
Can you prevent them from removing your app? No.
But you can make it painful and difficult enough that it's not worth it, and include alerts that indicate it has been removed.
First, I would modify the software so it requests and successfully answers a cryptographic challenge/response periodically from a remote server - daily should be enough, and wouldn't impact battery use. This way your server knows when it has been disabled (could be sold as an additional $10/yr service charge) and you can alert the purchaser.
Second, I would tie the software into the system at the driver level so that removal also removes text services. There are drivers or services that the texting application uses that could be replaced with your custom versions, and on removal would render the texting app useless. Chances are good that you already tie into the system in a similar way to block the texting app (and other apps) while traveling too fast.
Third, I would consider installing a monitoring program that runs as a separate process (check out how the latest viruses operate for clues). It would check to make sure that not only is the app still running, but it's running the latest version, and there isn't a GPS simulator or other program that prevents your app from getting correct GPS data.
I'm curious how you differentiate between the driver texting and a friend in the passenger seat texting on the driver's cell, though.
-Adam
Well, solution would be to mount /system/apps/ to be writable and put your app there once.
When you restart the phone it would automaticly install it and prevent a user from uninstalling (as every app in that folder, list it to see it). That's how mobile providers force user to have they app.
However, user could always delete this app by rooting + mounting /system/app/ to writable and then to delete. But "normal parents" can't do that :)
Regards
P.S. This question is two years old, I've notice it just now... :S
I'd highly doubt that's possible. The permission structure of Android is going to give the user full control over what's happening on their phone (to some degree) and not being able to uninstall an app would be a pretty large security risk.
If you modified the Android core, it would probably be possible, but if you're trying to force something onto an end-user, that's a bad idea.
Maybe there's a better approach to what you're doing? If there's some required functionality in the app to keep the user from uninstalling it, that would be a small incentive to keep the app, but there's no way to keep a user from removing something they really don't want. You could have the app report uptime to a seperate server so you could be notified if the app was removed, but I think that's as far as you're going to get.