I am developing an app with launcher features (which is also Device Admin). In my app there is a button which when pressed opens the Google Play listing for my app so that users can update to the latest version. I am using the below code to achieve this :
try {
final String appPackageName = getPackageName();
try {
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + appPackageName)));
} catch (android.content.ActivityNotFoundException anfe) {
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://play.google.com/store/apps/details?id=" + appPackageName)));
}
}catch (Exception e){
e.printStackTrace();
}
Everything works fine, no problem here. Upon excecution of above code, the user is presented with this (pardon the Greek):
Due to the fact that my app should function as a launcher (in the sense that it shouldn't allow other apps to launch, and especially other launcher apps) the back button and search field pose a risk for me. In theory the user could navigate or search and download some other app other than my own as presented bellow:
So, my question is, is there a way to launch the Google Play listing of my app without the back button and search bar/icon? A page where the user can perform actions regarding my app and nothing more. No way to install other apps.
If someone comes up with an alternate approach which produces the same results, then by all means share your wisdom! But a Google Play listing of my app without the navigation/search bar on top would be the Holy Grail for me at this point! :D
Any help would be appreciated! Thank you in advance.
Some answers to anticipated questions. (Users that feel they have already read enough need not go past this point):
The app is targeted torwards a very specific demographic. It is a tool for bus drivers to print tickets using a thermal printer over Bluetooth and perform various work related tasks. The devices are not the drivers' personal devices but devices provided by their agency as work tools. The launcher features try to address an issue where drivers would consume their monthly mobile data using apps like Youtube e.t.c.
I have a Whitelist of apps that the user can freely launch. There is a service that checks which is the current app on the foreground and if it does not belong to the Whitelist, it immediately redirects the user back to my app (as there is no legit way to kill those apps on a non-rooted device). The problem with this approach is that if the app that was launced is a launcher app (let's say Nova Launcher) , then in the milliseconds that this launcher app was in the foreground before the service redirected the user back to my app, the launcher app had already presented the user with a dialog to pick the prefered launcher app for the device like the one below, thus disabling my app and gaining free access accross the device :
You can use in-app-updates to give updates to your app(but this supports API 21 and above)
Supporting API level 21 and above, the Play Core library now allows us to offer in-app updates to our users — meaning we can show that an app update is available whilst the user is within the context of our application
If your app satisfies the API level(ie minimum SDK is 21) follow this guideline to use in-app-updates
Related
I am developing an android application and i need clear the data of another application upon clicking an button.
i.e.: if i click button name "gmail" in my app,the data should be cleared of that "gmail" app
doubt:
1.Is it possible?
2.Do we need to be rooted our android device in order to do this?
° because greenify works with root access to force stop the other app flexibly.
I know that greenify works without root but pop that "force stop" ui screen of each single app to do that action.
MY APP FUNCTIONALITY:
I just wanted to develop an android apllication named "anti-theft cloud apps"
simply if an thief stols our mobile then my app detects when he changes the sim or an unique code send by mobile owner through sms from other mobile and logouts all the cloud based applications like gmail,google photos etc to protect our data to be stolen ,so in order to do that i thought of clearing other apps data(like gmail) PROGTAMITICALLY to logout. Is it possible
This is not possible with stock Android. You can do it with superuser, access root/data/data/PACKAGE and clear its content. But as seen in comment, this seems like evil thing.
I have a Bluetooth device that I can connect to an android phone, and I need to launch a specific application when a certain button is pressed on the Bluetooth Device.
So on press A--> Application A needs to be opened.
As of now, I am attempting to build an android application which can scan for and connect to the bluetooth device, with a set of built-in keymaps (A->Application A, etc), and the application would open up the application corresponding to the keymap, but this approach has its limitations in that I was not able to successively select buttons to transfer between apps.
Would there be a way to directly interact with the android kernal from BlueTooth to try to directly open up desired applications?
There should be a number of ways to get what you want, depending on your circumstances. We can provide more help for specifics if you post some of the code you're currently using to start the apps. It never hurts to review the basics of using Intents to start Activities.
Just guessing, but you may need to bring the requested activity to the foreground if it has already started and something else has focus.
I have an android app that the features may keep updating from time to time. Those features are hard coded into the app and I feel that if like 100 users download the app and when some features of the app is updated and re-upload to the play store those users who have installed the app prior now may have lost out on some of the latest features uploaded to the play store.
To tackle this issue I arrived at this solution as described in the url but yet to implement it in the onCreate method
Intent intent = new Intent(Intent.ACTION_VIEW ,Uri.parse("market://details?id=com.package.name"));
startActivity(intent);
Is there a way to automatically update application on Android?
I want to be guided properly please, if this approach will solve my doubts. Kindly assist!
if you used web serivce then pass your app version to web team.
and then getting first web service call one flag for app is old or not
and you can manullay set dialog when app is open. and then redirect appp to playsotre.
The solution you are looking for is REACT NATIVE APPS.
React Native apps allows you to change and add many features without uploading the app to play store.
https://facebook.github.io/react-native/showcase.html
UPDATE
But If you want to use android native development then.
Make an API in your backend which will return the latest version of your app in its response like:
{
appVersion: "4.2.1"
}
Then in your android app on the first activity make a call to this API and compare the version of your application with the API version.
String currentVersion = BuildConfig.VERSION_NAME;
If it doesn't match then show a message to the user to update the app from play store and give a button which will redirect to your app link on google play store.
Whenever you update your app in play store change the version in your API.
You can also maintain versions for major and minor update.
{
majorVersion:4
minorVersion:1
patchVersion:2
}
Then in your app:
String majorVersion = android.optString("majorVersion");
String minorVersion = android.optString("minorVersion");
String patchVersion = android.optString("patchVersion");
String[] ab = BuildConfig.VERSION_NAME.split("\\.", 3);
String appMajorVersion = ab[0];
String appMinorVersion = ab[1];
And use if else to check whether you need to force update or not.
I have an app which offers in app purchases of watch faces for Android Wear.
The new API however seems to push all faces implementing the CanvasWatchFaceService to the Android Wear application - perpetually making all my paid faces free!
How can I still allow users to perform in-app purchases without them directly being able to access the faces within Android Wear?
Needless to say if the purchase is successful, only then I would want the watch face to be visible in the Android Wear gallery.
Since watchfaces are registered as a service (https://developer.android.com/training/wearables/watch-faces/service.html), and there is no option to register services programmatically. I don't see any option to offer them as in-app payment feature.
From my point of view you got three options:
Make a demo version with less features (free / pro version)
Put a "this is a demo version" text on the watch if it wasn't purchased (I wouldn't recommend this solution since you will get bad ratings for sure)
Wrap each developed watchface in it's own app and publish it as a payed app
After a user opens my application I don't want them to be able to get out. So when they press the home or back button it doesn't let them exit the app. I know there are ways using a service to keep the app always running in the background, but I don't even want them to even exit.
Is this even possible, if so how? Without having to hack the kernel.
I know this sounds odd, but it is not for a commercial app, but for my lab, it will never be on GooglePlay. The tablets will be given to little kids and they will take a test on it, so I can't have them using youtube or anything else.
Related post: Android, How to make the task of the app unclosable? Only closable by task killing
The answer by CommonWare seems to indicate that kernel hacking is the only way, but is it?
Also I am using Android L.
there is no official support yet - there will be support with android L via the Task locking API
The L Developer Preview introduces a new task locking API that lets
you temporarily restrict users from leaving your app or being
interrupted by notifications. This could be used, for example, if you
are developing an education app to support high stakes assessment
requirements on Android. Once your app activates this mode, users will
not be able to see notifications, access other apps, or return to the
Home screen, until your app exits the mode.
https://developer.android.com/preview/api-overview.html
EDIT: as you said you use L this got obsolete - but I leave it here as a hint for others
said that - you are also able to get this kind of work without root today if you have to ( e.g. kiosk mode app on a certain hardware ). It is not simple - and no solution that works for all devices - but if you need it you can get it work with tricks like:
- reacting on home-screen intent ( and setting it as default )
- when you go to background - bring your self foreground again
- ..
It seems google has some thing called COSU for setting up single-purpose devices
Android 5.0 Lollipop introduced two new ways to configure Android
devices for a single purpose:
With app pinning, the device user can temporarily pin specific apps to the screen.
With lock task mode, a user can’t escape the app and the Home and Recents buttons are hidden. Additionally, lock task mode gives the IT
administrator a more robust way to manage COSU devices, as discussed
below.
and
As an IT administrator, you can configure Android 6.0 Marshmallow and
later devices as corporate-owned, single-use (COSU) devices. These are
Android devices used for a single purpose, such as digital signage,
ticket printing, point of sale, or inventory management. To use
Android devices as COSU devices, you need to develop Android apps that
your customers can manage.
from here
and there is a code lab for it here
for earlier versions of android here i founded How-To Create a Working Kiosk Mode in Android which shows some hacks for disabling buttons and restarting the application after boot and lock. note that most of these hacks, don't work on android 6 and later