As part of the free SmartWatch promotion I got a watch from Sony and have published an app for it. It is called SoundCheck and is found through the LiveWare Manager on the Google Play Market. A customer recently sent email for support. They installed Sound Check but did not see it on the watch since widgets are not enabled by default when they are installed. Is there any way to programmatically enable a widget when an app is installed? It might be nice for users if the widget was enabled by default rather than force them to navigate through the LiveWare manager to find the setting. This would be quite helpful for "widget-only" apps like Sound Check that do not have a control extension.
This week I created a pro version of my SmartWatch app to actually change the values displayed by the widget. Is it possible to open a control extension from a widget extension? Here is the use case. Short taps navigate through different screens of the widget. I want to use the long tap event type on the widget to open the 'editing' function in the control extension. Is this possible?
Thanks in advance for your help with these questions.
The question of how to enable a widget programmatically is still open. Here is code to open the control from a widget. This answer helped:
How should I do to start SmartWatch Extension from the program code?
if (type == Widget.Intents.EVENT_TYPE_SHORT_TAP) {
updateWidget();
} else {
//this code will launch the control and allow the user to change volume settings?
Intent intent = new Intent(Control.Intents.CONTROL_START_REQUEST_INTENT);
intent.putExtra(Control.Intents.EXTRA_AEA_PACKAGE_NAME, "com.mezcode.soundcheckpro");
intent.setPackage(mHostAppPackageName);
mContext.sendBroadcast(intent, Registration.HOSTAPP_PERMISSION);
}
Related
I would like to make a Intent to send the user to the settings screen which it has the switch to enable the Live Captioning introduced by Android 10, is there any way to to this intent?
The manual way is as described in this post
I've tried this intent:
startActivity(Intent(ACTION_CAPTIONING_SETTINGS));
But it redirects to general captions activation
The only intent i found was working is
startActivity(Intent("com.android.settings.action.live_caption"))
(category DEFAULT if you want to pass that as well)
I found this by finding the top activity when I had it open on my phone with adb and then inspecting the settings application to find intents matching the activity name.
Be aware, this is not an offical way to open this dialog. It may be subject to change and is very likely to differ between devices.
I could not find an Intent which is more general, so I'm assuming there's no offical way to open the activity.
Here is my problem, I've done an app to configure an IoT home device and saves this device properties on a simple SharedPreferences file, that's already done, but the other goal is to give this app the capability of "Invite" another user using this app so that this user can control this ALREADY configured device...I'm having trouble finding the specific name of this "Feature",
At this moment I've been thinking of simply adding the capabily of Sharing this file to the other app, like "Share my Devices", and pair the phones so that the other receives the file with the already configured devices. But I imagine more appropriate the scenario of "Invite User" to control the devices, and when doing it, the app receives a notification for accepting, but...what must happen after this on the underground?, I'm I little confused for "What to search", to start doing this, for example, when I didn't knew what was the concept of refreshing a webpage in real time I got the keyword for "polling", and just with that I was able to do the work, So, I don't know If you could just give a direction of what to search for the feature I'm looking, or at leats example of tecnologies using something close to this.
I'm developing an Android app which supports Chromecast and to do that I'm using a combination of MinimalCastMediaRouteProvider + a custom receiver. All is well with the playback but the Chomecast UX guide has a section headed Cast menu functions appropriately for available receiver devices. It seems to state that when the Chromecast device is already connected to a service it should have a label indicating it, like the following with netflix:
The issue is that on my device all I see is this:
where it's missing the "casting xxx" while I have another device casting to it. Is there something I need to set in my receiver app or is it something in the Android code? I don't see any documentation about it.
You don't need to do anything on your side at this point; there is currently a bug in the preview sdk that doesn't let that to work properly.
I am trying to open a different, already installed android application within another, on click of a button. The new application should be opened in a part of the screen within the calling application.
Currently, my code creates a new intent and runs the called application in that. the calling application disappears. Here's my code:
b.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
// TODO Auto-generated method stub
PackageManager pm = getPackageManager();
Intent intent = pm.getLaunchIntentForPackage("com.ritwik.camera");
startActivity(intent);
}
});
Ideally, it should open as a part of the same screen, without sidelining the parent(calling) application. How do I do that?
When you start an Intent to execute another application (i.e. because you are implementing a launcher or a main menu replacement) you are actually asking android to execute the application identified with a specific package (or the one satisfying some specific constraints, like the ability to handle images, videos, etc), without any clue or reference about the Activities it contains (nor the ability to get any...).
Therefore I don't think that what you are trying to achieve is possible with the current version of the OS (unless some vendor is providing extensions to do just that, see the comment by Pratik).
The new application should be opened in a part of the screen within the calling application.
This is not possible with conventional third-party application UIs.
AFAIK, the split-screen feature (Adaptive UI) is supported from Android 3.0 onwards.
That has nothing to do with embedding the UI of third-party apps into your own.
So I didn't get what you meant to say by "it's not possible with the current version of the OS"
It is not available on any stock version of Android released up through March 26, 2013 at 9:50am Eastern Time.
Certain device manufacturers, like Samsung, have extended Android with multi-window capabilities. However, the control over those windows lies with the user and the (modified) OS. Unless there is something in their S-Pen SDK for this, you have no way of starting another window.
Android also has RemoteViews, which is a means of passing a simplified UI between processes. Using this, it is possible for one app to embed RemoteViews published by another app. You see this with app widgets on the home screen, for example. However, both apps have to be written with this in mind, such as an app publishing an AppWidgetProvider to supply app widgets to home screens.
As far as I know, this is NOT possible. You can only launch the new activity, but you have no control of it.
EDIT: Some devices offer this possibility using Cornerstone or similar frameworks, but I haven't seen an option for developers to use this for their own apps.
This question already has answers here:
Is it possible to detect Android app uninstall?
(8 answers)
Perform a task on uninstall in android [duplicate]
(4 answers)
Closed 7 years ago.
I though it was not possible but I noticed that NQ Mobile Security is able to show a message after I click on Uninstall and before the PackageUninstaller is called.
I would like to replicate this behavior in my App.
I tried with an Activity listening to "android.intent.action.DELETE" Intent, as suggested here:
How to know my app is uninstalled from the device...?
But as I'm about to uninstall my app, the chooser pops up asking to pick my application or the package uninstaller. How can I avoid this?
Is there a different way to intercept your application UNINSTALL event? (before answering that it is not possible, please try to uninstall NQ Mobile Security and see what happens. On my Android 2.3.4 it shows a nice screen saying that is not safe to go without a security app).
I noticed that NQ Mobile Security is able to show a message after I click on Uninstall and before the PackageUninstaller is called
They must be exploiting some security flaw in Android. I will research it and see if I can get it fixed. Apps are not supposed to get control at uninstall time.
Thanks for pointing this out!
Is there a different way to intercept your application UNINSTALL event?
I sure hope not.
Opera Max is an app that does something similar - after being uninstalled opens a webpage.
How do they do this?
By using libevent, from native code, they watch /data/data/com.opera.max directory to be removed and then post good old action.VIEW broadcast when it happens.
Install their app, run it, and on rooted device from adb shell remove /data/data/com.opera.max directory
UPDATE: I created a sample app that shows how it works. BTW it doesn't work with recent (KitKat+ I think) Android versions: https://github.com/pelotasplus/ActionAfterUninstall
I'm pretty sure that they are monitoring the LogCat to intercept when the Activity Manager calls the PackageUninstaller. I think they kill the task and start their own Activity.
It's pretty clever but it's definitely exploiting a security hole in Android.
They are likely asking for a very critical permission that the user is granting them unknowingly. Look at the "Permissions" tab for this app (as of 6/15/2012): https://play.google.com/store/apps/details?id=com.nqmobile.antivirus20&hl=en.
The list of permissions this app gets is downright chilling. Among other things:
SYSTEM TOOLS RETRIEVE RUNNING APPS Allows the app to retrieve
information about currently and recently running tasks. Malicious apps
may discover private information about other apps.
CHANGE/INTERCEPT NETWORK SETTINGS AND TRAFFIC Allows the app to change network settings
and to intercept and inspect all network traffic, for example to
change the proxy and port of any APN. Malicious apps may monitor,
redirect, or modify network packets without your knowledge.
PREVENT TABLET FROM SLEEPING PREVENT PHONE FROM SLEEPING Allows the app to
prevent the tablet from going to sleep. Allows the app to prevent the
phone from going to sleep.
CHANGE YOUR UI SETTINGS Allows the app to
change the current configuration, such as the locale or overall font
size.
MODIFY GLOBAL SYSTEM SETTINGS Allows the app to modify the
system's settings data. Malicious apps may corrupt your system's
configuration.
DISPLAY SYSTEM-LEVEL ALERTS Allows the app to show
system alert windows. Malicious apps may take over the entire screen.
MOUNT AND UNMOUNT FILESYSTEMS Allows the app to mount and unmount
filesystems for removable storage.
CHANGE NETWORK CONNECTIVITY Allows
the app to change the state of network connectivity.
CHANGE WI-FI STATE Allows the app to connect to and disconnect from Wi-Fi access
points, and to make changes to configured Wi-Fi networks.
-- Update --
I also found that the Android Package Manager pretty much just deletes a package if it is asked to do so. The only check it performs prior to doing so is whether the package being deleted is currently registered as having an active device admin:
try {
if (dpm != null && dpm.packageHasActiveAdmins(packageName)) {
Slog.w(TAG, "Not removing package " + packageName + ": has active device admin");
return PackageManager.DELETE_FAILED_DEVICE_POLICY_MANAGER;
}
} catch (RemoteException e) {
}
See line 6900 in PackageManagerService in the AOSP source here.
For this, the application must be explicitly registered as a device admin by the user. See notes on device administration here: http://developer.android.com/training/enterprise/device-management-policy.html.
As per https://stackoverflow.com/a/26829978/1317564, here is some example code that does it: https://github.com/zzljob/android-uninstall-feedback/blob/master/library/jni/feedback-uninstall.c. This won't actually stop the uninstall from taking place, but does provide a way to catch it and take some action. I'm honestly surprised that this works in Android and the team may have plugged the gap in recent releases.