Instant app won't start directly, shows a screen first - android

I have successfully published a (very simple) Instant App linked to my personal website.
When I click on my website's link, I was expecting the app to start directly, but instead, I first see a screen with 2 buttons: "Open app" and "Open in browser":
Why?
Other instant apps that I tried do not show this screen and open the app directly (the desired behavior).

We call this screen the "speed bump". It's a security feature. You're right in noticing that it doesn't always trigger. But there's nothing you, as a developer, can do to control whether it shows. The intention is for it to be a black box from your perspective.

This is designed in my opinion to happen at least once to give the user an opportunity to decide what to use: either browser or the instant apps feature.

Related

Can an app include a page where a user can control the apps' permissions?

I am writing a cross-platform app in Xamarin. The app requires certain permissions or it is pretty well useless.
We want to make it as easy as possible for the user to manage the apps permissions.
In iOS the permissions can be accessed on a per app basis (General then scroll to the list of apps at the bottom of the screen, tap and control all the permissions for that app) or a user can grant/revoke access to one particular permission. For example, the user can go to "Cellular Data" and control which apps can use cellular data and which cannot.
That was always a bit unclear to me, so it makes more sense now.
Ideally I would like to put the screen below into the Settings of my app. So there would be a little gear icon for Settings and one option in Settings is "Permissions" and tapping that would show the screen below (in essence). That would be easier to the user I believe.
OK, if we cannot do that can we still have the permissions entry and it would take the user right to the screen below?
Thank you very much,
Bryan
You can try navigating to the settings app in iOS using this :
UIApplication.SharedApplication.OpenUrl(new NSUrl(UIApplication.OpenSettingsUrlString));

Ionic / Cordova trigger app action when app isn't in foreground

Original Question (Listen to hardware buttons press)
I am wondering if it is possible to listen to the hardware buttons of a phone using Ionic / Cordova.
The important thing is that this should also work when the user is not currently using the app like somehow through a background service?
Basically I want to take a screenshot when the user presses the volume down and the power button at the same time in a hybrid app using Ionic. The app then offers to edit that screenshot or save it directly.
I have done some research and found the cordova events to listen to those buttons. I also read that the pause event should be fired when the power button is pressed. Anyhow, I don't think listening to those events would work outside of that app?
Original Question Conclusion
After some more research I conclude that this is not really possible using Cordova / Ionic. Even the native implementations of this problem seem to be more of a hack than a clean solution. The reason for this is, that the app currently on top should have the control of handling the various button events. You could interfere with another app and you always need to run a background service. Anyhow, all the solutions I saw seem too dirty for me.
Updated Question / Reevaluation of the problem
Basically I want to take a screenshot when the user presses the volume down and the power button at the same time in a hybrid app
using Ionic.
If I can't solve the current problem I have to rethink it. So:
Actually, I just want the user to have the ability to take a screenshot in a way that offers a good usability experience.
There are various ways I can do that as an alternative to pressing two hardware buttons simultaneously.
Option 1: User presses a button "Take screenshot" -> the app goes in the background, a screenshot is taken from the underlying app, the app comes back to the foreground.
AFAIK this wouldn't even work in iOS, only Android offers a "draw on top of other applications", so in iOS the screenshot would simply be taken from the home screen in all cases...?
Option 2: User presses a button "Take screenshot" -> the app goes in the background and a notification is pushed.
This notification could say "Tap to take a screenshot". The notification panel (which is always drawn on top of other applications) disappears, the screenshot is taken and the app pops up. This could be done using Local Notifications and listening to the on clear, cancel etc. events.
The notification could even have custom buttons using OneSignal (see Action Buttons). One button could say "Add screenshot", another one could say "Done", so the user could even take multiple screenshots at once.
Option 3: A button could be added to the shortcuts that triggers the take a screenshot action. I don't know if that is even possible and if that works on all devices.
I would say the best solution would be to go with Option 2: Custom Action Buttons on a Notification. Notifications should be a must have on all devices and should always be drawn on top of the current app. So the user just swipes down the notifications and presses a button to take a screenshot.
I don't really have any prior knowledge to this topic so I would be glad if somebody could confirm or improve my thinking process.
Edit:
I have done a bit of research into this, mainly just to satisfy my own curiosity. I came across this plugin
https://github.com/katzer/cordova-plugin-background-mode/blob/master/README.md
It allows you to carry out task in the background.
Please note this from the readme file.
Store Compliance
Infinite background tasks are not official supported on most mobile operation systems and thus not compliant with public store vendors. A successful submssion isn't garanteed.
Use the plugin by your own risk!
This probably isn't a big deal on Android but there is an open issue with regards to Apple app store submissions being rejected. Read through the issue to see how others over one this.
https://github.com/katzer/cordova-plugin-background-mode/issues/122
Original Answer:
If you want to take a screenshot there is this plugin:
https://github.com/gitawego/cordova-screenshot/blob/master/README.md
Maybe you could listen for some other events whilst using the pause listener. If they are activated then using the screenshot plugin referenced above call:
navigator.screenshot.save(function(error,res){
if(error){
console.error(error);
}else{
console.log('ok',res.filePath);
}
});

Installing a widget from an APP

I know i'm going to die as maybe i didn't place this post correctly, also i'm not a developer, only a graphic designer.
I'm looking for some advise, hope someone could help me with that.
Imagine that you launch your app, and within that there is a button that says "Install widget". You press that button, then the app closes and a widget appears on the home screen.
Is that possible?
i've been reading that before 4.2 i wasn't, but something changed from then. Problem is that i have no more information about this, and also i don't know if it changed over time.
I'm behind the graphic design of a widget. The idea is that you first download the app, which will help you to configure the widget, and then you have to manually place the widget in place.
They are afraid that some people wont understand, and they will cease trying.
I only would like to know if this is possible, (or something similar) and if someone knows any APP that does this thingie.
Note: APPS like "Swiftkey" guides you in the process of installing your keyboard. it asks you to go to a determinate place of the phone settings, and gives you a shortcut to that place so you don't have to go by yourself.
It would be amazing. To directly place a widget o to guide them trhough shortcuts.
Many many thanks in advance!
Is that possible?
No. The user installs the app widget through the home screen.
The idea is that you first download the app, which will help you to configure the widget, and then you have to manually place the widget in place.
That is also not possible. The flow is that the user chooses the app widget in the home screen, places the widget in place, then if you have a configuration activity defined, you will get a chance to help the user configure the app widget (e.g., to choose the city for the weather report that the app widget should display).
APPS like "Swiftkey" guides you in the process of installing your keyboard. it asks you to go to a determinate place of the phone settings, and gives you a shortcut to that place so you don't have to go by yourself.
Input method editors (a.k.a., soft keyboards) are configured through the Settings app, and therefore there is a consistent place to direct users towards. App widgets are configured through the home screen, and different home screens can implement that process in different ways, so there is no standard spot to direct the users towards.

Can an Android app interact with another app?

I want to be able to tap the statusbar and the contents in the displayed app to be scrolled up to the top.
Is it technically possible that an app intercept my tap and send the appropriate command to the active app? I have noticed for example that AntTek quick settings shows a drop-down window when swiping down from statusbar. While using the app I did also notice that even by just tapping the statusbar (before beginning to move the finger down), the app seems to already interact with the touch as it dims the screen brightness in preparation to display it's "window" (sorry I use the MS Windows term), so clearly a statusbar tap CAN be sensed by an app.
Starting from this, I wonder if such an app could then send a message to the active program telling it to scroll up.
Is that possible? And if yes, the message must be customized to a particular app (let's say the browser as the most important) or is it standardized so the apps speak the same language between themselves?
I am not a programmer so answers with codesamples might be less helpful than a plain english explanation. Finding out that is possible would lead rather to pursuing a programmer to implement the idea rather than starting to develop it myself.
Thanks :-)
There is an XPosed-module which seems to do exactly what you want.
To use XPosed-modules, you'll need to root your phone and install the XPosed-framework.
The XPosed-module is called "Statusbar Scroll to Top" and its repository can be found here:
http://repo.xposed.info/module/com.mohammadag.statusbarscrolltotop
This will work for almost all app-lists, but for example won't work for browser-content.
If you want to scroll to the top of the page in a browser, then you'll probably do best to get a browser which can do that on its own. (For example Habit Browser has it built-in and respective plugins are available for Firefox.)
Yes it is possible. HiroMacro and Frep can do this, but it requires root. https://play.google.com/store/apps/details?id=com.prohiro.macro&hl=en
(how do they simulate mouse and keyboard interactions on other applications? i have no clue :/ anyone?)
Is it technically possible that an app intercept my tap and send the appropriate command to the active app?
No. One app cannot send fake input to another app, for security reasons.
An android app comprises of several activities. Each activity display a GUI that allows the user to perform a specific task. To take the user from one activity to another, app must use an Intent to define our app’s intent to do something.
An intent can be explicit in order to start a specific component (a specific Activity instance) or implicit in order to start any component that can handle the intended action.
Interacting one app to other app in android
google docs link

modify a an existing Android ROM to control user actions

I am creating an Android application for a customer which will be pre-installed and distributed together with the handsets. Now the customer asked me to lock down the ROM to prevent the future users from using anything else apart from this one app. I.e. no browsing, no email, nothing which could create any costs etc.
Now after some googling it seems to be relatively straightforward to remove applications from an Android image. But even if I can remove the web browser, email client, the Android Market App etc, how can I make sure that the user will not reinstall those apps via the USB connector? As Android is just Linux I am sure there are ways of denying all users the right to install new applications (or actually denying them pretty much anything apart from using this one app).
If somebody could point me in the right direction it would be much appreciated.
EDIT:
To clarify things a bit, the customer does not want to use the android devices as phones, even though they are phones. With 100€ touch screen phones becoming available, it becomes viable to use those phones for just one specific purpose. In my customers case, the device will be used as something like a POS system: the employee uses the phone to process a certain kind of customer request, and for this the app needs to have a data connection which will accrue costs of course. Now obviously contracts can be set up that will oblige employees to pay any irregular costs themselves, but why make it that complicated?
This is not about taking freedom away from users but rather about using android phones as general purpose touch screen devices with a data connection that employees can use in a business environment without shooting themselves in the foot with unexpected high data connection cost.
There's not really a whole lot you need to do to make a single-purpose device. If you play your cards right, it should be something you can do without having to tinker with the ROM.
The quick-and-easy route would be to deploy your application as a replacement for the stock launcher, just like any of the other home replacements that are available. Setting that as the default would cover most of the opportunities for casual tampering, since it would leave no other way to launch or install anything else. The only other things I can think of off the top of my head that you'd need to do are snag the search button so it doesn't bring up the default Android search box atop your app and the green key so the phone app won't come up.
You would, of course, need a way to get to the original launcher to maintain the device and install new versions of your app. I'd accomplish that using a "Maintenance" menu item somewhere that asks for some form of authentication (e.g., a password), changes the home app back to the original and launches it. When you're done doing what you need to do, set your app as the default launcher and you're back in business.
Edit to address MAINERROR (now Octavian Damiean)'s comment:
Any activity in any application can register itself as a home application by adding an intent filter on the android.intent.category.HOME category. It's literally four lines in the manifest, and you don't have to write any code to support it. Take a look at lines 77-82 in the stock launcher's manifest for an example of how this is done. (Ignore the filters on DEFAULT and MONKEY; they're not necessary.) Once the activity is selected as the default handler for the category, it becomes the first thing launched at boot and what comes up when the Home key is pressed. HTC Sense, aHome, Panda Home, etc. all use this mechanism.
Launching the stock home (or any other application) explicitly is about five lines of code.
Side note: There's a application on the Market called Home Switcher that lets you launch any of the activities filtering on the HOME category or set one as the default.
Unless the handset manufacturer adds a lot of shovelware, the stuff that runs in the background should be inconsequential and won't get in the way.
There was a similar question already somewhere. You can indeed limit the functionality of your device by the amount you want or have to. In order to achieve this you will definitely have to build your own modified ROM.
You will have to touch the ROM because you will have to get rid of several applications running in the background. One you won't need them anyway and two as you don't need them they would only consume resources.
You might want to take a look at http://source.android.com there you will find more information about the sources which will hopefully direct you where you need.
Blrfl's answer is great, but it still has a problem: if the user long presses the HOME button, the recent applications popup will appear an the user will be able to launch another app.

Categories

Resources