Typically, when one country informs another before launching an attack on it, it's called a declaration of war. Obviously, a declaration of war does not make the declaring party a non-aggressor.
However, India's claim is that no Pakistani military sites were targeted, rather that it was launching an attack on terrorist infrastructure that happens to be located in Pakistan, much like the US air campaign against ISIS in Syria, for example (sources: 1 2). In addition to practical benefits noted by the other answer, notifying Pakistan serves a propaganda purpose: it permits India to present the attacks as coordinating an anti-terrorist operation on Pakistani territory, rather than as an attack on Pakistan itself. Therefore, if or when Pakistan retaliates, India can accuse it of being the aggressor (for example), or of supporting terrorists.
Note that the sources I cited are clearly not impartial and I make no claim about the validity of their statements, only that this is how India is trying to present the attacks, and notifying Pakistan supports that aim.