Permission Denied - android

My app is crashing when I call insert on the contentProvider class and I get a permission denied error. How do I set the permission??
01-13 23:41:15.071 467-467/system_process W/ActivityManager﹕ Permission denied: checkComponentPermission() owningUid=10065
01-13 23:41:15.071 467-467/system_process W/ActivityManager﹕ Permission Denial: opening provider net.kritico.todolist.ToDoContentProvider from ProcessRecord{a784a9c0 1669:net.kritico.kriticoads/u0a10069} (pid=1669, uid=10069) that is not exported from uid 10065
My manifest is as below
<uses-sdk
android:minSdkVersion="9"
android:targetSdkVersion="18" />
<!-- Used to request banner and interstitial ads. -->
<uses-permission android:name="android.permission.INTERNET" />
<!-- Used to avoid sending an ad request if there is no connectivity. -->
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="net.kritico.kriticoads.MainActivity"
android:label="#string/app_name"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<!-- Activity required to show ad overlays. -->
<activity
android:name="com.google.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|
screenSize|s mallestScreenSize" />
<activity
android:name="net.kritico.kriticoads.ToDoItemActivity"
android:label="#string/title_activity_to_do_item" >
</activity>
</application>
</manifest>

You need to declare the ContentProvider to your manifest inside of your application tag. Declaring Content Provider
Also see Declaring Content Provider

Related

handshakeexception handshake error in client (os error wrong_version_number tls_record cc 242) Flutter app/Node server

I'm getting an handshakeexception handshake error in client (os error wrong_version_number tls_record cc 242) error whenever making an http request( I also tried https ) but from only one ( Cyclist app ) of the two Flutter apps that connect to Node.js server. I'm using the same IP address and port on both, the Android tablet on which I'm testing both apps and for my machine. I checked Manifest Android/src/main/AndroidManifest.xml to see if I was using android:usesCleartextTraffic="true"`on the working app ( Shop app ) but I'm not..
What else could I check to see what's causing the error in the Cyclist app??
This is the request:
Map<String, String> headers = {
'Content-Type': 'application/json',
'api_key': Environment.dbApiKey
};
// final Uri uri = Uri.https(Environment.dbUrl, '/api/routes');
final Uri uri = Uri.http(Environment.dbUrl, '/api/routes');
await post(uri, headers: headers, body: jsonEncode(route.toMap()))
.then((resp) {
print(
'RouteMongoRepository.saveRoute response status code is: ${resp
.statusCode}, \n response is : ${jsonDecode(resp.body)}');
UserRoute saved = UserRoute.fromMap(jsonDecode(resp.body)['data']);
print('saved route to Mongo is : ${saved.toMap().toString()}');
}) .catchError((e) => print('RouteMongoRepository.saveRoute error: $e')) ;
This is the Shop app manifest:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.vinny.fixit_shop_flutter">
<!-- io.flutter.app.FlutterApplication is an android.app.Application that
calls FlutterMain.startInitialization(this); in its onCreate method.
In most cases you can leave this as-is, but you if you want to provide
additional functionality it is fine to subclass or reimplement
FlutterApplication and put your custom class here. -->
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />
<uses-permission android:name="android.permission.INTERNET" />
<application
android:name="io.flutter.app.FlutterApplication"
android:allowBackup="false"
android:label="fixit shop"
android:icon="#mipmap/ic_launcher">
<activity
android:name=".MainActivity"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true"
android:launchMode="singleTop"
android:theme="#style/LaunchTheme"
android:windowSoftInputMode="adjustResize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<!-- Don't delete the meta-data below.
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
<meta-data
android:name="flutterEmbedding"
android:value="2" />
</application>
</manifest>
and this is the Cyclist app manifest:
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<application
android:name="io.flutter.app.FlutterApplication"
android:allowBackup="false"
android:label="fixit"
android:icon="#mipmap/ic_launcher">
<activity
android:name=".MainActivity"
android:launchMode="singleTop"
android:theme="#style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true"
android:windowSoftInputMode="adjustResize"
>
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<receiver android:name="com.dexterous.flutterlocalnotifications.ScheduledNotificationReceiver" />
<receiver android:name="com.dexterous.flutterlocalnotifications.ScheduledNotificationBootReceiver">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED"/>
<action android:name="android.intent.action.MY_PACKAGE_REPLACED"/>
</intent-filter>
</receiver>
<!-- Don't delete the meta-data below.
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
<meta-data
android:name="flutterEmbedding"
android:value="2" />
</application>
</manifest>
Found it..I was missing <uses-permission android:name="android.permission.INTERNET" />in Cyclist app AndroidManifest.xml

Unexpectedly Closed Application After Integration Parse.com

There was no problem while running my little android application. I integrated my application new feature. I am using real time push notification with using ready script by www.parse.com . There is no problem while running but when i closed screen and reopen .There is an error. Your application closed unexpectedly. I dont know why and there is no log.
I am using this code in my main activity before oncreate
Parse.initialize(this, "XXX", "YYY");
PushService.setDefaultPushCallback(this, MainActivity.class);
ParseInstallation.getCurrentInstallation().saveInBackground();
ParseAnalytics.trackAppOpened(getIntent());
AndroidManifest.xml
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.islamiceducationquestions.v1"
android:versionCode="13"
android:versionName="8.0.1">
<uses-sdk android:minSdkVersion="14" android:targetSdkVersion="17" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<!--
IMPORTANT: Change "com.parse.starter.permission.C2D_MESSAGE" in the lines below
to match your app's package name + ".permission.C2D_MESSAGE".
-->
<permission android:protectionLevel="signature"
android:name="com.islamiceducationquestions.v1.permission.C2D_MESSAGE" />
<uses-permission android:name="com.islamiceducationquestions.v1.permission.C2D_MESSAGE" />
<application
android:label="#string/app_name"
android:icon="#drawable/ic_launcher"
android:theme="#android:style/Theme.Holo.Light.DarkActionBar">
<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>
<service android:name="com.parse.PushService" />
<receiver android:name="com.parse.ParseBroadcastReceiver">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
<action android:name="android.intent.action.USER_PRESENT" />
</intent-filter>
</receiver>
<receiver android:name="com.parse.GcmBroadcastReceiver"
android:permission="com.google.android.c2dm.permission.SEND">
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
<!--
IMPORTANT: Change "com.parse.starter" to match your app's package name.
-->
<category android:name="com.islamiceducationquestions.v1" />
</intent-filter>
</receiver>
</application>
</manifest>
Log is :
java.lang.RuntimeException: Unable to start receiver com.parse.ParseBroadcastReceiver: java.lang.RuntimeException: applicationContext is null. You must call Parse.initialize(context, applicationId, clientKey) before using the Parse library.
at android.app.ActivityThread.handleReceiver(ActivityThread.java:2844)
at android.app.ActivityThread.access$1700(ActivityThread.java:156)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1440)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:157)
at android.app.ActivityThread.main(ActivityThread.java:5867)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:858)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:674)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.RuntimeException: applicationContext is null. You must call Parse.initialize(context, applicationId, clientKey) before using the Parse library.
at com.parse.Parse.checkContext(Parse.java:583)
at com.parse.Parse.getApplicationContext(Parse.java:191)
at com.parse.ManifestInfo.getContext(ManifestInfo.java:241)
at com.parse.ManifestInfo.getPackageManager(ManifestInfo.java:249)
at com.parse.ManifestInfo.getPackageInfo(ManifestInfo.java:272)
at com.parse.ManifestInfo.deviceSupportsGcm(ManifestInfo.java:357)
at com.parse.ManifestInfo.getPushType(ManifestInfo.java:129)
at com.parse.PushService.startServiceIfRequired(PushService.java:150)
at com.parse.ParseBroadcastReceiver.onReceive(ParseBroadcastReceiver.java:19)
at android.app.ActivityThread.handleReceiver(ActivityThread.java:2833)
... 10 more
As you can see here Android Parse.com Simple ListView Tutorial you will need to call Parse.initialize from Application's onCreate instead of from Activity or Service. do it as:
public class ParseApplication extends Application {
#Override
public void onCreate() {
super.onCreate();
// Add your initialization code here
Parse.initialize(this, YOUR_APPLICATION_ID, YOUR_CLIENT_KEY);
}
}
Also add ParseApplication in AndroidManifest.xml as application tag name:
<application
android:label="#string/app_name"
android:icon="#drawable/ic_launcher"
android:name="ParseApplication"
....

CreateNdefMessageCallback conflict with ContentProvider permissions

I write a program provider a provider for another apps of our company. The provider need a permission to access the data.
We also have a interface need use NFC send json data to another devices.
When we access the provider in CreateNdefMessageCallback.createNdefMessage like
#Override
public NdefMessage createNdefMessage(NfcEvent event) {
Context context = this;
ContentResolver resolver = context.getContentResolver();
Cursor cursor = resolver.query(Uri.parse("content://demo/data-lists"),
null,
null,
null,
null);
// FIXME Strange: Will never goes here ...
mMessage = getMessage(cursor);
NdefMessage msg = new NdefMessage(
new NdefRecord[] {
createMimeRecord(mMimeType, mMessage.getBytes())
});
return msg;
}
There is very strange, we never get a cursor until remove the permission.
Permission Declear
<permission
android:name="com.client.permission.MY_PERMISSION"
android:label="#string/provider_label"
android:protectionLevel="signatureOrSystem" />
Request permision
<uses-permission android:name="com.client.permission.MY_PERMISSION" />
Provider permission declear
<provider
android:name=".provider.DemoProvider"
android:authorities="demo"
android:multiprocess="true"
android:permission="com.client.permission.MY_PERMISSION" />
Currenty the provider and the NFC-send activity in the same application and read the provider data will but the NFC callback.
And if I remove the permission for the provider, this will work fine.
like the
Provider without permission
<provider
android:name=".provider.DemoProvider"
android:authorities="demo"
android:multiprocess="true"/>
Please help.
Thanks.
UPDATED 2013-03-14
It's very strange. I found this issue only when the provider and the NFC Activity in the same application. like this.
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.nfcdemo"
android:versionCode="6"
android:versionName="build-svn291" >
<uses-sdk
android:minSdkVersion="14"
android:targetSdkVersion="17" />
<permission
android:name="com.client.permission.MY_PERMISSION"
android:label="#string/provider_label"
android:protectionLevel="signatureOrSystem" />
<uses-permission android:name="com.client.permission.MY_PERMISSION" />
<activity
android:name=".ui.MainTabActivity"
android:label="#string/app_name"
android:screenOrientation="portrait" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<provider
android:name=".provider.DemoProvider"
android:authorities="demo"
android:multiprocess="true"
android:permission="com.client.permission.MY_PERMISSION" />
</manifest>
But if I use two separated application, it works will like.
<!-- Application Provider -->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.nfcdemo.provider"
android:versionCode="6"
android:versionName="build-svn291" >
<uses-sdk
android:minSdkVersion="14"
android:targetSdkVersion="17" />
<permission
android:name="com.client.permission.MY_PERMISSION"
android:label="#string/provider_label"
android:protectionLevel="signatureOrSystem" />
<provider
android:name=".provider.DemoProvider"
android:authorities="demo"
android:multiprocess="true"
android:permission="com.client.permission.MY_PERMISSION" />
</manifest>
<!-- Application UI -->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.nfcdemo.ui"
android:versionCode="6"
android:versionName="build-svn291" >
<uses-sdk
android:minSdkVersion="14"
android:targetSdkVersion="17" />
<uses-permission android:name="com.client.permission.MY_PERMISSION" />
<activity
android:name=".ui.MainTabActivity"
android:label="#string/app_name"
android:screenOrientation="portrait" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</manifest>

Creating Android Native Extension and getting: Permission Denial: starting Intent.. on second activity

I am successfully calling my first Activity from my AIR Native Extension, however, when I try to call the second one, I am getting the Permission Denial error (see logcat screenshot). I have tried everything I have found suggested on this site, so posting question.
02-12 15:43:22.430: I/ActivityManager(271): START {act=android.intent.action.RUN cmp=com.cno.android.map/.AddMarkerActivity (has extras) u=0} from pid 14173
02-12 15:43:22.440: W/ActivityManager(271): Permission Denial: starting Intent { act=android.intent.action.RUN cmp=com.cno.android.map/.AddMarkerActivity (has extras) } from ProcessRecord{4147a718 14173:air.TestAndroidExtension.debug/u0a75} (pid=14173, uid=10075) not exported from uid 10072
Here is my manifest:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.cno.android.map"
android:versionCode="1"
android:versionName="1.0" >
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<!-- Maps API needs OpenGL ES 2.0. -->
<uses-feature
android:glEsVersion="0x00020000"
android:required="true" />
<!-- End of copy. -->
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#android:style/Theme.Black.NoTitleBar" >
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" />
<activity
android:name="com.cno.android.map.InitMapActivity"
android:label="#string/title_activity_init_map" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.cno.android.map.AddMarkerActivity"
android:exported="true" >
<intent-filter>
<action android:name="android.intent.action.RUN"/>
</intent-filter>
</activity>
</application>
Things to note:
I first tried AddMarkerActivity without any intent-filter defined. Not having ANY luck, I began experimenting with the RUN action. I have commented everything out in AddMarkerActivity except for one logcat message that says "HELLO" in the onCreate method. As you can see my Activity is not duplicated in the manifest and exported is set to true.
And finally, here is how I am calling the Activity:
public class AddAnnotationFunction implements FREFunction {
public static final String TAG = "AddAnnotationFunction";
public final static String EXTRA_MARKER = "com.cno.nativemap.functions.marker";
#Override
public FREObject call(FREContext context, FREObject[] args) {
Intent intent = new Intent();
intent.setClassName("com.cno.android.map", "com.cno.android.map.AddMarkerActivity");
Log.d(TAG, "Starting Map Activity- add marker");
intent.setAction("android.intent.action.RUN");
intent.putExtra(EXTRA_MARKER, new GeoMarker(args));
context.getActivity().startActivity(intent);
return null;
}
}

UserManager getUserCount() (Jelly Bean)

I am working on this class : UserManager
public int getUserCount ()
Return the number of users currently created on the device.
My code is:
UserManager um = (UserManager) getSystemService(USER_SERVICE);
int count = um.getUserCount();
Log.i("count",""+count);
It produce error like this:
Caused by: java.lang.SecurityException: You need MANAGE_USERS permission to: query users
at android.os.Parcel.readException(Parcel.java:1425)
at android.os.Parcel.readException(Parcel.java:1379)
at android.os.IUserManager$Stub$Proxy.getUsers(IUserManager.java:321)
at android.os.UserManager.getUsers(UserManager.java:198)
at android.os.UserManager.getUserCount(UserManager.java:186)
at com.example.multiusertest.MainActivity.onCreate(MainActivity.java:52)
at android.app.Activity.performCreate(Activity.java:5104)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144)
I already added this permission manually in Manifest file. Does anyone know why it is produce.
Manifest File:
<uses-sdk
android:minSdkVersion="17"
android:targetSdkVersion="17" />
<uses-permission android:name="android.permission.MANAGE_USERS"/>
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.example.multiusertest.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>
The MANAGE_USERS has a protectionlevel of signature|system, which means that the application has to be signed with the platform key. See this thread on XDA

Categories

Resources