question

jsheusi avatar image
jsheusi asked Jacob Abrams commented

Development stuck here! Can't solve security exception when trying to add a Tag. See Details

Caused by: java.lang.SecurityException: Access denied to package com.sheusi.jim.clomo1 at android.os.Parcel.readException(Parcel.java:1465) at android.os.Parcel.readException(Parcel.java:1419) at com.clover.sdk.v3.inventory.IInventoryService$Stub$Proxy.createTag(IInventoryService.java:2721) at com.clover.sdk.v3.inventory.InventoryConnector$75.call(InventoryConnector.java:657) at com.clover.sdk.v3.inventory.InventoryConnector$75.call(InventoryConnector.java:655) at com.clover.sdk.v1.ServiceConnector.execute(ServiceConnector.java:211) at com.clover.sdk.v3.inventory.InventoryConnector.createTag(InventoryConnector.java:655) at com.sheusi.jim.clomo1.MainActivity$TagAsyncTask.doInBackground(MainActivity.java:136) at com.sheusi.jim.clomo1.MainActivity$TagAsyncTask.doInBackground(MainActivity.java:126) at android.os.AsyncTask$2.call(AsyncTask.java:288)

Here is the code line. The JSON block is correct, i.e. matches the sample on the Clover doc pages.

mInventoryConnector.createTag(new Tag(gson.toJson(t)));

..... "t" argument is a String of the JSON block.

10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

Jacob Abrams avatar image
Jacob Abrams answered Jacob Abrams commented

Did you follow all the steps Android apps to ensure you have permissions set and the app installed? It's fairly complicated but necessary to get the permissions for your app setup, we do not use traditional android permissions. You should read everything in https://docs.clover.com/build/android... and https://docs.clover.com/build/android...

7 comments
10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

jsheusi avatar image jsheusi commented ·

Yes, I assigned the app read and write for inventory, but that's all. I assume that is all it needs. The docs say that adding a Tag requires a Tag object as an argument and that the constructor for a Tag takes the text of a JSON block as the argument. That's what I did. Under the "building your first app" guide, I was able to read back inventory that I posted with the Inventory sample app from Clover- It posts a bottled water with a value of $1.00.

If you have any other ideas, please send then along. Thanks,

JIm

0 Likes 0 ·
jsheusi avatar image jsheusi commented ·

Ahhhh, maybe it needs Merchant permissions, too, I will try that (although reading back the bottled water didn't need merchant permission.) Jim

0 Likes 0 ·
Jacob Abrams avatar image Jacob Abrams ♦♦ commented ·

Note that sample Clover apps use the package com.clover which gives it permission to do pretty much anything, your app can't use that package. You should only need inventory read and write for tags. Did you go to the app market on the device, find your app and "install" it? You need to do that once to activate the permissions.

0 Likes 0 ·
jsheusi avatar image jsheusi commented ·

Hi Jacob, com.clover is scattered all through the samples in this web page: https://docs.clover.com/build/android...

The text below comes right out of the tutorial. import com.clover.sdk.util.CloverAccount; import com.clover.sdk.v1.BindingException; import com.clover.sdk.v1.ClientException;

com.clover is even in the dependencies in the gradle file. How can a code do anything without your classes and methods? The java docs are posted for using these as well.

I don't get it. Jim

0 Likes 0 ·
Jacob Abrams avatar image Jacob Abrams ♦♦ commented ·

What I mean to say is that in your AndroidManifest you can cannot submit an app to our app market with a package name that starts with "com.clover." See http://developer.android.com/guide/to... We use that package prefix in our tests and this allows our tests to function without needing to actually be registered in the app market.

0 Likes 0 ·
Show more comments

Welcome to the
Clover Developer Community