Detect card holder's name -

First of all, Thanks for this great sdk and easy integration process.
While using this, I came across some custom needs that need to be incorporated in my app. That is, detecting card holder's name. Is there a way we can do that?

Raghav, at present is not able to detect the cardholder name. We do hope to add that feature sometime in the future, though.

Why not get the time of sale, customer name and cc number and use intent on the next activity. It takes 3-5 seconds to enter a name, maybe less.
TextView textView = (TextView) findViewById(;
System.currentTimeMillis(), DateUtils.FORMAT_SHOW_TIME |
custname = (TextView)findViewById(;
if (scanResult.isExpiryValid()) {
final TextView xxx =(TextView)findViewById(;
String threex = xxx.getText().toString();
final TextView x =(TextView)findViewById(;
String onex = x.getText().toString();
Intent intent= new Intent(MyScanActivity.this,YourNextActivity.class)
.putExtra("Card Number",resultStr)


How to modify user datas inserted in sharedpreference before it's saved?

I would like to know if there is a simple way to modify a user data inserted in sharepreference before it's saved.
To be clear, I insert a code in my settings (preference), and I would like to crypt that code (for more security) then save it in sharepreference. When I read the preferences, I can decrypt that code, it's easy, but how to crypt it before preferences save it ?
I have several ideas :
1. make my own preferences and save it in a file or data base, but I would prefer to use sharepreference,
2. when exiting preferences (back key), read code inserted, crypt it, then save it, but lot of actions !
I'm looking for a better solution directly when I insert the code.
If you have a solution, thank you for your help
I think the better way is the second one.
create a new class (crypted_code) with a layout containing the editText box to read the code,
adding a public boolean onKeyDown(int keyCode, #NonNull KeyEvent event) to detect back key,
then save the code after crypting it :
code = crypt(code);
SharedPreferences mgr = PreferenceManager.getDefaultSharedPreferences(this);
SharedPreferences.Editor editor = mgr.edit();
editor.putString("code", code);

How to get unique identifiacation number of iphone

I want to get unique id of iphone.currently I am using Display.getInstance().getUdid(); but it gives different unique id each time I install an application on iphone.
Can you please let me how to resolve it?
You can no longer get the Unique id per device because of apples revised security policy . identifierForVendor is the best alternative you can go for.
You can try
UIDevice *device = [UIDevice currentDevice];
NSString *currentDeviceId = [[device identifierForVendor]UUIDString];
getUDID() returns a faux number that can't be made unique due to Apple's restrictions.
You can get it by calling this function:

Some items in my ipod library have a NULL assturl property

When try to pick an item from my ipod library some items play and some dont.
Looking at my log some items have a NULL for assetURL.
Why would that be?
all item are DRM protected which return null assetURL. You can't access such item
I want to add something to this. There are three reasons that I know of why assetURL will be null
The item is in the cloud (in which case isCloudItem will return true).
As stated in another answer, if the track is DRM protected.
This is the kicker, tho: in some cases, and item downloaded on the device, which is not DRM, will play in Music (the built-in App), but will still have assetURL returning NULL.
This means that any non-Apple App that uses the MediaPlayer framework may encounter some media items that play in Music, but which cannot be played in the App. Your end user can usually "fix" this problem by deleting the offending track in Music, and downloading it again.
I find that if I download a complete album and see this issue, then downloading the album again (after deleting it) will lead to some different tracks having the problem, so that is not a good way to go.
I have entered an Apple bug-report for this (21477730). I also used a DTS to ask for a work-around: there is none. If you are encountering this too, a "me too" to the bug report. This may increase the chances of a fix.
If you want to try this out for yourself, below is the code that I sent in with the bug report.
MPMediaQuery *allAlbumsQuery = [MPMediaQuery albumsQuery];
NSArray *allAlbumsArray = [allAlbumsQuery collections];
for (MPMediaItemCollection *collection in allAlbumsArray)
NSArray* items = collection.items;
MPMediaItem* rep = collection.representativeItem;
NSString* name = rep.albumTitle;
for(MPMediaItem* item in items)
NSURL* url = item.assetURL;
BOOL isCloudItem = item.isCloudItem;
if(!isCloudItem && (url==nil))
NSString* albumTitle = item.albumTitle;
NSString* trackTitle = item.title;
NSLog(#"****Nil: %# %#",albumTitle,trackTitle);

How do I avoid STANDARD_PRICE_NOT_DEFINED when unit-testing an OpportunityLineItem in Apex v24.0?

Apparently a new feature of the Spring '12 / v24.0 release of Apex in is that unit tests no longer have access to 'real' data -- thus (if I'm understanding the change correctly) a SOQL query will now only retrieve objects that have been inserted during the course of the unit test -- and even that is subject to some limitations.
At any rate this seems to throw OpportunityLineItem testing out the window, because:
It's impossible to insert an OpportunityLineItem without a PriceBookEntryId, BUT
You can't insert a new price-book entry for product X unless you already have a Standard Price Book entry for product X, BUT
There isn't a Standard Price Book in the test data because the Pricebook2 table, like all tables, is effectively empty at the beginning of the unit-test run, AND
There's no way to create a Standard Price Book in Apex
I'm really hoping I got at least one of those four points wrong, but so far no variation on my existing unit-tests has shown any of them to be wrong. Which of course means my unit tests no longer work. This happened literally overnight -- the tests ran fine in my sandbox on Friday, and now they fail.
Am I missing something, or is this a bug in the new SFDC release?
There is new functionality introduced in Summer 14, you can now use Test.getStandardPricebookId() to get the standard pricebook ID without having to set SeeAllData to True.
Firstly, to put your mind at ease, there are no plans ever to deprecate the seeAllData flag. We're not going to pull the rug out from under you. As to the creation of standard price book in an apex test, I'm not sure. There are, I'm sure, several areas where testing without existing data is difficult on the platform today, which is one reason why the seeAllData flag is there. We'll be trying to close those gaps in the next few releases.
I just ran into this, and although your post is old, it's the first result on Google so I thought I'd share what I did.
My basic architecture is a test class that calls a utility class to as a way of creating test data on the fly (there are other ways, this is my habit).
Short version:
set see all data to true
make sure the standard price book is active
add a pricebook entry for the standard price book - flag as active
add a pricebook entry for you test price book - flag as active
Test class:
#isTest (seeAllData=true)
public with sharing class RMA_SelectLineItemsControllerTest {
static testmethod void testBasicObjects() {
Pricebook2 standard = [Select Id, Name, IsActive From Pricebook2 where IsStandard = true LIMIT 1];
if (!standard.isActive) {
standard.isActive = true;
update standard;
Pricebook2 pb = RMA_TestUtilities.createPricebook();
Product2 prod = RMA_TestUtilities.createProduct();
PricebookEntry pbe = RMA_TestUtilities.createPricebookEntry(standard,pb,prod);
The utility method look like this (only showing that around the new PBE):
public static PricebookEntry createPricebookEntry (Pricebook2 standard, Pricebook2 newPricebook, Product2 prod) {
System.debug('***** starting one');
PricebookEntry one = new PricebookEntry();
one.pricebook2Id =;
one.product2id =;
one.unitprice = 1249.0;
one.isactive = true;
insert one;
System.debug('***** one complete, ret next');
PricebookEntry ret = new PricebookEntry();
ret.pricebook2Id =;
ret.product2id =;
ret.unitprice = 1250.0;
ret.isactive = true;
insert ret;
return ret;
Another work around would be to make your trigger be aware of being run in a test using Test.isRunningTest(), but I think this solution misses the point of best practice, which I believe is the whole point of making tests isolated from pre-existing data.
Perhaps Salesforce could make the Pricebook2.isStandard field writeable if code is running in the context of a test, or the specific Standard Price Book record should be given the same status as User and Profile??
Please let me know if anyone has used Test.getStandardPricebookId() and able to insert opportunity line item in test class. I tried this method with below mentioned code but got an error ": STANDARD_PRICE_NOT_DEFINED, No standard price defined for this product: []".
Note: I have seeAllData=false
ID standardPBID = Test.getStandardPricebookId();
PriceBook2 pb = new PriceBook2(); = 'GEW Water CMS';
insert pb;
Product2 prod= new Product2();'TestProd';
insert prod;
PricebookEntry standardPrice = new PricebookEntry(Pricebook2Id = standardPBID, Product2Id = prod.Id, UnitPrice = 10000, IsActive = true, currencyISOCode='USD' );
PriceBookEntry pbe= new PricebookEntry(,,unitprice=2000, isActive=true, currencyISOCode='EUR');
insert pbe;
OpportunityLineItem oli = new OpportunityLineItem(OpportunityId = OppList[0].Id,, UnitPrice = 100, Quantity = 1);
insert oli;

AnyChart 8.1.0 - Resource Gantt - Move periods from one resource to another

I am using the AnyChart 8.1.0 resource Gantt (anychart.ganttResource()) to show and edit planned data (car reservations).
I can edit / move a reservation horizontally to change the time / period of a reservation and also drag the start and/or enddate. But I would like to move a reservation from one car (row) to another - very similar to moving a task from one person to another.
Is that possible - and how?
I'm having the same issue, and as far as I can see you can use
tree.listen("treeItemMove", function (e) {
// do your stuff
Unfortunally, I think this will only work, if you only have one reservation in each row. If you have more than one, all reservations will be moved.
So far I haven't found a solution to get one reservation and move it to another row. But I hope it may help you in the rigth direction..
I have contacted Anychart support and asked if there is a way to move one period from one (child-) row and create a new row under another parent?
Here is the answer:
the current version of AnyGantt 8.1.0 doesn't provide this feature as an out-of-the-box or even with the extra code.
But you can modify the dataTree from the code as you need. This provides full control under the data, but without mouse interactivity.
That's too bad. I can manipulate the tree - even one period, using this code to delete and add a period. You can update a period as well, code should be similar.
function deletePeriod( pItemId, pPeriodId ){
var item ="id", pItemId);
var periods = item.get("periods")
var i = periods.findIndex(function(e){ return == pPeriodId; });
item.set('periods', periods);
treeData.addChildAt( item, treeData.indexOfChild(item) );
function addPeriod( pItemId, pPeriodId, start, end){
var period = {
"id": pPeriodId,
"start": start,
"end": end,
"name": "Whatever name you want"
var item ="id", pItemId);
var periods = item.get("periods");
item.set('periods', periods);
treeData.addChildAt( item, treeData.indexOfChild(item) );