I get a zero point error in my code and the log points here
199 public void getPurchasedSubs () throws RemoteException {
200 Bundle ownedItems = mService.getPurchases(3, getPackageName(), "subs", null);
Here is a dump of the logcat file
03-08 13:24:45.619: E/AndroidRuntime(7149): FATAL EXCEPTION: main
03-08 13:24:45.619: E/AndroidRuntime(7149): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.imobilize.ETV_V3_INAPP_SUB/com.imobilize.ETV_V3_INAPP_SUB.IntroBLevActivity}: java.lang.NullPointerException
03-08 13:24:45.619: E/AndroidRuntime(7149): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1970)
03-08 13:24:45.619: E/AndroidRuntime(7149): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1995)
03-08 13:24:45.619: E/AndroidRuntime(7149): at android.app.ActivityThread.access$600(ActivityThread.java:128)
03-08 13:24:45.619: E/AndroidRuntime(7149): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1161)
03-08 13:24:45.619: E/AndroidRuntime(7149): at android.os.Handler.dispatchMessage(Handler.java:99)
03-08 13:24:45.619: E/AndroidRuntime(7149): at android.os.Looper.loop(Looper.java:137)
03-08 13:24:45.619: E/AndroidRuntime(7149): at android.app.ActivityThread.main(ActivityThread.java:4517)
03-08 13:24:45.619: E/AndroidRuntime(7149): at java.lang.reflect.Method.invokeNative(Native Method)
03-08 13:24:45.619: E/AndroidRuntime(7149): at java.lang.reflect.Method.invoke(Method.java:511)
03-08 13:24:45.619: E/AndroidRuntime(7149): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:980)
03-08 13:24:45.619: E/AndroidRuntime(7149): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:747)
03-08 13:24:45.619: E/AndroidRuntime(7149): at dalvik.system.NativeStart.main(Native Method)
03-08 13:24:45.619: E/AndroidRuntime(7149): Caused by: java.lang.NullPointerException
03-08 13:24:45.619: E/AndroidRuntime(7149): at com.imobilize.ETV_V3_INAPP_SUB.IntroBLevActivity.getPurchasedSubs(IntroBLevActivity.java:200)
03-08 13:24:45.619: E/AndroidRuntime(7149): at com.imobilize.ETV_V3_INAPP_SUB.IntroBLevActivity.checkValidation(IntroBLevActivity.java:238)
03-08 13:24:45.619: E/AndroidRuntime(7149): at com.imobilize.ETV_V3_INAPP_SUB.IntroBLevActivity.onCreate(IntroBLevActivity.java:96)
03-08 13:24:45.619: E/AndroidRuntime(7149): at android.app.Activity.performCreate(Activity.java:4470)
03-08 13:24:45.619: E/AndroidRuntime(7149): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1053)
Specs for this method
Bundle getPurchases(int apiVersion, String packageName, String type, String continuationToken);
When I check the package name, it goes back to action
Here is the code where mService IInAppBillingService mService is created;
ServiceConnection mServiceConn = new ServiceConnection() {
public void onServiceDisconnected(ComponentName name) {
mService = null;
}
public void onServiceConnected(ComponentName name,
IBinder service) {
mService = IInAppBillingService.Stub.asInterface(service);
}
};
I am not so good at logcat, so the answer may be right in front of me.
This piece of code that I thought was supposed to open, so I can use mService at any time.
bindService(new
Intent("com.android.vending.billing.InAppBillingService.BIND"),
mServiceConn, Context.BIND_AUTO_CREATE);
source
share