changing wallpapers automatically in android - android

i am new to android programming and want to develop an application similar to vista where the wallpaper changes automatically , so how should i go about it, please could someone guide me on it? thanks

You would need to use the Wallpaper Manager Api : http://developer.android.com/reference/android/app/WallpaperManager.html
Here is a related tutorial : http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/app/SetWallpaperActivity.html

Basically, you will have to use the WallpaperManager class which provides the neccesarry methods to do so.
Also, don't forget to add the SET_WALLPAPER permission to your AndroidManifest.xml:
<manifest xlmns:android...>
...
<uses-permission android:name="android.permission.SET_WALLPAPER" />
</manifest>
Edit: take a look of the example that Ravi Vyas gave you... I didn't know about it and it looks pretty useful.

Related

TextToSpeech on Android 11

Up to API 29 tts is working fine on android to speak out any text
But on API 30 tts is not working anymore and i do not know why
The google documentation says :
"Apps targeting Android 11 that use text-to-speech should declare TextToSpeech.Engine#INTENT_ACTION_TTS_SERVICE in the elements of their manifest"
I do not exactly know what they mean and how to implement this in the manifest.
I hope anybody can help me with this.
Although probably not the best answer (or maybe just a glitch on Androids part) add the following code just above the <application in your manifest.
<queries>
<intent>
<action android:name="android.intent.action.TTS_SERVICE" />
</intent>
</queries>
<application
android:allowBackup="false"
After adding this code my TTS service started to work again, but I do get a warning from the manifest file about it not being allowed there, but anywhere in the manifest gives this same warning so I suppress it with <!--suppress AndroidElementNotAllowed --> just above the <manifest tag at the top.
#jayce's answer helps if app is targeting the Android 11
https://developer.android.com/reference/android/speech/tts/TextToSpeech
Note: sorry for the noise but I don't have enough reputation to put my comment there.

How do I use multiple packages, such as location and maps?

First of all sorry, I'm not familiar with the terminology.
I'm following the official Android tutorial and I'm already stuck on the first section of "Making Your App Location-Aware".
I'm following from the very first tutorial and I'm stuck on the first step.
This is what the tutorial says to do,
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.google.android.gms.location.sample.basiclocationsample">
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
</manifest>
but I already have,
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package=com.example.user.myapplication.MainActivity">
I'm confused as what to do. I've tried just putting the package separately, e.g.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.google.android.gms.location.sample.basiclocationsample" >
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<activity android:name="com.example.user.myapplication.MainActivity">
But even then in MainActivity.java apparently FusedLocationProviderClient has an error - it says 'class' or 'interface' expected.
How would I go about fixing this, and how would I use, say 3 packages?
CommonsWare's answer is correct. However, his answer doesn't help you much. What the tutorial MEANS is to add the line:
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
right after the line:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="YOUR_PACKAGENAME_HERE" >
You don't need to change your package name to fix the problem, just replace com.google.android.gms.location.sample.basiclocationsample with your current package name com.example.user.myapplication.MainActivity
Warning! If you plan on publishing your app to the Play Store, use some thing other than com.example.user.myapplication.MainActivity
A great example of a good package name for you is com.michaelluong.myapplication
How would I go about fixing this, and how would I use, say 3 packages?
You can't. An app has one package name (a.k.a., application ID).
Generally, when using tutorials, you have two choices:
Follow them to the letter, or
Do your own thing in parts, relying upon your experience to bridge between what the tutorial suggests and what you are actually doing
In your case, I suggest you choose option #1. What you have already has issues (while com.example.user.myapplication is a fine package name, com.example.user.myapplication.MainActivity is an odd choice at best).
If you create a new project, when it asks for the package name, fill in com.google.android.gms.location.sample.basiclocationsample to match the tutorial.
However, do bear in mind that the "tutorials" that you are following are incomplete, skipping steps along the way. Despite their name, most of those "tutorials" are not suited for newcomers to Android.

Android user permissions

I am new to android development and I am making a tic tac toe game for a project at the university.
I know it is a simple game, but I need to add a permission to it so I can show that android has some kind of security.
I was thinking about the thing where the screen doesn't automatically locks, WAKE_LOCK or something like that.
How to implement this ? Is there a way besides the one where you add the code to your xml file ?
I mean something that has to do with <user-permissions.... /> in manifest so a pop-up with accept can appear to the user ?
Is it enough to add that line to the manifest file or coding is required ?
Thanks.
this is enough
<manifest xlmns:android...>
...
<uses-permission android:name="android.permission.INTERNET"></uses-permission>
</manifest>

Bluetooth chat sample looks messy on ICS

I am new to android programming. I have already coded an GUI für my app and want to complete it with bluetooth functionality. I used the bluetooth chat example from 2.1 and it really looks messy in ICS, seems as if the resolution isn't set properly so that all elements are scaled up. I tried to change the XMLs but I cannot solve the problem.
Has anyone an idea?
THX in advance
Peter
That's probably because of 1 line in the AndroidManifest.xml, change it from
<uses-sdk android:minSdkVersion="6"/>
.. to something like ..
<uses-sdk android:minSdkVersion="7"/>
See my reply on stackoverflow.
See this: issue reported on Android bugtracker

Application installer tells that my app reads Phone State and identity :-(

Hoi,
I have a simple app with a surfaceview nothing special one would say. However when installing on my phone I get two warnings.
1 - Phone calls
- read phone state and identity
2 - Storage
- modify/delete SD card content.
My really is nothing more than a simple puzzle and I dont understand why I get these warnings.
Any ideas how to avoid this?
Help is very much appreciated,
Kind regards
Jasper de Keijzer.
I guess the warnings you mention are user-permissions in the manifest. Check if you have in your manifest lines like:
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
and delete them.
It is most likely due to building the app for Android 1.5 (or earlier) and running it on a 1.6 or later device. According to this answer elsewhere on StackOverflow, you can fix it with the following line in your manifest:
<uses-sdk android:minSdkVersion="4" android:targetSdkVersion="4" />
It hasn't worked for me, though.

Categories

Resources