SACRAMENTO — Tracking heartbeats, monitoring blood sugar levels and even recording how many times a month a headache pounds your skull—yep, there are apps for that.

But those ventures could be facing a wave of litigation, defense attorneys say, if their developers don’t grasp the extent of recently enacted and little noticed legislation requiring certain health apps to comply with California’s medical privacy laws.