So I have a live wallpaper app published. I know different lockscreen wallpapers are not AOSP but rather a feature for each OEM, but many of my users use those modified ROMs from the OEMS and I get tons of requests/bad reviews from users about how to set it for the lockscreen because they dont know they can do that from the settings.
Some time ago I found that for most Samsung devices you can make the live wallpaper preview set the live wallpaper for the lockscreen too by specifying this:
Intent intent = new Intent(WallpaperManager.ACTION_CHANGE_LIVE_WALLPAPER);
intent.putExtra(WallpaperManager.EXTRA_LIVE_WALLPAPER_COMPONENT, new ComponentName(this, LiveWallpaperService.class));
intent.putExtra("SET_LOCKSCREEN_WALLPAPER", true);
I was wondering if other OEMS such as LG/Sony/etc have also intent parameters to do this.
Related
I have an image and want to set it as the lock screen wallpaper. For devices with API 24 and higher, we can do this with
wallpaperManager.setBitmap(bitmap,null,true,WallpaperManager.FLAG_LOCK)
But I want to do it on devices prior to API 24 as many other wallpaper apps do so. This has been answered here before, but it doesn't give any clue how other wallpaper applications are able to set the lock screen wallpaper on devices prior to API 24.
There are other solutions that suggest that the app has to be registered as a media controller for a temporary replacement, but that's not my case. Note that I am aware of the fact that it is not possible through the standard API, however, I am looking for an alternative.
Use this Implicit intent to set the wallpaper or set lock screen wallpaper on devices prior to API 24.
Intent intent = new Intent("android.intent.action.ATTACH_DATA");
intent.addCategory("android.intent.category.DEFAULT");
String str = "image/*";
intent.setDataAndType(Uri.fromFile(new File(your_file_url)), str);
intent.putExtra("mimeType", str);
startActivity(Intent.createChooser(intent, "Set As:"));
I am using MediaStore.Audio.Media.RECORD_SOUND_ACTION to open sound recorder application, I am not able to open application as no default application present, then i install two voice recorder application even though not able to see these application in my chooser intent. I am using following code-
Intent soundRecorderIntent = new Intent(); // create intent
soundRecorderIntent.setAction(MediaStore.Audio.Media.RECORD_SOUND_ACTION); // set action
startActivityForResult(soundRecorderIntent, ACTIVITY_RECORD_SOUND); // start activity
It works well in marshmallow
The code is correct and you've probably found an app that supports the intent by now. But to prevent that others waste their time like I did, here's a quick note:
Most of the currently top rated voice recording apps in the Play Store do not provide the necessary intent filter.
That seemed so unrealistic to me that I doubted my code when it didn't work after having installed the five most popular voice recording apps. But there's a handy manifest viewer app that reveals that their manifests simply do not declare the intent filter. So, as said, the code is correct.
To save you the time from searching for a suitable app, here are two that are invocable:
Audio Recorder from Sony
Samsung Voice Recorder from Samsung
There is no requirement for a voice recorder app to support this Intent action, and apparently your device does not ship with an app that supports this Intent action either. Your code itself seems fine.
If recording is optional to your app, catch the ActivityNotFoundException and tell the user that they do not have a recorder, and perhaps suggest to them that they install one that you test that works, if you can find one.
Otherwise, record the audio yourself, using MediaRecorder.
I see many people have asked about this problem like here, here and ... but I can not find any solution.
However, I see some background app on playstore can do it.
My purpose is that I want to open intent for set lock screen wallpager like
This device is SamSung S2
Generally there is no (proper) documentation on how to set the Lock screen Wallpaper. Samsung doesn't allow it as far it goes.
In some Phones, we are able to see the Wallpaper we set through Wallpaper Manager purely dependent on the Device Stock OS. And we have no control over it specifically.
Intent intent = new Intent(Intent.ACTION_ATTACH_DATA);
intent.addCategory(Intent.CATEGORY_DEFAULT);
intent.setDataAndType(Uri.parse(mPath), "image/jpeg");
intent.putExtra("mimeType", "image/jpeg");
startActivity(Intent.createChooser(intent, "Set as: Home Screen"));
I've a free app on the Play Store: Circus Watch Faces and I'm trying to add a watch faces chooser in the configuration activity; I followed the Android Dev Docs about it and no problems, BUT how I can switch from one watch face to another?
I'm completely new to android development so I'm trying to understad from samples and building something new.
Currently I've a configuration activity with just a button and when I click on it, I'd like to change the current watch face!
My code is on GitHub (not updated with the config activity yet) if maybe can help a bit.
There is no way to change watch face programatically. The best you can do is send a broadcast WallpaperManager.ACTION_LIVE_WALLPAPER_CHOOSER or (in the new release of Android Wear) WallpaperManager. ACTION_CHANGE_LIVE_WALLPAPER. They will invoke a watch face picker (watch faces are specialized wallpapers). The latter intent also allows you to set your watch face as a proposal for selection in the picker.
The reason for non existence of a way for setting a watch face is that it could be easily abused by apps against user's wishes.
However, since you are trying to do something from your configuration activity, maybe you want to achieve something completely different. Maybe you want to just have one WatchFaceService and then change it (draw it differently) according to some internal settings. This way if the users wants to change the appearance (even to a point where the watch face looks completely different, feels like a new watch face) you just change the underlying data and let the watch face redraw itself.
The closest you can do is the following:
public static void pickYourWatchFace(Context context) {
ComponentName yourWatchFace = new ComponentName(context, YourWatchFace.class);
Intent intent = new Intent(WallpaperManager.ACTION_CHANGE_LIVE_WALLPAPER)
.putExtra(WallpaperManager.EXTRA_LIVE_WALLPAPER_COMPONENT, yourWatchFace)
.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(intent);
}
this will open the Watch Face Picker with YourWatchFace in front of the user, requiring only one tap to set it up.
I'm trying to start default android wallpaper chooser. I'm using:
Intent intent = new Intent(Intent.ACTION_SET_WALLPAPER);
startActivity(intent);
This code works but it opens app chooser. I want to open "Wallpapers" directly. My minSdkVersion is set to 16.
By "default" you seem to mean the wallpaper app that came with Android OS, rather than other wallpaper apps that the device may have. You can force Android to launch a particular activity by setting the component in the intent.
Intent intent = new Intent(Intent.ACTION_SET_WALLPAPER);
intent.setComponent(...);
startActivity(intent);
However, this is a risky thing to do. If you run this code on a device that doesn't have the wallpaper app that you've specified, then you will get an ActivityNotFoundException.
Do you really need to launch one particular wallpaper app? A central feature of Android is that you say what you want to do, and it finds the app to do it. I don't know what your goal is, but another function that might be helpful is PackageManager.resolveActivity. You can use it to discover, in code, what app would be launched for a particular intent.
http://developer.android.com/reference/android/content/pm/PackageManager.html
Hope this helps.