I am using Wikitude API 1.1 as an AR viewer in my application. The problem with Wikitude, if I did not start the Wikitude application from the moment the phone loads, I get a NullPointerException every time I start my own application.
So, I think that if I can start my application first, and they checked whether Wikitude is installed and running. If it is not installed, go to the n download market. If it does not work, we must run it right in the background so that my application does not lose focus.
this.WIKITUDE_PACKAGE_NAME = "com.wikitude";
PackageManager pacMan = Poligamy.this.getPackageManager();
try {
PackageInfo pacInfo = pacMan.getPackageInfo(this.WIKITUDE_PACKAGE_NAME, pacMan.GET_SERVICES);
Log.i("CheckWKTD", "Wikitude is Installed");
ActivityManager aMan = (ActivityManager) this.getSystemService(ACTIVITY_SERVICE);
List<RunningAppProcessInfo> runningApps = aMan.getRunningAppProcesses();
int numberOfApps = runningApps.size();
for(int i=0; i<numberOfApps; i++) {
if(runningApps.get(i).processName.equals(this.WIKITUDE_PACKAGE_NAME)) {
this.WIKITUDE_RUNNING = 1;
Log.i("CheckWKTD", "Wikitude is Running");
}
}
if(this.WIKITUDE_RUNNING == 0) {
Log.i("CheckWKTD", "Wikitude is NOT Running");
}
} catch (NameNotFoundException e) {
Log.i("CheckWKTD", "Wikitude is NOT Installed");
e.printStackTrace();
}
The commented part of the block is the intention to launch Wikitude. But I have always failed to limit Wikitude to the background. Any help? Thanks before.
Best, Tista p>