I have a problem with launching this app through menu. There is no problem when I start it using a different application that has permission. This is the manifest file:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.michael.dangerouslab" >
<uses-permission android:name="course.labs.permissions.DANGEROUS_ACTIVITY_PERM"/>
<permission android:name="course.labs.permissions.DANGEROUS_ACTIVITY_PERM"
android:protectionLevel="dangerous"/>
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/AppTheme"
android:permission="course.labs.permissions.DANGEROUS_ACTIVITY_PERM">
<activity android:name=".DangerDanger" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<action android:name="course.labs.permissions.DANGEROUS_ACTIVITY"/>
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
</activity>
</application>
</manifest>
Delete both occurrences of android:permission="course.labs.permissions.DANGEROUS_ACTIVITY_PERM" (one in <application>, one in <activity>).
Those say "no third-party app, including the home screen, can do anything with my app, unless they have <uses-permission android:name="course.labs.permissions.DANGEROUS_ACTIVITY_PERM"/> in their manifest". There are roughly zero apps that have such an element, including roughly zero home screen implementations. Hence, you will not be able to launch your app.
Related
My home page needs to show two buttons: login & register. The page Login Activity with both buttons should appear first, but only the register screen comes up.
I am very new to coding. So, please be nice :( I've been stuck on this for days.
Below is the AndroidManifest.xml. Can anyone spot what I am doing wrong?
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.thrd">
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity android:name=".LoginActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".RegisterActivity"></activity>
<activity android:name=".UserAreaActivity"></activity>
</application>
</manifest>
You manifest file is ok. Probably you have some logical errors in your code. In LoginActivity. So it launches RegisterActivity (probably in onCreate), instead of showing itself.
I have the following manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.inthemoon.normaltraveltracker">
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity
android:name=".MapsActivity"
android:label="#string/title_activity_maps">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
where string resources are
<resources>
<string name="app_name">Normal Travel Tracker</string>
<string name="title_activity_maps">Map</string>
and this application icon is entitled "Map" on my Android device, i.e. not by app name but by activity name.
Why?
It's caused by label's priority.
According to android developer API documents, 'label' in 'activity' is first priority then in 'application'.
So, you should remove 'android:label' in 'activity'.
Lets take your Manifest
There are two labels you need to concern
1.For app name under... launcher icon -------->use android:label --> inside your Main Launcher activity tag
2.For app name under... Settings -> Application manager -> downloaded App name ---> use android:label -->inside application tag
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name" <----(2)
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity
android:name=".MapsActivity"
android:label="#string/title_activity_maps"> < ---(1)
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
Change your launcher activity android:label tag and run :)
Note: The name under the launcher icon isn't the name of the app, it's the name of the default launcher!
I have been trying to download some stuff from the internet in my app, but in the second activity. I have added the permission request, and it works in my first activity, but not in the second one? is there anything i'm forgetting? otherwise, why would i possibly be getting a permission error?
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.ruslan.seriesstuff">
<uses-permission android:name="android.permission.INTERNET"/>
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity
android:name=".MainActivity"
android:label="#string/app_name"
android:theme="#style/AppTheme.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<activity android:name=".Main2Activity">
</activity>
</application>
The problem occurred because of the newer version of android, in my case 6.0. I solved this problem by doing the following. Long press on the app icon in your phone, drag it to the appeared icon of app info. There go to the permissions of the app and make sure you have actually provided the permission to the internet. That's it!
Unfortunately when I try to run my wallpaper I get an error message saying Permission Denial starting Intent and requires android.permission.BIND_WALLPAPER but I can't seem to figure out why. My manifest looks like the following:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.package">
<uses-feature android:name="android.software.live_wallpaper" />
<uses-permission android:name="android.permission.SET_WALLPAPER" />
<application
android:exported="true"
android:icon="#drawable/icon"
android:label="#string/app_name"
android:permission="android.permission.BIND_WALLPAPER">
<service
android:name="WallpaperService"
android:icon="#drawable/icon"
android:label="#string/app_name"
android:permission="android.permission.BIND_WALLPAPER">
<intent-filter>
<action android:name="android.service.wallpaper.WallpaperService" />
</intent-filter>
<meta-data
android:name="android.service.wallpaper"
android:resource="#xml/livewallpaper" />
</service>
<activity
android:name=".WallpaperSetClass"
android:exported="true"
android:permission="android.permission.BIND_WALLPAPER"
android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
The live wallpaper does run perfectly if I set it through the live wallpaper part of my phone, but I would like to have a settings area as well to be able to open in which I can't.
At the moment my settings class is basically empty containing just an onCreate function and a layout with a button.
Is there something I'm missing? I seem to have the permissions along with android:exported
Turns out I had
android:permission="android.permission.BIND_WALLPAPER"
In the wrong spot, it should be in the service tag, and only have ONE, having multiple will break it.
So im kinda new to android programming and i dont really know why i cant run the main activity when i have a permission tag under the activity. this is my code under the manifest file:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.lab08b_awahla"
android:versionCode="1"
android:versionName="1.0" >
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="com.example.DANGEROUS_ACTION" />
<permission
android:name="com.example.DANGEROUS_ACTION"
android:label="permission"
android:protectionLevel="dangerous" />
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.example.lab08b_awahla.MainActivity"
android:label="#string/app_name"
android:permission="com.example.DANGEROUS_ACTION" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="com.example.DANGEROUS_ACTION" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
</application>
</manifest>
This is obvious. If you are providing a security tag for activity anyone who wants to launch this activity has to have such privilege. Home screen app doesn't have (even don't known) your permission tag so this is a problem.
According to the docs for the <activity> tag
android:permission
The name of a permission that clients must have to launch the activity or otherwise get it to respond to an intent. If a caller of startActivity() or startActivityForResult() has not been granted the specified permission, its intent will not be delivered to the activity.
This leads me to think that you misunderstand the use of this attribute.