Project

General

Profile

Support #247

BeemApplication - interface suggestion.

Added by John Pope over 14 years ago. Updated almost 13 years ago.

Status:
New
Priority:
Low
Assignee:
-
Category:
Conception
Target version:
-
Start date:
02/25/2010
Due date:
% Done:

0%

Estimated time:
Close

Description

Make it easy to re-use Beem in other applications by referencing an interface to BeemApplication and not the application class itself.

Eg.
in this class
public class XmppConnectionAdapter extends IXmppConnection.Stub

....

if (ctx instanceof BeemApplication) {
mApplication = (BeemApplication) ctx;
}else {
// PLEASE ADD THIS LINE with FATAL ERRORS!!!!!
Log.e(TAG,"mService.getApplicationContext() is not instance of BeemApplication");
}

I believe the BeemApplication reference should be replaced with an interface / IBeemApplication.

Eg.
Simply make BeemApplication.java
public class Application extends android.app.Application implements IBeemApplication

public interface IBeemApplication {

public boolean isConnected() ;
public void setConnected(boolean isConnected);
}

Then I can the implementation to my application and reuse beem framework in other applications.

if (ctx instanceof IBeemApplication) {
mApplication = (IBeemApplication) ctx;
}else {
Log.e(TAG,"Your application must implement IBeemApplication!");
}

Also available in: Atom PDF