Using the sample app provided in the android download, I would like to use api.disableBumping() in the onCreate() method to add the broadcastreceiver but disablebumping until further notice. Application keeps crashing on me.
Any pointers?
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.main);
bindService(new Intent(IBumpAPI.class.getName()),
connection, Context.BIND_AUTO_CREATE);
IntentFilter filter = new IntentFilter();
filter.addAction(BumpAPIIntents.CHANNEL_CONFIRMED);
filter.addAction(BumpAPIIntents.DATA_RECEIVED);
filter.addAction(BumpAPIIntents.NOT_MATCHED);
filter.addAction(BumpAPIIntents.MATCHED);
filter.addAction(BumpAPIIntents.CONNECTED);
registerReceiver(receiver, filter);
try {
api.disableBumping();
} catch (RemoteException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
debug info
Thread [<1> main] (Suspended (exception RuntimeException))
ActivityThread.performLaunchActivity(ActivityThread$ActivityClientRecord, Intent) line: 1816
ActivityThread.handleLaunchActivity(ActivityThread$ActivityClientRecord, Intent) line: 1837
ActivityThread.access$1500(ActivityThread, ActivityThread$ActivityClientRecord, Intent) line: 132
ActivityThread$H.handleMessage(Message) line: 1033
ActivityThread$H(Handler).dispatchMessage(Message) line: 99
Looper.loop() line: 143
ActivityThread.main(String[]) line: 4196
Method.invokeNative(Object, Object[], Class, Class[], Class, int, boolean) line: not available [native method]
Method.invoke(Object, Object...) line: 507
ZygoteInit$MethodAndArgsCaller.run() line: 839
ZygoteInit.main(String[]) line: 597
NativeStart.main(String[]) line: not available [native method]
In the lines below I'm explaining how the logic of Bump works,
When calling
bindService(new Intent(IBumpAPI.class.getName()), connection, Context.BIND_AUTO_CREATE);
the onServiceConnected gets called, which then you can call
api = IBumpAPI.Stub.asInterface(binder);
try { api.configure("YOUR_API_KEY", "Bump User"); }
catch (RemoteException e) { }
Then you wait till the broadcast CONNECTED is received, from that point and onwards it's up to you when to call the api.enableBumping() or api.disableBumping()
Note: If your connection is down when calling the api.configure() a remote exception will be thrown.