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"));
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:"));
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.
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.
OK, i've tried everything (including several hours of reading and trying a lot of stuff on stackoverflow)
I'm trying to launch the default sms app from the android launcher, and using this code:
Intent smsIntent = new Intent(Intent.ACTION_MAIN);
smsIntent.addCategory(Intent.CATEGORY_DEFAULT);
smsIntent.setType("vnd.android-dir/mms-sms");
smsIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(smsIntent);
break;
It works great on all phones BUT my NEXUS 5 .
Guess it has something to do with KITKAT, but not sure how to fix it..
Important - Im not trying to send the text or get it from the user (as i've seen people do here), just getting the user to the main screen of the sms app (hangouts in my case).
Thanks. :)
Intent intent = new Intent();
ComponentName cm =new ComponentName("com.google.android.talk","com.google.android.talk.SigningInActivity");
intent.setComponent(cm);
this adapter nexus, I get the ComponentName by ADB log.
I have a program that I have made for Android 1.6 and up and I have been doing tests to ensure that the program works fine with the new Ice Cream Sandwich (Android 4).
Everything on the app works fine except that when a certain task has been performed by the user it is supposed to automatically launch the android browser. However for some reason it seems to load it up in the background and keeps my app shown which is not what I want it to do.
On every other version of android when I execute the code to launch the browser the browser comes to the top of the screen therefore causing my app to be in the background which is how I wanted it to work.
Below is the code that I have to launch the browser
Intent intent = new Intent();
intent.setAction(Intent.ACTION_VIEW);
intent.addCategory(Intent.CATEGORY_BROWSABLE);
intent.setData(Uri.parse(companyURL));
startActivity(intent);
The companyURL is a variable that I am using to parse the url to the browser.
Thanks for any help you can provide.
UPDATE
I have just discovered that if the browser is not currently running (i.e. not been loaded previously) when my app starts the browser it brings it to the front. However, once the browser has been previously loaded, when my app loads it up again, it loads it in the background.
Please try this it is working on ICS for me.
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(companyURL));
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
Typically you don't need the CATEGORY_BROWSABLE category. Try the following instead:
Intent intent = new Intent();
intent.setAction(Intent.ACTION_VIEW);
intent.setData(Uri.parse(companyURL));
startActivity(intent);
In fact, the documentation seems to suggest CATEGORY_BROWSABLE is intended to be used in the opposite direction (browser to your app):
Activities that can be safely invoked from a browser must support this category. For example, if the user is viewing a web page or an e-mail and clicks on a link in the text, the Intent generated execute that link will require the BROWSABLE category, so that only activities supporting this category will be considered as possible actions.
http://developer.android.com/reference/android/content/Intent.html#CATEGORY_BROWSABLE
Try adding FLAG_ACTIVITY_BROUGHT_TO_FRONT flag to the intent.
I'm using following code and its working fine with me even when browser is already running in the background.
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.google.com"));
startActivity(intent);