Treatment of schizophrenia, or of moderate to severe manic episodes in bipolar I disorder with sensor to measure medication adherence