..私はあなたがあなたの活動に写真を撮っているのか分からないが、私もあなたの近くに、あなたのアプリのバックグラウンドでアプリケーションを実行するためにあなたを導くことができますし、毎秒でお使いのカメラのコードを実行することができます私はそれが動作するフォアグラウンドアプリを監視するためにこれを使用している
startService(new Intent(this, SampleService.class));
public class SampleService extends Service {
public SampleService() {
}
@Override
public IBinder onBind(Intent intent) {
// TODO: Return the communication channel to the service.
return null;
}
@Override
public int onStartCommand(final Intent inten, int flags, int startId) {
Timer timer = new Timer();
timer.scheduleAtFixedRate(new TimerTask() {
@Override
public void run() {
Handler handler = new Handler(Looper.getMainLooper());
handler.post(new Runnable() {
@Override
public void run() {
// Make use your method here..
}
});
}
}, 5000, 2000);
return super.onStartCommand(inten, flags, startId);
}
@Override
public void onCreate() {
super.onCreate();
}}
そして、あなたは、サービス形態の活動を開始する必要があります..