I'm having an issue similar to the question found here: Google In-App billing, IllegalArgumentException: Service Intent must be explicit, after upgrading to Android L Dev Preview. I have tried the solution in the suggested answer:https://stackoverflow.com/a/26318757/1489990 but I am getting an issue specifically on my nexus 9 with android 5.0.1 (and I'm assuming this also applies to all devices with android 5.0).
The issue is that with this code:
connection = new ServiceConnection() {
@Override
public void onServiceDisconnected(ComponentName name) {
mservice = null;
Log.d("PRICE","mservice disconnected");
}
@Override
public void onServiceConnected(ComponentName name, IBinder service) {
mservice = IInAppBillingService.Stub.asInterface(service);
Log.d("PRICE","mservice connected");
if(mservice==null){
Log.d("PRICE","mservice is null");
}
}
};
on a device without android 5.0 in my log I see "mservice connected". However on my nexus 9 I get none of the log messages, which leads me to believe mservice is null and the cause of my NPE that is generated when I attempt a purchase with this line:
Bundle buyIntentBundle = mservice.getBuyIntent(3, getPackageName(),
"images", "inapp", "key");
Any suggestions for how I can fix this issue?