Android: Access Content Provider from another application - android

I tried searching stackoverflow.com and tried every answer but none of them work.
I have a content provider and it was working when the user of the content provider is in the same application. However, I have Permission Denial error when accessing from another application.
LogCat
Caused by: java.lang.SecurityException: Permission Denial: opening provider com.abc.contentprovidersbooks.BooksProvider from ProcessRecord{4174b338 18673:com.abc.contentprovidersuserbooks/u0a10112} (pid=18673, uid=10112) requires com.abc.contentprovidersbooks.READ_DATABASE or com.abc.contentprovidersbooks.WRITE_DATABASE
Content Provider AndroidManifest:-
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.abc.contentprovidersbooks"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="11"
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.abc.contentprovidersbooks.ContentProvidersBook"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<provider android:name="BooksProvider"
android:authorities="com.abc.contentprovidersbooks.Books"
android:readPermission="com.abc.contentprovidersbooks.READ_DATABASE"
android:writePermission="com.abc.contentprovidersbooks.WRITE_DATABASE"
android:exported="true">
</provider>
</application>
Content Provider User application AndroidManifest:-
<?xml version="1.0" encoding="utf-8"?><manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.tshouse.contentprovidersuserbooks"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="11"
android:targetSdkVersion="17" />
<uses-permission android:name="com.tshouse.contentprovidersbooks.READ_DATABASE"/>
<uses-permission android:name="com.tshouse.contentprovidersbooks.WRITE_DATABASE"/>
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme"
android:readPermission="com.tshouse.contentprovidersbooks.READ_DATABASE"
android:writePermission="com.tshouse.contentprovidersbooks.WRITE_DATABASE"
>
<activity
android:name="com.tshouse.contentprovidersbooks.ContentProvidersUserBooks"
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>
Please advise how to declare the permission.
Thanks

If I had to guess, you installed the consumer app before the provider app, which will not work as you have it written.
If you put the <permission> elements in both apps, then the install order will not matter.
Also, you cannot put android:readPermission and android:writePermission on <application>, as you have in your consumer manifest. Simply delete those.

Related

getRunningTasks() causing error even with get permission

Android studio , is giving me some issues. I clearly declared android. permission.GET_TASKS in the manifest. But it still closes the app.
Error:
Caused by: java.lang.SecurityException: Permission Denial: getTasks() from pid=1010, uid=10046 requires android.permission.GET_TASKS
AndroidManifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.epiclapser.noprocrastinate" >
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme">
<uses-sdk
android:maxSdkVersion="18"
android:targetSdkVersion="18" />
<uses-permission android:name="android.permission.GET_TASKS"/>
>
<activity
android:name=".MainActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".MainActivity2"
android:label="#string/title_activity_main_activity2"></activity>
<activity
android:name=".LockScreen"
android:label="#string/title_activity_lock_screen"
>
</activity>
</application>
Move your permission Tag outside of Application Tag
<uses-sdk
android:minSdkVersion="16"
android:targetSdkVersion="16" />
<uses-permission android:name="android.permission.GET_TASKS"/>
<application
android:icon="#drawable/ic_launcher"
<!--Elements inside application Tag-->
</application>

Android app name under settings

How can I change the name of my app on the Android device settings? In other words, if the user hits settings, then Apps, there is a list of apps. I want to change its name there.
This is what I have currently in my manifest. And the name on that screen is "com.jockusch.freedroidcalculator". Ugh.
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.jockusch.freedroidcalculator" android:versionCode="1" android:versionName="1" android:hardwareAccelerated="true" android:label="Free Graphing Calculator">
<uses-sdk android:versionCode="1" android:versionName="1.0" android:targetSdkVersion="19" />
<application android:theme="#style/Theme.Foo" android:icon="#drawable/CalculatorAppIcon">
<activity android:name="jockusch.calculator.droid.MainTabActivity" android:label="Free Graphing Calculator">
<intent-filter android:label="Free GraCalc">
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
try this
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
</application>
inside your strings.xml
<string name="app_name">your app name</string>

No Launcher activity found even after putting the correct action and category

I have followed several threads on stack overflow but this is the error still shown:
No Launcher activity found!
The launch will only sync the application package on the device!
Here is my android manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="transapps.android_bluetooth_host"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="10"
android:targetSdkVersion="17" />
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name" >
<activity
android:name="transapps.android_bluetooth_host.BluetoothHost"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.inent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
It's just a typo. Your intent filter category says "android.inent" which will not match the category name expected by the launcher.

Android Manifest doesn't find <meta-data>

I'm trying to configure my app to program Chromecast featured button.
I'm reading all chromecast SDK and it says that i have to install Google Play Services.
I linked the library to my project, at the same workspace. I did it well because I have a new Android Dependencies library called google_play_services.jar
When I reach this point, I want to test if googlePlayServices are available, so I want to use:
GooglePlayServicesUtil.isGooglePlayServicesAvailable(getApplicationContext());
and print a Log with the result.
But the problem appeared here. When I run my app, it says that is not in my Android Manifest.
My Android Manifest has these lines already:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.chromecastAPP"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="9"
android:targetSdkVersion="18" />
<uses-permission android:name="android.permission.INTERNET"/>
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.example.chromecastAPP.MainActivity"
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>
Any different solution?
Thank you
Meta-data must be in application tags.
"Edit your application's AndroidManifest.xml file, and add the following declaration within the <application> element. This embeds the version of Google Play services that the app was compiled with." Look this link.
Try this:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.chromecastAPP"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="9"
android:targetSdkVersion="18" />
<uses-permission android:name="android.permission.INTERNET"/>
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.example.chromecastAPP.MainActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
</application>
</manifest>
I also Faced this problem. I just updated my SDK Google Play Service with its update Version and it worked for me...
Try it may be it works for you also..

Error in manifest - "Error parsing XML: unbound prefix"

My manifest.xml is,
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.pilot.clicker"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="18" />
<!-- Required -->
<uses-permission android:name="android.permission.INTERNET"/>
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#android:style/Theme.Light.NoTitleBar" >
<meta-data android:name="com.revmob.app.id" android:value="52eb635c38a33"/>
<activity android:name="com.revmob.ads.fullscreen.FullscreenActivity"
android:theme="#android:style/Theme.Translucent"
android:configChanges="keyboardHidden|orientation">
</activity>
<activity
android:name="com.pilot.clicker.Splash"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.pilot.clicker.Main"
android:label="#string/app_name" >
<intent-filter>
<action android:name="com.pilot.clicker.MAINSCREEN" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity android:label="#string/app_name" android:name="com.pilot.clicker.List"/>
</application>
</manifest>
The error is being displayed after the first line.
I'm attempting to integrate an ad-service 'Revmob' to my android-application. I've looked for an answer all over the internet..but just can't find a solution. Please help.
Thank you.
Put your uses-permission line after uses-sdk that is
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.pilot.clicker"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="18" />
<!-- Required -->
<uses-permission android:name="android.permission.INTERNET"/>
Also try to clean your project go to project menu (if you are using eclipse) and clean your project and re-run it. Might be this will resolve your issue.

Categories

Resources