Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- PackageInfo pinfo;
- try {
- pinfo = getPackageManager().getPackageInfo(getPackageName(), 0);
- } catch (NameNotFoundException e1) {
- // TODO Auto-generated catch block
- e1.printStackTrace();
- pinfo = null;
- }
- appVersion = pinfo.versionCode;
- public class NonActivityClass implements SensorListener{
- Context mContext;
- public NonActivtiyClass(Context context) {
- this.mContext = context;
- }
- //Rest of your code
- }
- NonActivityClass nac = new NonActivityClass(this);
- public int getAppVersionCode() {
- return BuildConfig.VERSION_CODE;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement